Beispiel #1
0
  @Override
  public Resource<?> build(PrintStream out, PrintStream err) throws BuildException {
    List<String> selected = new ArrayList<>();

    if ((args != null) && (!args.isEmpty())) {
      selected.addAll(args);
    } else {
      selected.add("clean");
      selected.add("install");
    }

    if (Network.isOffline(environment)) {
      selected.add("--offline");
    }

    if (!runTests) {
      selected.add("-DskipTests=true");
      selected.add("-Dmaven.test.skip=true");
    }
    if (quiet) {
      selected.add("-q");
    }
    boolean success = project.getFacet(MavenFacet.class).executeMavenEmbedded(selected, out, err);

    if (success) {
      return project.getFacet(PackagingFacet.class).getFinalArtifact();
    } else {
      throw new BuildException("Build failed.");
    }
  }
  @Override
  public Result execute(UIExecutionContext context) {
    Project project = getSelectedProject(context.getUIContext());
    final DependencyFacet deps = project.getFacet(DependencyFacet.class);

    if (arguments.hasValue()) {
      int count = 0;
      for (Dependency gav : arguments.getValue()) {
        Dependency existingDep =
            deps.getEffectiveManagedDependency(DependencyBuilder.create(gav).setVersion(null));
        if (existingDep != null) {
          if (context
              .getPrompt()
              .promptBoolean(
                  String.format(
                      "Dependency [%s:%s] is currently managed. "
                          + "Reference the existing managed dependency [%s:%s:%s]?",
                      gav.getCoordinate().getArtifactId(),
                      gav.getCoordinate().getGroupId(),
                      existingDep.getCoordinate().getGroupId(),
                      existingDep.getCoordinate().getArtifactId(),
                      existingDep.getCoordinate().getVersion()))) {
            gav = DependencyBuilder.create(existingDep).setScopeType(gav.getScopeType());
          }
        }

        this.installer.install(project, gav);
        count++;
      }

      return Results.success(
          "Installed [" + count + "] dependenc" + (count == 1 ? "y" : "ies") + ".");
    }
    return Results.fail("No arguments specified.");
  }
  public static void main(String[] args) throws Exception {
    Furnace furnace = startFurnace();
    try {
      AddonRegistry addonRegistry = furnace.getAddonRegistry();
      ProjectFactory projectFactory = addonRegistry.getServices(ProjectFactory.class).get();
      ResourceFactory resourceFactory = addonRegistry.getServices(ResourceFactory.class).get();

      // Create a temporary directory as an example
      File underlyingResource = OperatingSystemUtils.getTempDirectory();

      Resource<File> projectDir = resourceFactory.create(underlyingResource);

      // This could return more than one provider, but since the maven addon is the only one
      // deployed, this is ok
      ProjectProvider projectProvider = addonRegistry.getServices(ProjectProvider.class).get();

      // Creating WAR project
      JavaWebProjectType javaWebProjectType =
          addonRegistry.getServices(JavaWebProjectType.class).get();
      Project project =
          projectFactory.createProject(
              projectDir, projectProvider, javaWebProjectType.getRequiredFacets());

      // Changing metadata
      MetadataFacet facet = project.getFacet(MetadataFacet.class);
      facet.setProjectName("my-demo-project");
      facet.setProjectVersion("1.0.0-SNAPSHOT");
      facet.setTopLevelPackage("com.mycompany.project");

      System.out.println("### Project Created in: " + project);
    } finally {
      furnace.stop();
    }
  }
 @Override
 public Result execute(UIExecutionContext context) throws Exception {
   UIContext uiContext = context.getUIContext();
   Project project = (Project) uiContext.getAttributeMap().get(Project.class);
   String coordinate =
       archetypeGroupId.getValue()
           + ":"
           + archetypeArtifactId.getValue()
           + ":"
           + archetypeVersion.getValue();
   DependencyQueryBuilder depQuery = DependencyQueryBuilder.create(coordinate);
   String repository = archetypeRepository.getValue();
   if (repository != null) {
     depQuery.setRepositories(new DependencyRepository("archetype", repository));
   }
   DependencyResolver resolver =
       SimpleContainer.getServices(getClass().getClassLoader(), DependencyResolver.class).get();
   Dependency resolvedArtifact = resolver.resolveArtifact(depQuery);
   FileResource<?> artifact = resolvedArtifact.getArtifact();
   MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
   File fileRoot = project.getRoot().reify(DirectoryResource.class).getUnderlyingResourceObject();
   ArchetypeHelper archetypeHelper =
       new ArchetypeHelper(
           artifact.getResourceInputStream(),
           fileRoot,
           metadataFacet.getProjectGroupName(),
           metadataFacet.getProjectName(),
           metadataFacet.getProjectVersion());
   JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
   archetypeHelper.setPackageName(facet.getBasePackage());
   archetypeHelper.execute();
   return Results.success();
 }
  @Test
  public void testAddDependencyWithDifferentScopeThenManaged() throws Exception {
    Project project = factory.createTempProject(build);
    try {
      installer.installManaged(project, DEPENDENCY);

      Assert.assertFalse(project.getFacet(DependencyFacet.class).hasDirectDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasDirectManagedDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasEffectiveManagedDependency(DEPENDENCY));

      try (CommandController command =
          testHarness.createCommandController(AddDependenciesCommand.class, project.getRoot())) {
        command.initialize();
        command.setValueFor("arguments", COORDINATES + ":test");
        command.execute();
      }
      Assert.assertTrue(project.getFacet(DependencyFacet.class).hasDirectDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasDirectManagedDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasEffectiveManagedDependency(DEPENDENCY));

      Dependency dependency =
          project
              .getFacet(DependencyFacet.class)
              .getDirectDependency(DependencyBuilder.create(COORDINATES));
      Assert.assertEquals("test", dependency.getScopeType());
    } finally {
      project.getRoot().delete(true);
    }
  }
Beispiel #6
0
  @Before
  public void setup() throws Exception {
    AddonRegistry addonRegistry =
        SimpleContainer.getFurnace(getClass().getClassLoader()).getAddonRegistry();
    this.projectFactory = addonRegistry.getServices(ProjectFactory.class).get();
    this.testHarness = addonRegistry.getServices(UITestHarness.class).get();
    project = projectFactory.createTempProject();
    CommandController gitSetupCommandTester =
        testHarness.createCommandController(GitSetupCommand.class, project.getRoot());
    gitSetupCommandTester.initialize();
    gitSetupCommandTester.execute();

    CommandController gitIgnoreSetupTester =
        testHarness.createCommandController(GitIgnoreSetupCommand.class, project.getRoot());
    gitIgnoreSetupTester.initialize();
    gitIgnoreSetupTester.setValueFor("templateRepoDir", getCloneDir());
    gitIgnoreSetupTester.execute();

    Resource<?> cloneDir = getCloneDir();
    boolean templateFound = false;
    for (Resource<?> resource : cloneDir.listResources()) {
      if (resource.getName().endsWith(".gitignore")) {
        templateFound = true;
        break;
      }
    }
    assertTrue(templateFound);
  }
  @Test
  public void testCreateEnum() throws Exception {
    Project project = projectFactory.createTempProject();
    facetFactory.install(project, JavaSourceFacet.class);
    JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
    JavaEnumSource javaEnum =
        Roaster.parse(
            JavaEnumSource.class, "package org.jboss.forge.test; public enum CreditCardType{}");
    facet.saveJavaSource(javaEnum);

    JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.CreditCardType");
    Assert.assertNotNull(javaResource);
    Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaEnum.class)));

    CommandController controller =
        testHarness.createCommandController(JavaAddEnumConstantCommand.class, javaResource);
    controller.initialize();
    controller.setValueFor("named", "VISA");
    Assert.assertTrue(controller.isValid());
    Assert.assertTrue(controller.canExecute());
    Result result = controller.execute();
    Assert.assertThat(result, is(not(instanceOf(Failed.class))));

    javaResource = facet.getJavaResource("org.jboss.forge.test.CreditCardType");
    JavaEnumSource enumClass = javaResource.getJavaType();
    List<EnumConstantSource> enumConstants = enumClass.getEnumConstants();
    Assert.assertEquals(1, enumConstants.size());

    Assert.assertEquals("VISA", enumConstants.get(0).getName());
  }
Beispiel #8
0
  public void process() {

    File reportDirectory = new File("target/test/dummy/output");

    try {
      switchyardForgeRegistrar = new SwitchyardForgeRegistrar(reportDirectory);

      if (switchyardForgeRegistrar.createProject("myProject") != null) {

        Project project = switchyardForgeRegistrar.getProject();
        if (project == null) {
          LOG.warn("No project found ");
        } else {

          MetadataFacet mdf = project.getFacet(MetadataFacet.class);
          mdf.setProjectName(project.getProjectRoot().getName());

          FacetFactory facetFactory = switchyardForgeRegistrar.getFacetFactory();
          switchYardFacet = facetFactory.install(project, SwitchYardFacet.class);
          SwitchYardFacet syf = project.getFacet(SwitchYardFacet.class);
        }
      }

    } catch (Throwable e) {
      e.printStackTrace();
    } finally {
      switchyardForgeRegistrar.stop();
      LOG.info("Furnace stopped.");
    }
  }
Beispiel #9
0
 @Test
 public void testCreateTempProjectWithFacets() {
   Project project =
       projectFactory.createTempProject(
           Arrays.<Class<? extends ProjectFacet>>asList(WebResourcesFacet.class));
   Assert.assertNotNull(project);
   Assert.assertTrue(project.hasFacet(WebResourcesFacet.class));
 }
Beispiel #10
0
 public JavaResource createEmptyEnum(Project project, String enumName) throws IOException {
   JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);
   JavaEnumSource enumSource = Roaster.create(JavaEnumSource.class).setName(enumName);
   String packageName =
       project.getFacet(JavaSourceFacet.class).getBasePackage() + "." + DEFAULT_ENTITY_PACKAGE;
   enumSource.setPackage(packageName);
   return javaSourceFacet.saveJavaSource(enumSource);
 }
 private void setCurrentWorkingResource(UIExecutionContext context, JavaClassSource javaClass)
     throws FileNotFoundException {
   Project selectedProject = getSelectedProject(context);
   if (selectedProject != null) {
     JavaSourceFacet facet = selectedProject.getFacet(JavaSourceFacet.class);
     facet.saveJavaSource(javaClass);
   }
   context.getUIContext().setSelection(javaClass);
 }
Beispiel #12
0
 @Test
 public void testConfigListInProject() throws Exception {
   Project project = projectFactory.createTempProject();
   Configuration projectConfig = project.getFacet(ConfigurationFacet.class).getConfiguration();
   addPropsToProjectConfig(projectConfig);
   test.getShell().setCurrentResource(project.getRoot());
   test.execute("config-list", 15, TimeUnit.SECONDS);
   assertThat(test.getStdOut(), containsString("key2=project: [projectValue2]"));
   assertThat(test.getStdOut(), containsString("key3=project: [projectValue3]"));
 }
Beispiel #13
0
 @Test
 public void testConfigSetPropertyListInProject() throws Exception {
   Project project = projectFactory.createTempProject();
   test.getShell().setCurrentResource(project.getRoot());
   test.execute("config-set --key key2 --value projectValue2 --local", 15, TimeUnit.SECONDS);
   test.execute("config-set --key key3 --value projectValue3 --local", 15, TimeUnit.SECONDS);
   assertFalse(test.execute("config-list", 15, TimeUnit.SECONDS) instanceof Failed);
   assertThat(test.getStdOut(), containsString("key2=project: [projectValue2]"));
   assertThat(test.getStdOut(), containsString("key3=project: [projectValue3]"));
 }
  @Test
  @Ignore("FORGE-894")
  public void testDependencyResolution() throws FileNotFoundException, FacetNotFoundException {
    Project project = projectFactory.createTempProject();
    project.getRoot().reify(DirectoryResource.class).deleteOnExit();

    MetadataFacet metadataFacet = project.getFacet(MetadataFacet.class);
    metadataFacet.setProjectName("testproject");
    metadataFacet.setProjectVersion("1.0.0-SNAPSHOT");
    metadataFacet.setProjectGroupName("com.acme.testproject");

    configurator.setupComplexAddonProject(project, Collections.<AddonId>emptyList());

    Resource<?> projectRoot = project.getRoot();

    Assert.assertTrue("SPI module is missing", projectRoot.getChild("spi").exists());
    Assert.assertTrue("TESTS module is missing", projectRoot.getChild("tests").exists());

    Project spiProject = projectFactory.findProject(projectRoot.getChild("spi"));
    Project testsProject = projectFactory.findProject(projectRoot.getChild("tests"));

    Dependency spiDependency =
        DependencyBuilder.create(spiProject.getFacet(MetadataFacet.class).getOutputDependency())
            .setClassifier(FORGE_ADDON_CLASSIFIER);
    Assert.assertNotNull(
        "SPI module is not present in the TESTS module",
        testsProject.getFacet(DependencyFacet.class).getEffectiveDependency(spiDependency));
    Assert.assertEquals(
        "compile",
        testsProject
            .getFacet(DependencyFacet.class)
            .getEffectiveDependency(spiDependency)
            .getScopeType());
  }
  @Test
  public void testHasManagedDependencyReturnFailureOnSomeFound() throws Exception {
    Project project = factory.createTempProject(build);
    try {
      installer.installManaged(project, DEPENDENCY);

      Assert.assertFalse(project.getFacet(DependencyFacet.class).hasDirectDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasDirectManagedDependency(DEPENDENCY));
      Assert.assertTrue(
          project.getFacet(DependencyFacet.class).hasEffectiveManagedDependency(DEPENDENCY));
      Assert.assertFalse(project.getFacet(DependencyFacet.class).hasDirectDependency(DEPENDENCY2));
      Assert.assertFalse(
          project.getFacet(DependencyFacet.class).hasDirectManagedDependency(DEPENDENCY2));
      Assert.assertFalse(
          project.getFacet(DependencyFacet.class).hasEffectiveManagedDependency(DEPENDENCY2));

      try (CommandController command =
          testHarness.createCommandController(
              HasManagedDependenciesCommand.class, project.getRoot())) {
        command.initialize();
        command.setValueFor("arguments", Arrays.asList(COORDINATES, COORDINATES2));
        Result result = command.execute();
        Assert.assertTrue(result instanceof Failed);
      }
    } finally {
      project.getRoot().delete(true);
    }
  }
 @Override
 public NavigationResult getPrerequisiteCommands(UIContext context) {
   NavigationResultBuilder builder = NavigationResultBuilder.create();
   Project project = getSelectedProject(context);
   if (project != null) {
     if (!project.hasFacet(RestFacet.class)) {
       builder.add(RestSetupWizard.class);
     }
   }
   return builder.build();
 }
Beispiel #17
0
  @Test
  public void testCatCommand() throws Exception {
    Project project = projectFactory.createTempProject();
    File target = new File(project.getRoot().getFullyQualifiedName(), "test.java");
    target.createNewFile();

    FileResource<?> source = project.getRoot().getChild(target.getName()).reify(FileResource.class);
    source.setContents("public void test() {}");

    shellTest.execute("cat " + source.getFullyQualifiedName(), 5, TimeUnit.SECONDS);
    Assert.assertThat(shellTest.getStdOut(), CoreMatchers.containsString("test()"));
  }
Beispiel #18
0
  @Test
  public void testContainsProject() {
    Project project = projectFactory.createTempProject();
    Assert.assertNotNull(project);
    Resource<?> projectRoot = project.getRoot();
    Assert.assertTrue(projectFactory.containsProject(projectRoot, projectRoot));
    Assert.assertTrue(projectFactory.containsProject(projectRoot, projectRoot.getChild("src")));

    projectRoot.delete(true);

    Assert.assertFalse(projectFactory.containsProject(projectRoot, projectRoot));
  }
Beispiel #19
0
  @Test
  public void testGitSetupCalledTwice() throws Exception {
    commandController.execute();
    assertTrue(
        project.getRoot().reify(DirectoryResource.class).getChildDirectory(".git").isDirectory());

    commandController.initialize();
    Result result = commandController.execute();
    assertTrue(
        project.getRoot().reify(DirectoryResource.class).getChildDirectory(".git").isDirectory());
    assertEquals("GIT has been installed.", result.getMessage());
  }
Beispiel #20
0
 @Test
 public void testCreateTempProjectWithBuildSystemAndFacets() {
   ProjectProvider buildSystem = buildSystems.get();
   try {
     Project project =
         projectFactory.createTempProject(
             buildSystem, Arrays.<Class<? extends ProjectFacet>>asList(WebResourcesFacet.class));
     Assert.assertNotNull(project);
     Assert.assertTrue(project.hasFacet(WebResourcesFacet.class));
   } finally {
     buildSystems.release(buildSystem);
   }
 }
Beispiel #21
0
  @Test
  public void testCatColoredCommand() throws Exception {
    Project project = projectFactory.createTempProject();
    File target = new File(project.getRoot().getFullyQualifiedName(), "test.java");
    target.createNewFile();

    FileResource<?> source = project.getRoot().getChild(target.getName()).reify(FileResource.class);
    source.setContents("public void test() {}");

    shellTest.execute("cat " + source.getFullyQualifiedName() + " --color", 5, TimeUnit.SECONDS);
    // the string should be colors, so there are color codes between the statements
    Assert.assertThat(
        shellTest.getStdOut(), CoreMatchers.not(CoreMatchers.containsString("public void")));
  }
  @Test
  public void checkCommandShell() throws Exception {
    shellTest.getShell().setCurrentResource(project.getRoot());
    shellTest.execute(
        "cdi-new-bean --named DummyBean --target-package org.test", 10, TimeUnit.SECONDS);
    Result result =
        shellTest.execute(
            "cdi-add-observer-method --named dummy --event-type java.lang.String --target-class org.test.DummyBean",
            10,
            TimeUnit.SECONDS);

    Assert.assertThat(result, not(instanceOf(Failed.class)));
    Assert.assertTrue(project.hasFacet(CDIFacet.class));
  }
  @Override
  public Result execute(UIExecutionContext context) {
    final Result result;
    Project project = getSelectedProject(context.getUIContext());
    DependencyFacet deps = project.getFacet(DependencyFacet.class);

    String urlValue = url.getValue();
    DependencyRepository rep = deps.removeRepository(urlValue);
    if (rep != null) {
      result = Results.success("Removed repository [" + rep.getId() + "->" + rep.getUrl() + "]");
    } else {
      result = Results.fail("No repository with url [" + urlValue + "]");
    }
    return result;
  }
  @Test
  public void testCreateNewObserverMethodWithQualifiers() throws Exception {
    try (CommandController controller =
        uiTestHarness.createCommandController(CDINewBeanCommand.class, project.getRoot())) {
      controller.initialize();
      controller.setValueFor("named", "MyBean");
      controller.setValueFor("targetPackage", "org.jboss.forge.test.bean");
      assertTrue(controller.isValid());
      assertTrue(controller.canExecute());
      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));
    }

    try (CommandController controller =
        uiTestHarness.createCommandController(
            CDIAddObserverMethodCommand.class, project.getRoot())) {
      controller.initialize();
      controller.setValueFor("named", "observe");
      controller.setValueFor("targetClass", "org.jboss.forge.test.bean.MyBean");
      controller.setValueFor("eventType", "java.lang.String");
      controller.setValueFor(
          "qualifiers",
          Arrays.asList("javax.enterprise.inject.Default", "javax.enterprise.inject.Any"));
      assertTrue(controller.isValid());
      assertTrue(controller.canExecute());
      Result result = controller.execute();
      Assert.assertThat(result, is(not(instanceOf(Failed.class))));
    }

    JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
    JavaResource javaResource = facet.getJavaResource("org.jboss.forge.test.bean.MyBean");
    Assert.assertNotNull(javaResource);
    Assert.assertThat(javaResource.getJavaType(), is(instanceOf(JavaClass.class)));
    JavaClass<?> myBean = javaResource.getJavaType();
    Assert.assertEquals(1, myBean.getMethods().size());
    Assert.assertEquals(0, myBean.getInterfaces().size());
    Method<?, ?> method = myBean.getMethods().get(0);
    Assert.assertEquals("observe", method.getName());
    Assert.assertEquals(1, method.getParameters().size());
    Parameter<?> parameter = method.getParameters().get(0);
    Assert.assertTrue(parameter.hasAnnotation(Observes.class));
    Assert.assertEquals("java.lang.String", parameter.getType().getQualifiedName());
    Assert.assertEquals("event", parameter.getName());
    Assert.assertEquals(3, parameter.getAnnotations().size());
    Assert.assertTrue(parameter.hasAnnotation(Observes.class));
    Assert.assertTrue(parameter.hasAnnotation(Default.class));
    Assert.assertTrue(parameter.hasAnnotation(Any.class));
  }
Beispiel #25
0
 private void executeGitIgnoreCreate() throws Exception {
   CommandController gitIgnoreCreateTester =
       testHarness.createCommandController(GitIgnoreCreateCommand.class, project.getRoot());
   gitIgnoreCreateTester.initialize();
   gitIgnoreCreateTester.setValueFor("templates", "Eclipse Maven");
   gitIgnoreCreateTester.execute();
 }
Beispiel #26
0
 @Before
 public void setup() throws Exception {
   project = projectFactory.createTempProject();
   commandController =
       testHarness.createCommandController(GitSetupCommand.class, project.getRoot());
   commandController.initialize();
 }
Beispiel #27
0
 @Test
 public void testGitIgnoreUpdateRepo() throws Exception {
   CommandController gitIgnoreUpdateRepoTester =
       testHarness.createCommandController(GitIgnoreUpdateRepoCommand.class, project.getRoot());
   gitIgnoreUpdateRepoTester.initialize();
   Result result = gitIgnoreUpdateRepoTester.execute();
   assertTrue(result.getMessage().contains("Local gitignore repository updated"));
 }
Beispiel #28
0
  @Test
  public void testContainsProjectWithBuildSystem() {
    ProjectProvider buildSystem = buildSystems.get();
    try {
      Project project = projectFactory.createTempProject(buildSystem);
      Assert.assertNotNull(project);
      Resource<?> projectRoot = project.getRoot();
      Assert.assertTrue(projectFactory.containsProject(projectRoot, projectRoot, buildSystem));
      Assert.assertTrue(
          projectFactory.containsProject(projectRoot, projectRoot.getChild("src"), buildSystem));

      projectRoot.delete(true);
      Assert.assertFalse(projectFactory.containsProject(projectRoot, projectRoot, buildSystem));
    } finally {
      buildSystems.release(buildSystem);
    }
  }
  @SuppressWarnings("unchecked")
  @Test
  public void checkCommandShell() throws Exception {
    shellTest.getShell().setCurrentResource(project.getRoot());
    Result result =
        shellTest.execute(
            ("jpa-new-entity --named Customer --target-package org.lincoln --id-strategy AUTO --table-name CUSTOMER_TABLE"),
            10,
            TimeUnit.SECONDS);

    Assert.assertThat(result, not(instanceOf(Failed.class)));
    Assert.assertTrue(project.hasFacet(JPAFacet.class));
    List<JavaClass<?>> allEntities = project.getFacet(JPAFacet.class).getAllEntities();
    Assert.assertEquals(1, allEntities.size());
    JavaClass<?> customerEntity = allEntities.get(0);
    Assert.assertTrue(customerEntity.hasAnnotation(Table.class));
    Assert.assertEquals(
        "CUSTOMER_TABLE", customerEntity.getAnnotation(Table.class).getStringValue("name"));
  }
  @Override
  public void initializeUI(UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    UIContext context = builder.getUIContext();
    Project project = getSelectedProject(context);
    JavaSourceFacet javaSourceFacet = project.getFacet(JavaSourceFacet.class);

    final List<JavaResource> entities = persistenceOperations.getProjectEntities(project);
    forEntity.setValueChoices(entities);
    setDefaultTargetEntity(context.<FileResource<?>>getInitialSelection(), entities);

    getTargetPackage().setDescription("Repository package name");
    getTargetPackage()
        .setDefaultValue(javaSourceFacet.getBasePackage() + DEFAULT_REPOSITORY_PACKAGE);

    repositoryType.setDefaultValue(SpringBootRepositoryType.PAGING_AND_SORTING);

    builder.add(forEntity);
    builder.add(repositoryType);
  }