Package javaflow.network.definer

Examples of javaflow.network.definer.NetworkDefiner


        builder = new SimpleNetworkBuilder();
    }

    @Test
    public void simpleGeneratorNetwork() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("out", ToCollection.class);

                from("generator").to("out");
View Full Code Here


        network.runInCurrentThread();
    }

    @Test(timeOut = 1000)
    public void packetListenerIsCalled() {
        Network network = builder.build(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("out", ToCollection.class);

                from("generator").to("out");
View Full Code Here

    }

    @Test(timeOut = 1000, description = "Tests that non-looping component is able to run multiple times")
    public void nonLoopingElementInTheMiddle() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("copy", Copy.class);
                component("out", ToCollection.class);
View Full Code Here

    @Test(timeOut = 10000, description = "Tests that a lots of components can be run when not all of them has to run at the same time")
    public void lotsOfSequentialMooving() {
        final int max = 1000;

        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("out", ToCollection.class);

                for (int i = 0; i < max; i++) {
View Full Code Here

    }

    @Test(timeOut = 10000, description = "Test that multiple senders work")
    public void multipleSenders() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("copy", Copy.class);
                component("out", ToCollection.class);
                int max = 50;
                for (int i = 0; i < max; i++) {
View Full Code Here

        Assert.assertEquals(out.size(), 500);
    }

    @Test(timeOut = 1000)
    public void onlyOutComponentIsStarted() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", StaticTestMessageSender.class);
                component("out", ToCollection.class);

                from("generator").to("out");
View Full Code Here

        Assert.assertEquals(out.size(), 1);
    }

    @Test(timeOut = 1000)
    public void portsInSuperclassAreFilledAlso() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("t2", T2.class);
                component("out", ToCollection.class);

                from("t2").to("out");
View Full Code Here

    }

    @Test(timeOut = 1000)
    public void testArrayPorts() {

        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("splitter", RoundRobinScheduler.class);
                component("aggregator", Aggregator.class);
                component("out", ToCollection.class);
View Full Code Here

    public void testStartAndEndTypes() {
        final Map<String, String> meta1 = new HashMap<>();
        final Map<String, String> meta2 = new HashMap<>();
        meta1.put("a", "1");
        meta2.put("b", "2");
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("metaadder", AddMetadata.class);
                component("extractor", MetadataExtractor.class);
                component("collector", ToCollection.class);
View Full Code Here

        Assert.assertNull(((Map) out.get(1)).get("a"));
    }

    @Test(timeOut = 1000)
    public void testMetadataCanBeHandled() {
        runNetworkDefinition(new NetworkDefiner() {
            {
                component("generator", IntegerGenerator.class);
                component("marker", MarkSubstream.class);
                component("gather", StringsFromSubstreams.class);
                component("collector", ToCollection.class);
View Full Code Here

TOP

Related Classes of javaflow.network.definer.NetworkDefiner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.