Search in sources :

Example 51 with Topology

use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.

the class PublishSubscribeSPLTest method testSPLPublishNoFilterWithSubscribe.

/**
 * Test that with publish allow filter set to false
 * a subscriber without a filter gets the full set of data.
 */
@Test
public void testSPLPublishNoFilterWithSubscribe() throws Exception {
    final Topology t = new Topology();
    SPLStream source = SPLStreamsTest.testTupleStream(t);
    source = addStartupDelay(source);
    final String topic = uniqueTopic("SPLNoFilter");
    source.publish(topic, false);
    SPLStream sub = SPLStreams.subscribe(t, topic, source.getSchema());
    TStream<String> subscribe = sub.transform(new GetTupleId());
    completeAndValidate(subscribe, 20, "SPL:0", "SPL:1", "SPL:2", "SPL:3");
}
Also used : Topology(com.ibm.streamsx.topology.Topology) TestTopology(com.ibm.streamsx.topology.test.TestTopology) SPLStream(com.ibm.streamsx.topology.spl.SPLStream) Test(org.junit.Test) SPLStreamsTest(com.ibm.streamsx.topology.test.spl.SPLStreamsTest)

Example 52 with Topology

use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.

the class PublishSubscribeTopicNames method testNullTopicNameParam.

@Test(expected = NullPointerException.class)
public void testNullTopicNameParam() throws Exception {
    final Topology t = new Topology();
    t.strings().publish((Supplier<String>) null);
}
Also used : Topology(com.ibm.streamsx.topology.Topology) TestTopology(com.ibm.streamsx.topology.test.TestTopology) Test(org.junit.Test)

Example 53 with Topology

use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.

the class PublishSubscribeTopicNames method testWildcardPlus1TopicName.

@Test(expected = IllegalArgumentException.class)
public void testWildcardPlus1TopicName() throws Exception {
    final Topology t = new Topology();
    t.strings().publish("+", true);
}
Also used : Topology(com.ibm.streamsx.topology.Topology) TestTopology(com.ibm.streamsx.topology.test.TestTopology) Test(org.junit.Test)

Example 54 with Topology

use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.

the class JobConfigOverlaysFileTest method testStandalone.

@Test
public void testStandalone() throws Exception {
    // Just a simple graph, which won't be executed.
    Topology topology = newTopology("testNoConfig");
    topology.constants(Collections.emptyList());
    @SuppressWarnings("unchecked") StreamsContext<File> sb = (StreamsContext<File>) StreamsContextFactory.getStreamsContext(Type.STANDALONE_BUNDLE);
    sab = sb.submit(topology).get();
    String jconame = sab.getName().replace(".sab", "_JobConfig.json");
    jcos = new File(sab.getParentFile(), jconame);
    assertFalse(jcos.exists());
}
Also used : StreamsContext(com.ibm.streamsx.topology.context.StreamsContext) Topology(com.ibm.streamsx.topology.Topology) TestTopology(com.ibm.streamsx.topology.test.TestTopology) File(java.io.File) Test(org.junit.Test)

Example 55 with Topology

use of com.ibm.streamsx.topology.Topology in project streamsx.topology by IBMStreams.

the class JobConfigOverlaysFileTest method testJobConfigOther.

@Test
public void testJobConfigOther() throws Exception {
    // Just a simple graph, which won't be executed.
    Topology topology = newTopology("testJobConfigOther");
    topology.constants(Collections.emptyList());
    Map<String, Object> cfg = new HashMap<>();
    {
        JobConfig jc = new JobConfig();
        jc.addToConfig(cfg);
        jc.setDataDirectory("/tmp/abc");
        jc.setPreloadApplicationBundles(true);
        jc.setTracing(Level.INFO);
        assertEquals("info", jc.getStreamsTracing());
    }
    sab = bundler().submit(topology, cfg).get();
    JsonObject jcos = assertSabGetJcos(topology);
    assertDefaultDeployment(jcos);
    JsonObject jco = jobConfigOverlay(jcos);
    assertMissing(jco, "operatorConfigs");
    assertMissing(jco, "configInstructions");
    assertTrue(jco.has("jobConfig"));
    assertTrue(jco.get("jobConfig").isJsonObject());
    JsonObject jc = jco.get("jobConfig").getAsJsonObject();
    assertMissing(jc, "jobName");
    assertMissing(jc, "jobGroup");
    assertJsonString(jc, "dataDirectory", "/tmp/abc");
    assertJsonBoolean(jc, "preloadApplicationBundles", true);
    assertJsonString(jc, "tracing", "info");
    assertEquals(3, jc.entrySet().size());
}
Also used : HashMap(java.util.HashMap) JsonObject(com.google.gson.JsonObject) JsonObject(com.google.gson.JsonObject) Topology(com.ibm.streamsx.topology.Topology) TestTopology(com.ibm.streamsx.topology.test.TestTopology) JobConfig(com.ibm.streamsx.topology.jobconfig.JobConfig) Test(org.junit.Test)

Aggregations

Topology (com.ibm.streamsx.topology.Topology)372 TestTopology (com.ibm.streamsx.topology.test.TestTopology)315 Test (org.junit.Test)301 List (java.util.List)116 Tester (com.ibm.streamsx.topology.tester.Tester)115 ArrayList (java.util.ArrayList)70 SPLStream (com.ibm.streamsx.topology.spl.SPLStream)68 HashMap (java.util.HashMap)49 TStream (com.ibm.streamsx.topology.TStream)42 Condition (com.ibm.streamsx.topology.tester.Condition)28 File (java.io.File)27 TimeUnit (java.util.concurrent.TimeUnit)27 StreamSchema (com.ibm.streams.operator.StreamSchema)26 Random (java.util.Random)26 JSONObject (com.ibm.json.java.JSONObject)23 HashSet (java.util.HashSet)23 RString (com.ibm.streams.operator.types.RString)21 StreamsContext (com.ibm.streamsx.topology.context.StreamsContext)21 Message (com.ibm.streamsx.topology.tuple.Message)20 SimpleMessage (com.ibm.streamsx.topology.tuple.SimpleMessage)20