use of org.apache.maven.archetype.ui.ArchetypeDefinition in project maven-archetype by apache.
the class DefaultArchetypeSelectionQueryerTest method testDefaultArchetypeNotInMap.
public void testDefaultArchetypeNotInMap() throws PrompterException {
Map<String, List<Archetype>> map = createDefaultArchetypeCatalog();
MockControl control = MockControl.createControl(Prompter.class);
Prompter prompter = (Prompter) control.getMock();
prompter.prompt("");
control.setMatcher(createArgumentMatcher());
control.setReturnValue("1");
queryer.setPrompter(prompter);
control.replay();
ArchetypeDefinition defaultDefinition = new ArchetypeDefinition();
defaultDefinition.setGroupId("invalid-groupId");
defaultDefinition.setArtifactId("invalid-artifactId");
defaultDefinition.setVersion("invalid-version");
Archetype archetype = queryer.selectArchetype(map, defaultDefinition);
control.verify();
assertEquals("set-groupId", archetype.getGroupId());
assertEquals("set-artifactId", archetype.getArtifactId());
assertEquals("set-version", archetype.getVersion());
}
use of org.apache.maven.archetype.ui.ArchetypeDefinition in project maven-archetype by apache.
the class DefaultArchetypeSelectorTest method createDefaultArchetypeDefinition.
private ArchetypeDefinition createDefaultArchetypeDefinition() {
ArchetypeDefinition definition = new ArchetypeDefinition();
definition.setGroupId(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_GROUPID);
definition.setArtifactId(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_ARTIFACTID);
definition.setVersion(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_VERSION);
return definition;
}
use of org.apache.maven.archetype.ui.ArchetypeDefinition in project maven-archetype by apache.
the class DefaultArchetypeSelectorTest method testArchetypeArtifactIdNotInRequest.
public void testArchetypeArtifactIdNotInRequest() throws PrompterException, IOException, UnknownGroup, ArchetypeSelectionFailure, UnknownArchetype, ArchetypeNotDefined {
ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
MockControl control = MockControl.createControl(ArchetypeSelectionQueryer.class);
ArchetypeSelectionQueryer queryer = (ArchetypeSelectionQueryer) control.getMock();
queryer.selectArchetype(Collections.<String, List<Archetype>>emptyMap(), new ArchetypeDefinition());
control.setMatcher(MockControl.ALWAYS_MATCHER);
Archetype archetype = new Archetype();
archetype.setArtifactId("set-artifactId");
archetype.setGroupId("set-groupId");
archetype.setVersion("set-version");
control.setReturnValue(archetype);
control.replay();
selector.setArchetypeSelectionQueryer(queryer);
selector.selectArchetype(request, Boolean.TRUE, "");
control.verify();
assertEquals("set-groupId", request.getArchetypeGroupId());
assertEquals("set-artifactId", request.getArchetypeArtifactId());
assertEquals("set-version", request.getArchetypeVersion());
}
Aggregations