mirror of https://github.com/apache/maven.git
o Deleted test which is invalid due to r772675
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@775666 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b4df2f1bb3
commit
8c30410341
|
@ -1,89 +0,0 @@
|
||||||
package org.apache.maven.embedder.project;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
* KIND, either express or implied. See the License for the
|
|
||||||
* specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.embedder.AbstractEmbedderTestCase;
|
|
||||||
import org.apache.maven.embedder.Configuration;
|
|
||||||
import org.apache.maven.embedder.ConfigurationValidationResult;
|
|
||||||
import org.apache.maven.embedder.DefaultConfiguration;
|
|
||||||
import org.apache.maven.embedder.MavenEmbedder;
|
|
||||||
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
|
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
|
||||||
import org.apache.maven.project.MavenProject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We want to make sure when projects are newly created and have dependencies between them that
|
|
||||||
* projects will still resolve and allow good IDE integration. Currently if you have newly
|
|
||||||
* created projects that have interdependencies and you have not run "mvn install" then
|
|
||||||
* none of the dependencies will be resolved for projects with interdependencies.
|
|
||||||
*
|
|
||||||
* @author Jason van Zyl
|
|
||||||
*/
|
|
||||||
public class MavenEmbedderProjectNotInRepositoryTest
|
|
||||||
extends AbstractEmbedderTestCase
|
|
||||||
{
|
|
||||||
public void testThatNewlyCreatedProjectsWithInterdependenciesStillResolveCorrectly()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
|
||||||
|
|
||||||
Configuration configuration = new DefaultConfiguration()
|
|
||||||
.setClassLoader( classLoader )
|
|
||||||
.setMavenEmbedderLogger( new MavenEmbedderConsoleLogger() );
|
|
||||||
|
|
||||||
ConfigurationValidationResult cr = MavenEmbedder.validateConfiguration( configuration );
|
|
||||||
|
|
||||||
assertTrue( cr.isValid() );
|
|
||||||
|
|
||||||
MavenEmbedder embedder = new MavenEmbedder( configuration );
|
|
||||||
|
|
||||||
File pom = new File( getBasedir(), "src/test/projects/no-artifact-in-repository-test" );
|
|
||||||
|
|
||||||
MavenExecutionRequest request = new DefaultMavenExecutionRequest()
|
|
||||||
.setBaseDirectory( pom );
|
|
||||||
|
|
||||||
MavenExecutionResult result = embedder.readProjectWithDependencies( request );
|
|
||||||
|
|
||||||
List projects = result.getTopologicallySortedProjects();
|
|
||||||
|
|
||||||
MavenProject project;
|
|
||||||
|
|
||||||
project = (MavenProject) projects.get( 0 );
|
|
||||||
|
|
||||||
assertEquals( "child-1", project.getArtifactId() );
|
|
||||||
|
|
||||||
project = (MavenProject) projects.get( 1 );
|
|
||||||
|
|
||||||
assertEquals( "child-2", project.getArtifactId() );
|
|
||||||
|
|
||||||
List deps = project.getDependencies();
|
|
||||||
|
|
||||||
assertEquals( 2, deps.size() );
|
|
||||||
|
|
||||||
project = (MavenProject) projects.get( 2 );
|
|
||||||
|
|
||||||
assertEquals( "parent", project.getArtifactId() );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>test</groupId>
|
|
||||||
<artifactId>child-1</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<name>child-1</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,13 +0,0 @@
|
||||||
package org.apache.maven.test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hello world!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class App
|
|
||||||
{
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
System.out.println( "Hello World!" );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package org.apache.maven.test;
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit test for simple App.
|
|
||||||
*/
|
|
||||||
public class AppTest
|
|
||||||
extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create the test case
|
|
||||||
*
|
|
||||||
* @param testName name of the test case
|
|
||||||
*/
|
|
||||||
public AppTest( String testName )
|
|
||||||
{
|
|
||||||
super( testName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the suite of tests being tested
|
|
||||||
*/
|
|
||||||
public static Test suite()
|
|
||||||
{
|
|
||||||
return new TestSuite( AppTest.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rigourous Test :-)
|
|
||||||
*/
|
|
||||||
public void testApp()
|
|
||||||
{
|
|
||||||
assertTrue( true );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,23 +0,0 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>test</groupId>
|
|
||||||
<artifactId>child-2</artifactId>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<name>child-2</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.test</groupId>
|
|
||||||
<artifactId>child-1</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
|
@ -1,13 +0,0 @@
|
||||||
package org.apache.maven.test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hello world!
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class App
|
|
||||||
{
|
|
||||||
public static void main( String[] args )
|
|
||||||
{
|
|
||||||
System.out.println( "Hello World!" );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package org.apache.maven.test;
|
|
||||||
|
|
||||||
import junit.framework.Test;
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import junit.framework.TestSuite;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unit test for simple App.
|
|
||||||
*/
|
|
||||||
public class AppTest
|
|
||||||
extends TestCase
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create the test case
|
|
||||||
*
|
|
||||||
* @param testName name of the test case
|
|
||||||
*/
|
|
||||||
public AppTest( String testName )
|
|
||||||
{
|
|
||||||
super( testName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the suite of tests being tested
|
|
||||||
*/
|
|
||||||
public static Test suite()
|
|
||||||
{
|
|
||||||
return new TestSuite( AppTest.class );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rigourous Test :-)
|
|
||||||
*/
|
|
||||||
public void testApp()
|
|
||||||
{
|
|
||||||
assertTrue( true );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<groupId>test</groupId>
|
|
||||||
<artifactId>parent</artifactId>
|
|
||||||
<packaging>pom</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<name>no-artifact-in-repository-test</name>
|
|
||||||
<url>http://maven.apache.org</url>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<modules>
|
|
||||||
<module>child-1</module>
|
|
||||||
<module>child-2</module>
|
|
||||||
</modules>
|
|
||||||
</project>
|
|
Loading…
Reference in New Issue