@Override
 public void initializeUI(UIBuilder builder) throws Exception {
   InputComponentFactory inputFactory = builder.getInputComponentFactory();
   archetypeGroupId =
       inputFactory
           .createInput("archetypeGroupId", String.class)
           .setLabel("Archetype Group Id")
           .setRequired(true);
   archetypeArtifactId =
       inputFactory
           .createInput("archetypeArtifactId", String.class)
           .setLabel("Archetype Artifact Id")
           .setRequired(true);
   archetypeVersion =
       inputFactory
           .createInput("archetypeVersion", String.class)
           .setLabel("Archetype Version")
           .setRequired(true);
   archetypeRepository =
       inputFactory
           .createInput("archetypeRepository", String.class)
           .setLabel("Archetype repository URL")
           .setRequired(true);
   builder
       .add(archetypeGroupId)
       .add(archetypeArtifactId)
       .add(archetypeVersion)
       .add(archetypeRepository);
 }
 @Test
 public void testCreateUISelectMany() throws Exception {
   UISelectMany<String> input = factory.createSelectMany("foo", String.class);
   Assert.assertNotNull(input);
   Assert.assertTrue(input.hasFacet(HintsFacet.class));
   Assert.assertEquals(InputComponents.DEFAULT_SHORT_NAME, input.getShortName());
 }
 @Test
 public void testCreateUIInputManyWithShortName() throws Exception {
   UIInputMany<String> input = factory.createInputMany("foo", 'f', String.class);
   Assert.assertNotNull(input);
   Assert.assertTrue(input.hasFacet(HintsFacet.class));
   Assert.assertEquals('f', input.getShortName());
 }
 @Test
 public void testCreateUISelectOneDefaultValue() throws Exception {
   UISelectOne<String> input = factory.createSelectOne("foo", 'f', String.class);
   Assert.assertNotNull(input);
   input.setDefaultValue((String) null);
   Assert.assertFalse(input.hasDefaultValue());
 }
 @Test
 public void testCreateUIInputManyDefaultValue() throws Exception {
   UIInputMany<String> input = factory.createInputMany("foo", 'f', String.class);
   Assert.assertNotNull(input);
   input.setDefaultValue((Iterable<String>) null);
   Assert.assertFalse(input.hasDefaultValue());
 }
Example #6
0
 @Override
 public void initializeUI(UIBuilder builder) throws Exception {
   InputComponentFactory factory = builder.getInputComponentFactory();
   named =
       factory
           .createInput("named", String.class)
           .setLabel("Archetype catalog Name")
           .setDescription("The archetype catalog name to be used")
           .setRequired(true);
   url =
       factory
           .createInput("url", URLResource.class)
           .setLabel("Archetype catalog URL")
           .setDescription("The archetype catalog URL to be used")
           .setRequired(true);
   builder.add(named).add(url);
 }
 @Test
 public void testCreateUIInputBooleanDefaultValueIsFalse() throws Exception {
   UIInput<Boolean> input = factory.createInput("foo", Boolean.class);
   Assert.assertNotNull(input);
   Assert.assertEquals(false, input.getValue());
 }
 @Test(expected = IllegalArgumentException.class)
 public void testAssertNameNotNull() throws Exception {
   factory.createInput(null, String.class);
 }