-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding an integration test for the compiler source and target synonyms
- Loading branch information
1 parent
72c7a1b
commit 24e62f6
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.eclipse.m2e.projects</groupId> | ||
<artifactId>compilersynonym</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>2.3.2</version> | ||
<configuration> | ||
<source>6</source> | ||
<target>5</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
org.eclipse.m2e.tests/src/org/eclipse/m2e/tests/project/CompilerSynonymTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
package org.eclipse.m2e.tests.project; | ||
|
||
import java.lang.reflect.Field; | ||
import java.lang.reflect.Modifier; | ||
import java.util.List; | ||
|
||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.runtime.IPath; | ||
|
||
import org.apache.maven.execution.MavenExecutionRequest; | ||
import org.apache.maven.execution.MavenSession; | ||
import org.apache.maven.plugin.MojoExecution; | ||
|
||
import org.eclipse.m2e.core.MavenPlugin; | ||
import org.eclipse.m2e.core.internal.MavenPluginActivator; | ||
import org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager; | ||
import org.eclipse.m2e.core.project.IMavenProjectFacade; | ||
import org.eclipse.m2e.core.project.MavenUpdateRequest; | ||
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator; | ||
import org.eclipse.m2e.core.project.configurator.ILifecycleMapping; | ||
import org.eclipse.m2e.core.project.configurator.MojoExecutionKey; | ||
import org.eclipse.m2e.tests.common.AbstractMavenProjectTestCase; | ||
import org.eclipse.jdt.core.IJavaProject; | ||
import org.eclipse.jdt.core.JavaCore; | ||
|
||
|
||
public class CompilerSynonymTest extends AbstractMavenProjectTestCase { | ||
|
||
public void testSynonym() throws Exception { | ||
IProject project = importProject("projects/compilersynonym/pom.xml"); | ||
assertNoErrors(project); | ||
waitForJobsToComplete(); | ||
|
||
IJavaProject javaProject = JavaCore.create(project); | ||
assertEquals("1.6", javaProject.getOption(JavaCore.COMPILER_SOURCE, true)); | ||
assertEquals("1.5", javaProject.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true)); | ||
|
||
|
||
} | ||
|
||
private void deserialize(IMavenProjectFacade facade) throws IllegalArgumentException, IllegalAccessException { | ||
// pretend it was deserialized from workspace state | ||
for(Field field : facade.getClass().getDeclaredFields()) { | ||
if(Modifier.isTransient(field.getModifiers())) { | ||
field.setAccessible(true); | ||
field.set(facade, null); | ||
} | ||
} | ||
} | ||
} |