@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 testCreateUIInputWithShortName() throws Exception { UIInput<String> input = factory.createInput("foo", 'f', String.class); Assert.assertNotNull(input); Assert.assertTrue(input.hasFacet(HintsFacet.class)); Assert.assertEquals('f', input.getShortName()); }
@Test public void testCreateUIInput() throws Exception { UIInput<String> input = factory.createInput("foo", String.class); Assert.assertNotNull(input); Assert.assertTrue(input.hasFacet(HintsFacet.class)); Assert.assertEquals(InputComponents.DEFAULT_SHORT_NAME, input.getShortName()); }
@Test public void testCreateUIInputDefaultValue() throws Exception { UIInput<String> input = factory.createInput("foo", 'f', String.class); Assert.assertNotNull(input); input.setDefaultValue((String) null); Assert.assertFalse(input.hasDefaultValue()); }
@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); }