@Test public void testUndeploySucceeds() { TapDefinition tapDefinition = new TapDefinition("tap1", "test", "tap @test | file"); repository.save(tapDefinition); final AtomicInteger deployCount = new AtomicInteger(); final AtomicInteger undeployCount = new AtomicInteger(); deployChannel.subscribe( new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { deployCount.getAndIncrement(); } }); undeployChannel.subscribe( new MessageHandler() { @Override public void handleMessage(Message<?> message) throws MessagingException { undeployCount.getAndIncrement(); } }); tapDeployer.deploy("tap1"); tapDeployer.undeploy("tap1"); assertEquals(2, deployCount.get()); assertEquals(2, undeployCount.get()); }
@Test public void testCreateSucceeds() { TapDefinition tapDefinition = new TapDefinition("tap1", "test", "tap @test | file"); streamDefinitionRepository.save(new StreamDefinition("test", "time | log")); tapDeployer.save(tapDefinition); assertTrue(repository.exists("tap1")); }
@Test(expected = NoSuchDefinitionException.class) public void testCreateFailsIfSourceStreamDoesNotExist() { TapDefinition tapDefinition = new TapDefinition("tap1", "test", "tap @test | file"); tapDeployer.save(tapDefinition); }
@Test(expected = NoSuchDefinitionException.class) public void testDeployFailsForMissingDefinition() { tapDeployer.deploy("tap1"); }