Package org.springframework.roo.project.maven

Examples of org.springframework.roo.project.maven.Pom


        converter.projectOperations = mockProjectOperations;
    }

    @Test
    public void testConvertOtherModuleName() {
        final Pom mockPom = mock(Pom.class);
        final String moduleName = "foo" + File.separator + "bar";
        when(mockProjectOperations.getPomFromModuleName(moduleName))
                .thenReturn(mockPom);
        assertEquals(mockPom, converter.convertFromText(moduleName, null, null));
    }
View Full Code Here


        assertEquals(mockPom, converter.convertFromText(moduleName, null, null));
    }

    @Test
    public void testConvertRootModuleSymbol() {
        final Pom mockRootPom = mock(Pom.class);
        when(mockProjectOperations.getPomFromModuleName("")).thenReturn(
                mockRootPom);
        assertEquals(mockRootPom,
                converter.convertFromText(ROOT_MODULE_SYMBOL, null, null));
    }
View Full Code Here

    }

    @CliCommand(value = METADATA_FOR_MODULE_COMMAND, help = "Shows the ProjectMetadata for the indicated project module")
    public String metadataForModule(
            @CliOption(key = { "", "module" }, mandatory = false, optionContext = PomConverter.INCLUDE_CURRENT_MODULE, help = "The module for which to retrieve the metadata (defaults to the focused module)") final Pom pom) {
        final Pom targetPom = ObjectUtils.defaultIfNull(pom,
                projectOperations.getFocusedModule());
        if (targetPom == null) {
            return "This project has no modules";
        }
        final String projectMID = ProjectMetadata
                .getProjectIdentifier(targetPom.getModuleName());
        return metadataService.get(projectMID).toString();
    }
View Full Code Here

        // This is a known module; use its known root path
        return new File(pom.getRoot());
    }

    private File getPath(final LogicalPath logicalPath) {
        final Pom pom = pomManagementService.getPomFromModuleName(logicalPath
                .getModule());
        final File moduleRoot = getModuleRoot(logicalPath.getModule(), pom);
        final String pathRelativeToPom = logicalPath.getPathRelativeToPom(pom);
        return new File(moduleRoot, pathRelativeToPom);
    }
View Full Code Here

        }
        return pathIds;
    }

    public String getRoot(final LogicalPath modulePathId) {
        final Pom pom = pomManagementService.getPomFromModuleName(modulePathId
                .getModule());
        return pom.getPhysicalPath(modulePathId.getPath()).getLocationPath();
    }
View Full Code Here

                "Unexpected metadata request '%s' for this provider",
                metadataId);
        // Just rebuild on demand. We always do this as we expect
        // MetadataService to cache on our behalf

        final Pom pom = pomManagementService
                .getPomFromModuleName(ProjectMetadata.getModuleName(metadataId));
        // Read the file, if it is available
        if (pom == null || !fileManager.exists(pom.getPath())) {
            return null;
        }

        final JavaPackage topLevelPackage = new JavaPackage(pom.getGroupId());
        // Update UAA with the project name
        uaaRegistrationService.registerProject(
                UaaRegistrationService.SPRING_ROO,
                topLevelPackage.getFullyQualifiedPackageName());

        // Update UAA with the well-known Spring-related open source
        // dependencies
        for (final ProductInfo productInfo : uaaDetectedProducts
                .getDetectedProductInfos()) {
            if (productInfo.getProductName().equals(
                    UaaRegistrationService.SPRING_ROO.getName())) {
                // No need to register with a less robust pom.xml-declared
                // dependency metadata when we did it ourselves with a proper
                // bundle version number lookup a moment ago...
                continue;
            }
            if (productInfo.getProductName().equals(
                    UaaDetectedProducts.SPRING_UAA.getProductName())) {
                // No need to register Spring UAA as this happens automatically
                // internal to UAA
                continue;
            }
            final Dependency dependency = new Dependency(
                    productInfo.getGroupId(), productInfo.getArtifactId(),
                    "version_is_ignored_for_searching");
            final Set<Dependency> dependenciesExcludingVersion = pom
                    .getDependenciesExcludingVersion(dependency);
            if (!dependenciesExcludingVersion.isEmpty()) {
                // This dependency was detected
                final Dependency first = dependenciesExcludingVersion
                        .iterator().next();
                // Convert the detected dependency into a Product as best we can
                String versionSequence = first.getVersion();
                // Version sequence given; see if it looks like a property
                if (versionSequence != null && versionSequence.startsWith("${")
                        && versionSequence.endsWith("}")) {
                    // Strip the ${ } from the version sequence
                    final String propertyName = versionSequence.replace("${",
                            "").replace("}", "");
                    final Set<Property> prop = pom
                            .getPropertiesExcludingValue(new Property(
                                    propertyName));
                    if (!prop.isEmpty()) {
                        // Take the first one's value and treat that as the
                        // version sequence
View Full Code Here

                        .isFeatureInstalledInFocusedModule(FeatureNames.JSF);
    }

    @Override
    public boolean isInstalledInModule(final String moduleName) {
        final Pom pom = projectOperations.getPomFromModuleName(moduleName);
        if (pom == null) {
            return false;
        }
        for (final Plugin buildPlugin : pom.getBuildPlugins()) {
            if ("gwt-maven-plugin".equals(buildPlugin.getArtifactId())) {
                return true;
            }
        }
        return false;
View Full Code Here

    @Test
    public void testConvertFullyQualifiedValueWithOneModulePrefix() {
        // Set up
        final String moduleName = "web";
        final Pom mockWebPom = mock(Pom.class);
        when(mockProjectOperations.getPomFromModuleName(moduleName))
                .thenReturn(mockWebPom);
        final String topLevelPackage = "com.example.app.mvc";
        when(mockTypeLocationService.getTopLevelPackageForModule(mockWebPom))
                .thenReturn(topLevelPackage);
View Full Code Here

    @Test
    public void testConvertTopLevelPackageWithOneModulePrefix() {
        // Set up
        final String moduleName = "web";
        final Pom mockWebPom = mock(Pom.class);
        when(mockProjectOperations.getPomFromModuleName(moduleName))
                .thenReturn(mockWebPom);
        final String topLevelPackage = "com.example.app.mvc";
        when(mockTypeLocationService.getTopLevelPackageForModule(mockWebPom))
                .thenReturn(topLevelPackage);
View Full Code Here

        @SuppressWarnings("unchecked")
        final List<Completion> mockCompletions = mock(List.class);
        when(mockProjectOperations.isFocusedProjectAvailable())
                .thenReturn(true);
        final String otherModuleName = "core";
        final Pom mockOtherModule = mock(Pom.class);
        when(mockOtherModule.getModuleName()).thenReturn(otherModuleName);
        when(mockProjectOperations.getPomFromModuleName(otherModuleName))
                .thenReturn(mockOtherModule);
        final String topLevelPackage = "com.example";
        when(
                mockTypeLocationService
                        .getTopLevelPackageForModule(mockOtherModule))
                .thenReturn(topLevelPackage);
        final String focusedModuleName = "web";
        when(mockProjectOperations.getModuleNames()).thenReturn(
                Arrays.asList(focusedModuleName, otherModuleName));
        final String modulePath = "/path/to/it";
        when(mockOtherModule.getPath()).thenReturn(modulePath);
        final JavaType type1 = new JavaType("com.example.web.ShouldBeFound");
        final JavaType type2 = new JavaType("com.example.foo.ShouldNotBeFound");
        when(mockTypeLocationService.getTypesForModule(mockOtherModule))
                .thenReturn(Arrays.asList(type1, type2));
View Full Code Here

TOP

Related Classes of org.springframework.roo.project.maven.Pom

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.