Package org.springframework.xd.dirt.rest

Examples of org.springframework.xd.dirt.rest.ModulesController


    deployStream("aCompositeStream", "compositesource | sink");
    ModuleDefinitionService moduleDefinitionService = getAdminContext().getBean(
        ModuleDefinitionService.class);
    // Not actually used in test so ok for now
    DetailedModuleDefinitionResourceAssembler assembler = mock(DetailedModuleDefinitionResourceAssembler.class);
    ModulesController modulesController = new ModulesController(moduleDefinitionService, assembler);
    try {
      modulesController.delete(ModuleType.source, "compositeModuleThatDoesNotExist");
      fail("Exception should be thrown when trying to delete a composite module that does not exist.");
    }
    catch (NoSuchModuleException e) {
      assertEquals("Could not find module with name 'compositeModuleThatDoesNotExist' and type 'source'",
          e.getMessage());
    }
    try {
      // source:file is a valid module, that is not used by a composite
      modulesController.delete(ModuleType.source, "file");
      fail("Exception should be thrown when trying to delete a non-deletable (because non-composite) module.");
    }
    catch (IllegalArgumentException e) {
      assertEquals("Could not delete module 'source:file'", e.getMessage());
    }
    assertDeleteFailsWhenPartOfStreamDef(modulesController);
    undeployStream("aCompositeStream");
    // Delete will still fail after undeploying the stream
    assertDeleteFailsWhenPartOfStreamDef(modulesController);
    // Delete the stream defintion
    deleteStream("aCompositeStream");
    // Now delete the composite module
    modulesController.delete(ModuleType.source, "compositesource");
    // Assert that it was deleted
    assertNull(getModuleRegistry().findDefinition("compositesource", ModuleType.source));
  }
View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.rest.ModulesController

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.