mirror of https://github.com/apache/nifi.git
NIFI-282: Updated unit test
This commit is contained in:
parent
5c8a9e22d1
commit
8f0402fbbc
|
@ -36,7 +36,7 @@ import org.junit.Test;
|
|||
public class TestSiteToSiteClient {
|
||||
|
||||
@Test
|
||||
//@Ignore("For local testing only; not really a unit test but a manual test")
|
||||
@Ignore("For local testing only; not really a unit test but a manual test")
|
||||
public void testReceive() throws IOException {
|
||||
System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi.remote", "DEBUG");
|
||||
|
||||
|
@ -71,31 +71,31 @@ public class TestSiteToSiteClient {
|
|||
|
||||
|
||||
@Test
|
||||
//@Ignore("For local testing only; not really a unit test but a manual test")
|
||||
@Ignore("For local testing only; not really a unit test but a manual test")
|
||||
public void testSend() throws IOException {
|
||||
System.setProperty("org.slf4j.simpleLogger.log.org.apache.nifi.remote", "DEBUG");
|
||||
|
||||
final SiteToSiteClient client = new SiteToSiteClient.Builder()
|
||||
.url("http://localhost:8080/nifi")
|
||||
.portName("input")
|
||||
.build();
|
||||
|
||||
try {
|
||||
final Transaction transaction = client.createTransaction(TransferDirection.SEND);
|
||||
Assert.assertNotNull(transaction);
|
||||
|
||||
final Map<String, String> attrs = new HashMap<>();
|
||||
attrs.put("site-to-site", "yes, please!");
|
||||
final byte[] bytes = "Hello".getBytes();
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
final DataPacket packet = new StandardDataPacket(attrs, bais, bytes.length);
|
||||
transaction.send(packet);
|
||||
|
||||
transaction.confirm();
|
||||
transaction.complete();
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
final SiteToSiteClient client = new SiteToSiteClient.Builder()
|
||||
.url("http://localhost:8080/nifi")
|
||||
.portName("input")
|
||||
.build();
|
||||
|
||||
try {
|
||||
final Transaction transaction = client.createTransaction(TransferDirection.SEND);
|
||||
Assert.assertNotNull(transaction);
|
||||
|
||||
final Map<String, String> attrs = new HashMap<>();
|
||||
attrs.put("site-to-site", "yes, please!");
|
||||
final byte[] bytes = "Hello".getBytes();
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
final DataPacket packet = new StandardDataPacket(attrs, bais, bytes.length);
|
||||
transaction.send(packet);
|
||||
|
||||
transaction.confirm();
|
||||
transaction.complete();
|
||||
} finally {
|
||||
client.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue