Examples of StreamDefinition


Examples of org.springframework.xd.dirt.stream.StreamDefinition

    Assert.assertFalse(repository.exists("two"));
  }

  @Test
  public void deleteMultiple() {
    StreamDefinition one = new StreamDefinition("one", "http | hdfs");
    StreamDefinition two = new StreamDefinition("two", "tcp | file");
    StreamDefinition three = new StreamDefinition("three", "http | file");
    repository.save(Arrays.asList(one, two, three));

    repository.delete(Arrays.asList(one));
    Assert.assertFalse(repository.exists("one"));
    Assert.assertTrue(repository.exists("two"));
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    Assert.assertEquals(0, repository.count());
  }

  @Test
  public void override() {
    StreamDefinition one = new StreamDefinition("one", "http | hdfs");
    repository.save(one);
    Assert.assertEquals("http | hdfs", repository.findOne("one").getDefinition());

    StreamDefinition otherone = new StreamDefinition("one", "time | file");
    repository.save(otherone);
    Assert.assertEquals(1, repository.count());
    Assert.assertEquals("time | file", repository.findOne("one").getDefinition());
  }
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    assertEquals(0, repository.count());
  }

  @Test
  public void testSave() {
    StreamDefinition streamDefinition = new StreamDefinition("test", "time | log");
    repository.save(streamDefinition);
    StreamDefinition saved = repository.findOne("test");
    assertEquals(streamDefinition.getName(), saved.getName());
    assertEquals(streamDefinition.getDefinition(), saved.getDefinition());
  }
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    assertEquals(streamDefinition.getDefinition(), saved.getDefinition());
  }

  @Test
  public void testFindAll() {
    repository.save(new StreamDefinition("test1", "time | log"));
    repository.save(new StreamDefinition("test2", "time | log"));
    repository.save(new StreamDefinition("test3", "time | log"));
    int i = 0;
    for (Iterator<StreamDefinition> it = repository.findAll().iterator(); it.hasNext();) {
      it.next();
      i++;
    }
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    assertTrue(!repository.exists("test4"));
  }

  @Test
  public void testDelete() {
    StreamDefinition streamDefinition = new StreamDefinition("test", "time | log");
    repository.save(streamDefinition);
    StreamDefinition saved = repository.findOne("test");
    repository.delete(saved);
    assertNull(repository.findOne("test"));
  }
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    assertNull(repository.findOne("test"));
  }

  @Test
  public void sorting() {
    StreamDefinition one = new StreamDefinition("one", "http | hdfs");
    StreamDefinition two = new StreamDefinition("two", "tcp | file");
    StreamDefinition three = new StreamDefinition("three", "http | file");
    StreamDefinition four = new StreamDefinition("four", "http | file");
    StreamDefinition five = new StreamDefinition("five", "http | file");
    repository.save(Arrays.asList(one, two, three, four, five));

    Assert.assertEquals(5, repository.count());

    PageRequest pageable = new PageRequest(1, 2);
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

  public void testProcessingChain() {
    String processingChainUnderTest = "transform --expression='payload.toUpperCase()' | filter --expression='payload.length() > 4'";
    String streamDefinition = "queue:producer >" + processingChainUnderTest + "> queue:consumer";
    String streamName = "test";

    StreamDefinition testStream = new StreamDefinition(streamName, streamDefinition);
    integrationSupport.createAndDeployStream(testStream);

    MessageBus messageBus = integrationSupport.messageBus();

    NamedChannelSource source = new SingleNodeNamedChannelSourceFactory(messageBus).createNamedChannelSource("queue:producer");
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(messageBus).createNamedChannelSink("queue:consumer");

    source.sendPayload("hello");
    String result = (String) sink.receivePayload(RECEIVE_TIMEOUT);
    assertEquals("HELLO", result);

    source.sendPayload("a");
    result = (String) sink.receivePayload(RECEIVE_TIMEOUT);
    assertNull(result);

    source.unbind();
    sink.unbind();

    assertTrue("stream " + testStream.getName() + "not undeployed",
        integrationSupport.undeployAndDestroyStream(testStream));
  }
View Full Code Here

Examples of org.springframework.xd.dirt.stream.StreamDefinition

    String processingChainUnderTest = "transform --expression='T(org.joda.time.format.DateTimeFormat).forPattern(\"yyyy-MM-dd HH:mm:ss\").parseDateTime(payload)' | log";

    SingleNodeProcessingChainProducer chain = chainProducer(application, "dateToDateTime", processingChainUnderTest);

    StreamDefinition tap = new StreamDefinition("testtap", "tap:stream:dateToDateTime.0 > queue:tap");
    integrationSupport.createAndDeployStream(tap);
    NamedChannelSink sink = new SingleNodeNamedChannelSinkFactory(integrationSupport.messageBus()).createNamedChannelSink("queue:tap");

    chain.sendPayload(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
View Full Code Here

Examples of org.wso2.carbon.databridge.commons.StreamDefinition

    private static void release(){
        FasterLookUpDataHolder.getInstance().setPublisherRunning(false);
    }
   
    private static StreamDefinition initializeStream() throws Exception {
        streamDefinition = new StreamDefinition(
                CloudControllerConstants.CLOUD_CONTROLLER_EVENT_STREAM,
                cloudControllerEventStreamVersion);
        streamDefinition.setNickName("cloud.controller");
        streamDefinition.setDescription("Instances booted up by the Cloud Controller");
        // Payload definition
View Full Code Here

Examples of org.wso2.carbon.databridge.commons.StreamDefinition

    private static final String DATA_STREAM_NAME = "in_flight_requests";
    private static final String VERSION = "1.0.0";

    private static StreamDefinition createStreamDefinition() {
        try {
            StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
            streamDefinition.setNickName("lb stats");
            streamDefinition.setDescription("lb stats");
            List<Attribute> payloadData = new ArrayList<Attribute>();
            // Payload definition
            payloadData.add(new Attribute("cluster_id", AttributeType.STRING));
            payloadData.add(new Attribute("network_partition_id", AttributeType.STRING));
            payloadData.add(new Attribute("in_flight_request_count", AttributeType.DOUBLE));
            streamDefinition.setPayloadData(payloadData);
            return streamDefinition;
        } catch (Exception e) {
            throw new RuntimeException("Could not create stream definition", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.