use of org.apache.maven.archetype.common.ArchetypeArtifactManager in project maven-archetype by apache.
the class DefaultArchetypeGenerationConfigurator2Test method setUp.
public void setUp() throws Exception {
super.setUp();
configurator = (DefaultArchetypeGenerationConfigurator) lookup(ArchetypeGenerationConfigurator.ROLE);
ProjectBuildingRequest buildingRequest = null;
// MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
// repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepository.getBasedir() ) );
// buildingRequest.setRepositorySession( repositorySession );
// request.setProjectBuildingRequest( buildingRequest );
MockControl control = MockControl.createControl(ArchetypeArtifactManager.class);
control.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
ArchetypeArtifactManager manager = (ArchetypeArtifactManager) control.getMock();
manager.exists("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(true);
manager.isFileSetArchetype("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(true);
manager.isOldArchetype("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(false);
manager.getFileSetArchetypeDescriptor("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
ArchetypeDescriptor descriptor = new ArchetypeDescriptor();
RequiredProperty groupId = new RequiredProperty();
groupId.setKey("groupId");
groupId.setDefaultValue("com.example.${groupName}");
RequiredProperty artifactId = new RequiredProperty();
artifactId.setKey("artifactId");
artifactId.setDefaultValue("${serviceName}");
RequiredProperty thePackage = new RequiredProperty();
thePackage.setKey("package");
thePackage.setDefaultValue("com.example.${groupName}");
RequiredProperty groupName = new RequiredProperty();
groupName.setKey("groupName");
groupName.setDefaultValue(null);
RequiredProperty serviceName = new RequiredProperty();
serviceName.setKey("serviceName");
serviceName.setDefaultValue(null);
descriptor.addRequiredProperty(groupId);
descriptor.addRequiredProperty(artifactId);
descriptor.addRequiredProperty(thePackage);
descriptor.addRequiredProperty(groupName);
descriptor.addRequiredProperty(serviceName);
control.setReturnValue(descriptor);
control.replay();
configurator.setArchetypeArtifactManager(manager);
}
use of org.apache.maven.archetype.common.ArchetypeArtifactManager in project maven-archetype by apache.
the class DefaultArchetypeGenerationConfiguratorTest method setUp.
public void setUp() throws Exception {
super.setUp();
configurator = (DefaultArchetypeGenerationConfigurator) lookup(ArchetypeGenerationConfigurator.ROLE);
ProjectBuildingRequest buildingRequest = null;
MockControl control = MockControl.createControl(ArchetypeArtifactManager.class);
control.setDefaultMatcher(MockControl.ALWAYS_MATCHER);
ArchetypeArtifactManager manager = (ArchetypeArtifactManager) control.getMock();
manager.exists("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(true);
manager.isFileSetArchetype("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(false);
manager.isOldArchetype("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(true);
manager.getOldArchetypeDescriptor("archetypeGroupId", "archetypeArtifactId", "archetypeVersion", null, null, null, buildingRequest);
control.setReturnValue(new ArchetypeDescriptor());
control.replay();
configurator.setArchetypeArtifactManager(manager);
}
Aggregations