Package org.springframework.xd.module

Examples of org.springframework.xd.module.ModuleDefinition


  /**
   * Tests that when no delegate has a module, it is not found.
   */
  @Test
  public void testNotFound() {
    ModuleDefinition def = registry.findDefinition("foo", sink);
    assertNull(def);
  }
View Full Code Here


  private ModuleDefinitionService moduleDefinitionService;


  @Before
  public void setupSuccessfulModuleComposition() {
    ModuleDefinition any = Mockito.any();
    when(moduleRegistry.registerNew(any)).thenReturn(true);
  }
View Full Code Here

    ArrayList<ModuleDefinition> sinkDefinitions = new ArrayList<ModuleDefinition>();
    ArrayList<ModuleDefinition> sourceDefinitions = new ArrayList<ModuleDefinition>();

    for (int moduleCount = 0; moduleCount < 3; moduleCount++) {

      ModuleDefinition moduleDefinition = ModuleDefinitions.dummy("job_" + moduleCount, ModuleType.job);
      moduleDefinitions.add(moduleDefinition);
      jobDefinitions.add(moduleDefinition);

      moduleDefinition = ModuleDefinitions.dummy("source_" + moduleCount, ModuleType.source);
      moduleDefinitions.add(moduleDefinition);
      sourceDefinitions.add(moduleDefinition);

      moduleDefinition = ModuleDefinitions.dummy("sink_" + moduleCount, ModuleType.sink);
      moduleDefinitions.add(moduleDefinition);
      sinkDefinitions.add(moduleDefinition);

      moduleDefinition = ModuleDefinitions.dummy("processor_" + moduleCount, ModuleType.processor);
      moduleDefinitions.add(moduleDefinition);
      processorDefinitions.add(moduleDefinition);
    }

    final File file = temporaryFolder.newFile("job_4_with_resource.xml");
    FileUtils.writeStringToFile(file, "This is the contents of job_4_with_resource.xml");

    ModuleDefinition moduleDefinition = ModuleDefinitions.simple("job_4_with_resource", ModuleType.job, "file:" + file.getAbsolutePath());
    moduleDefinitions.add(moduleDefinition);
    jobDefinitions.add(moduleDefinition);

    for (int i = 0; i < 3; i++) {
      when(moduleRegistry.findDefinition("source_" + i, ModuleType.source)).thenReturn(sourceDefinitions.get(i));
View Full Code Here

  @Autowired
  private ModuleRegistry moduleRegistry;

  @Before
  public void before() {
    ModuleDefinition sinkDefinition = ModuleDefinitions.dummy("sink", ModuleType.sink);
    ModuleDefinition sourceDefinition = ModuleDefinitions.dummy("source", ModuleType.source);

    ArrayList<ModuleDefinition> definitions = new ArrayList<ModuleDefinition>();
    definitions.add(ModuleDefinitions.dummy("source", ModuleType.source));
    when(moduleRegistry.findDefinitions("source")).thenReturn(definitions);
    when(moduleRegistry.findDefinitions("time")).thenReturn(definitions);
View Full Code Here

    when(moduleMetadataRepository.findAll(pageable)).thenReturn(allPages);
    when(moduleMetadataRepository.findAll()).thenReturn(all);
    when(moduleMetadataRepository.findAllByContainerId(pageable, "2")).thenReturn(pageEntity2);
    when(moduleMetadataRepository.findOne("1", "s1.source.http.0")).thenReturn(entity1);
    when(moduleMetadataRepository.findAllByModuleId(pageable, "j3.job.myjob.0")).thenReturn(pageEntity3);
    ModuleDefinition sinkDefinition = ModuleDefinitions.dummy("sink", ModuleType.sink);
    ModuleDefinition sourceDefinition = ModuleDefinitions.dummy("source", ModuleType.source);
    ModuleDefinition jobDefinition = ModuleDefinitions.dummy("job", ModuleType.job);

    ArrayList<ModuleDefinition> definitions = new ArrayList<ModuleDefinition>();
    definitions.add(ModuleDefinitions.dummy("source", ModuleType.source));
    when(moduleRegistry.findDefinitions("source")).thenReturn(definitions);
    when(moduleRegistry.findDefinitions("http")).thenReturn(definitions);
View Full Code Here

  @Autowired
  private DistributedJobLocator jobLocator;

  @Before
  public void before() {
    ModuleDefinition moduleJobDefinition = ModuleDefinitions.dummy("job", ModuleType.job);
    ArrayList<ModuleDefinition> moduleDefinitions = new ArrayList<ModuleDefinition>();
    moduleDefinitions.add(moduleJobDefinition);
    when(moduleRegistry.findDefinitions("job")).thenReturn(moduleDefinitions);
    when(moduleRegistry.findDefinitions("job1")).thenReturn(moduleDefinitions);
    when(moduleRegistry.findDefinitions("job2")).thenReturn(moduleDefinitions);
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void testPojoOptionsConstruction() {
    String resource = "classpath:/DefaultModuleOptionsMetadataResolverTests-modules/source/module1/";
    ModuleDefinition definition = ModuleDefinitions.simple("module1", source, resource);
    ModuleOptionsMetadata metadata = metadataResolver.resolve(definition);
    assertThat(
        metadata,
        containsInAnyOrder(moduleOptionNamed("bar"), moduleOptionNamed("foo")));
View Full Code Here

  @Test
  @SuppressWarnings("unchecked")
  public void testMixin() {
    String resource =
        "classpath:/DefaultModuleOptionsMetadataResolverTests-modules/source/module2/";
    ModuleDefinition definition = ModuleDefinitions.simple("module2", source, resource);
    ModuleOptionsMetadata metadata = metadataResolver.resolve(definition);
    assertThat(
        metadata,
        containsInAnyOrder(moduleOptionNamed("bar"), moduleOptionNamed("fizz"), moduleOptionNamed("foo"),
            moduleOptionNamed("optionDefinedHere")));
View Full Code Here

  }

  @Test(expected = IllegalArgumentException.class)
  public void testMixinOverlap() {
    String resource = "classpath:/DefaultModuleOptionsMetadataResolverTests-modules/source/module3/";
    ModuleDefinition definition = ModuleDefinitions.simple("module3", source, resource);
    metadataResolver.resolve(definition);
  }
View Full Code Here

        ModuleOptionsReferenceDoc.class.getSimpleName());
  }

  private void generateAsciidoc(PrintStream out, String name, ModuleType type)
      throws IOException {
    ModuleDefinition def = moduleRegistry.findDefinition(name, type);
    ModuleOptionsMetadata moduleOptionsMetadata = moduleOptionsMetadataResolver.resolve(def);

    if (!moduleOptionsMetadata.iterator().hasNext()) {
      out.format("The **%s** %s has no particular option (in addition to options shared by all modules)%n%n",
          pt(def.getName()), pt(def.getType()));
      return;
    }

    out.format("The **%s** %s has the following options:%n%n", pt(def.getName()), pt(def.getType()));
    List<ModuleOption> options = new ArrayList<ModuleOption>();
    for (ModuleOption mo : moduleOptionsMetadata) {
      options.add(mo);
    }
    Collections.sort(options, new Comparator<ModuleOption>() {
View Full Code Here

TOP

Related Classes of org.springframework.xd.module.ModuleDefinition

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.