use of org.openkilda.wfm.topology.TestingKafkaBolt in project open-kilda by telstra.
the class OpenTSDBTopologyTest method shouldSendDatapointRequestsTwice.
@Ignore
@Test
public void shouldSendDatapointRequestsTwice() throws Exception {
Datapoint datapoint1 = new Datapoint("metric", timestamp, Collections.emptyMap(), 123);
String jsonDatapoint1 = MAPPER.writeValueAsString(datapoint1);
Datapoint datapoint2 = new Datapoint("metric", timestamp, Collections.emptyMap(), 456);
String jsonDatapoint2 = MAPPER.writeValueAsString(datapoint2);
MockedSources sources = new MockedSources();
sources.addMockData(Topic.OTSDB + "-spout", new Values(jsonDatapoint1), new Values(jsonDatapoint2));
completeTopologyParam.setMockedSources(sources);
Testing.withTrackedCluster(clusterParam, (cluster) -> {
OpenTSDBTopology topology = new TestingTargetTopology(new TestingKafkaBolt());
StormTopology stormTopology = topology.createTopology();
Testing.completeTopology(cluster, stormTopology, completeTopologyParam);
});
// verify that request is sent to OpenTSDB server once
mockServer.verify(HttpRequest.request(), VerificationTimes.exactly(2));
}
use of org.openkilda.wfm.topology.TestingKafkaBolt in project open-kilda by telstra.
the class OpenTSDBTopologyTest method shouldSendDatapointRequestsOnlyOnce.
@Ignore
@Test
public void shouldSendDatapointRequestsOnlyOnce() throws Exception {
Datapoint datapoint = new Datapoint("metric", timestamp, Collections.emptyMap(), 123);
String jsonDatapoint = MAPPER.writeValueAsString(datapoint);
MockedSources sources = new MockedSources();
sources.addMockData(Topic.OTSDB + "-spout", new Values(jsonDatapoint), new Values(jsonDatapoint));
completeTopologyParam.setMockedSources(sources);
Testing.withTrackedCluster(clusterParam, (cluster) -> {
OpenTSDBTopology topology = new TestingTargetTopology(new TestingKafkaBolt());
StormTopology stormTopology = topology.createTopology();
Testing.completeTopology(cluster, stormTopology, completeTopologyParam);
});
// verify that request is sent to OpenTSDB server once
mockServer.verify(HttpRequest.request(), VerificationTimes.exactly(1));
}
use of org.openkilda.wfm.topology.TestingKafkaBolt in project open-kilda by telstra.
the class OpenTSDBTopologyTest method shouldSuccessfulSendDatapoint.
@Ignore
@Test
public void shouldSuccessfulSendDatapoint() throws Exception {
Datapoint datapoint = new Datapoint("metric", timestamp, Collections.emptyMap(), 123);
MockedSources sources = new MockedSources();
// TODO: rather than use Topic.OTSDB, grab it from the TopologyConfig object (which does
// not exist at this point in the code.
sources.addMockData(Topic.OTSDB + "-spout", new Values(MAPPER.writeValueAsString(datapoint)));
completeTopologyParam.setMockedSources(sources);
Testing.withTrackedCluster(clusterParam, (cluster) -> {
OpenTSDBTopology topology = new TestingTargetTopology(new TestingKafkaBolt());
StormTopology stormTopology = topology.createTopology();
Map result = Testing.completeTopology(cluster, stormTopology, completeTopologyParam);
});
// verify that request is sent to OpenTSDB server
mockServer.verify(HttpRequest.request(), VerificationTimes.exactly(1));
}
Aggregations