Package org.springframework.roo.project

Examples of org.springframework.roo.project.Dependency


        // Check
        assertGav(pom, "com.example", "dependent-app", "2.1");
        final Collection<Dependency> dependencies = pom.getDependencies();
        assertEquals(1, dependencies.size());
        final Dependency dependency = dependencies.iterator().next();
        assertEquals("org.apache", dependency.getGroupId());
        assertEquals("commons-lang", dependency.getArtifactId());
        assertEquals("2.5", dependency.getVersion());
    }
View Full Code Here


    }

    private Dependency getMockDependency(final String groupId,
            final String artifactId, final String version,
            final DependencyType type) {
        final Dependency mockDependency = mock(Dependency.class);
        when(mockDependency.getGroupId()).thenReturn(groupId);
        when(mockDependency.getArtifactId()).thenReturn(artifactId);
        when(mockDependency.getVersion()).thenReturn(version);
        when(mockDependency.getType()).thenReturn(type);
        return mockDependency;
    }
View Full Code Here

    }

    @Test
    public void testCanAddNewDependencyOfLowerType() {
        // Set up
        final Dependency mockNewDependency = mock(Dependency.class);
        when(mockNewDependency.getType()).thenReturn(DependencyType.JAR);
        final Pom pom = getMinimalPom(WAR);

        // Invoke and check
        assertTrue(pom.canAddDependency(mockNewDependency));
    }
View Full Code Here

    }

    @Test
    public void testCanAddNewDependencyWhenOwnTypeIsNonStandard() {
        // Set up
        final Dependency mockNewDependency = mock(Dependency.class);
        when(mockNewDependency.getType()).thenReturn(DependencyType.WAR);
        final Pom pom = getMinimalPom("custom");

        // Invoke and check
        assertTrue(pom.canAddDependency(mockNewDependency));
    }
View Full Code Here

    }

    @Test
    public void testCannotAddAlreadyRegisteredDependency() {
        // Set up
        final Dependency mockExistingDependency = mock(Dependency.class);
        when(mockExistingDependency.getType()).thenReturn(DependencyType.JAR);
        final Pom pom = getMinimalPom(POM, mockExistingDependency);

        // Invoke and check
        assertFalse(pom.canAddDependency(mockExistingDependency));
    }
View Full Code Here

    }

    @Test
    public void testCannotAddNewDependencyOfHigherType() {
        // Set up
        final Dependency mockNewDependency = mock(Dependency.class);
        when(mockNewDependency.getType()).thenReturn(DependencyType.WAR);
        final Pom pom = getMinimalPom(JAR);

        // Invoke and check
        assertFalse(pom.canAddDependency(mockNewDependency));
    }
View Full Code Here

    public void testGetAsDependency() {
        // Set up
        final Pom pom = getMinimalPom(WAR);

        // Invoke
        final Dependency dependency = pom.asDependency(COMPILE);

        // Check
        assertEquals(GROUP_ID, dependency.getGroupId());
        assertEquals(ARTIFACT_ID, dependency.getArtifactId());
        assertEquals(VERSION, dependency.getVersion());
        assertEquals(DependencyType.WAR, dependency.getType());
        assertEquals(COMPILE, dependency.getScope());
        assertTrue(StringUtils.isBlank(dependency.getClassifier()));
    }
View Full Code Here

    }

    @Test
    public void testHasDependencyExcludingVersionWhenDependencyHasDifferentGroupId() {
        // Set up
        final Dependency mockExistingDependency = getMockDependency(
                DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, "1.0",
                DependencyType.JAR);
        final Pom pom = getMinimalPom(JAR, mockExistingDependency);
        final Dependency mockOtherDependency = getMockDependency("au."
                + DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, "1.0",
                DependencyType.JAR);

        // Invoke and check
        assertFalse(pom.hasDependencyExcludingVersion(mockOtherDependency));
View Full Code Here

    }

    @Test
    public void testHasDependencyExcludingVersionWhenDependencyHasDifferentType() {
        // Set up
        final Dependency mockExistingDependency = getMockDependency(
                DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, "1.0",
                DependencyType.JAR);
        final Pom pom = getMinimalPom(JAR, mockExistingDependency);
        final Dependency mockOtherDependency = getMockDependency(
                DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, "1.0",
                DependencyType.OTHER);

        // Invoke and check
        assertFalse(pom.hasDependencyExcludingVersion(mockOtherDependency));
View Full Code Here

    @Test
    public void testHasDependencyExcludingVersionWhenDependencyHasDifferentVersion() {
        // Set up
        final String existingVersion = "1.0";
        final Dependency mockExistingDependency = getMockDependency(
                DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, existingVersion,
                DependencyType.JAR);
        final Pom pom = getMinimalPom(JAR, mockExistingDependency);
        final Dependency mockOtherDependency = getMockDependency(
                DEPENDENCY_GROUP_ID, DEPENDENCY_ARTIFACT_ID, existingVersion
                        + ".1", DependencyType.JAR);

        // Invoke and check
        assertTrue(pom.hasDependencyExcludingVersion(mockOtherDependency));
View Full Code Here

TOP

Related Classes of org.springframework.roo.project.Dependency

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.