Examples of StreamDefinition


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

    mockMvc.perform(
        post("/streams/definitions").param("name", "mystream").param("definition", "time | log").param(
            "deploy", "true")
            .accept(MediaType.APPLICATION_JSON)).andExpect(status().isCreated());

    StreamDefinition definition = streamDefinitionRepository.findOne("mystream");
    assertNotNull(definition);
    assertNotNull(streamRepository.findOne("mystream"));

    mockMvc.perform(delete("/streams/deployments/mystream").accept(MediaType.APPLICATION_JSON)).andExpect(
        status().isOk());

    StreamDefinition undeployedDefinition = streamDefinitionRepository.findOne("mystream");
    assertNotNull(undeployedDefinition);
    assertNull(streamRepository.findOne("mystream"));

    mockMvc.perform(delete("/streams/definitions/mystream").accept(MediaType.APPLICATION_JSON)).andExpect(
        status().isOk());
View Full Code Here

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

    SingleNodeIntegrationTestSupport integrationSupport = new SingleNodeIntegrationTestSupport(application);

    String streamDefinition = String.format("queue:producer > %s > queue:consumer", dslDefinition);
    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("ping");
    String result = (String) sink.receivePayload(5000);
    assertEquals(expected, result);

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

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

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

    deploymentProps1.put("count", "1");
    Properties deploymentProps2 = new Properties();
    deploymentProps2.put("count", "2");
    Properties deploymentProps3 = new Properties();
    deploymentProps3.put("criteria", "groups.contains('hdfs')");
    Stream stream1 = new Stream(new StreamDefinition("s1", "http | log"));
    stream1.setStatus(new DeploymentUnitStatus(State.deployed));
    ModuleMetadata entity1 = new ModuleMetadata(new ModuleMetadata.Id("1", "s1.source.http.0"),
        entityProps1, deploymentProps1, State.deployed);
    Stream stream2 = new Stream(new StreamDefinition("s2", "http | log"));
    stream1.setStatus(new DeploymentUnitStatus(State.failed));

    ModuleMetadata entity2 = new ModuleMetadata(new ModuleMetadata.Id("2", "s2.sink.log.1"),
        entityProps2, deploymentProps2, DeploymentUnitStatus.State.deployed);
View Full Code Here

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

  }

  StreamNode parse(String streamDefinition) {
    StreamNode streamNode = getParser().parse(streamDefinition);
    if (streamNode.getStreamName() != null) {
      testRepository.save(new StreamDefinition(streamNode.getStreamName(), streamNode.getStreamData()));
    }
    return streamNode;
  }
View Full Code Here

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

    String sname = streamNode.getStreamName();
    if (sname == null) {
      sname = streamName;
    }
    if (sname != null) {
      testRepository.save(new StreamDefinition(sname, streamNode.getStreamData()));
    }
    return streamNode;
  }
View Full Code Here

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

      throw new IllegalStateException();
    }

    @Override
    public StreamDefinition findOne(String id) {
      StreamDefinition sd = data.get(id);
      if (debugRepository) {
        System.out.println(System.identityHashCode(this) + " repository findOne(" + id + ") returning " + sd);
      }
      return sd;
    }
View Full Code Here

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

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

  @Test
  public void simpleAdding() {
    StreamDefinition stream = new StreamDefinition("some", "http | hdfs");
    repository.save(stream);

    Assert.assertTrue(repository.exists("some"));
    Assert.assertEquals(1, repository.count());
    Assert.assertNotNull(repository.findOne("some"));
View Full Code Here

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

    Assert.assertFalse(iterator.hasNext());
  }

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

    Assert.assertTrue(repository.exists("one"));
    Assert.assertTrue(repository.exists("two"));
  }
View Full Code Here

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

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

  @Test
  public void multipleFinding() {
    StreamDefinition one = new StreamDefinition("one", "http | hdfs");
    repository.save(one);

    Iterator<StreamDefinition> iterator = repository.findAll(Arrays.asList("one", "notthere")).iterator();
    Assert.assertEquals(one, iterator.next());
    Assert.assertFalse(iterator.hasNext());
View Full Code Here

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

    Assert.assertFalse(iterator.hasNext());
  }

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

    repository.delete("one");
    Assert.assertFalse(repository.exists("one"));
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.