Skip to content

Commit

Permalink
Convert tests to java8 runtime (#3543)
Browse files Browse the repository at this point in the history
* convert tests to Java 8

* convert tests to Java 8

* remove Java 7 tests

* convert tests to Java 8

* revert ProjectContextMenuTest.java

* capabilities

* fix AppEngineProjectElementTest

* fix BuildPathTest

* remove testNonAppEngineLibraries_missingOnAppEngineStandardProject

* one more update to Java 8

* one more capability

* one more capability

* one more capability

* fix syntax for capability

* fix syntax for capability

* fix syntax for capability
  • Loading branch information
elharo authored Nov 15, 2019
1 parent 7e2add6 commit b41fdcf
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ Import-Package: com.google.cloud.tools.eclipse.test.util,
org.eclipse.core.expressions,
org.eclipse.core.resources,
org.osgi.framework;version="1.8.0"
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"

Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@
public class AppEngineProjectElementTest {
@Rule public TestProjectCreator projectCreator = new TestProjectCreator();

@Test
public void testCreation_appEngineStandardJava7() throws AppEngineException {
projectCreator.withFacets(
AppEngineStandardFacet.JRE7, WebFacetUtils.WEB_25, JavaFacet.VERSION_1_7);
IProject project = projectCreator.getProject();

AppEngineProjectElement projectElement = AppEngineProjectElement.create(project);
assertNotNull(projectElement);
assertNotNull(projectElement.getDescriptorFile());
assertEquals("appengine-web.xml", projectElement.getDescriptorFile().getName());
}

@Test
public void testCreation_appEngineFlexibleWar() throws AppEngineException {
projectCreator.withFacets(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class AppEngineStandardFacet {
public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID);
// See AppEngineStandardFacetChangeListener.APP_ENGINE_STANDARD_JRE8 too
public static final IProjectFacetVersion JRE7 = FACET.getVersion("JRE7");
public static final IProjectFacetVersion JRE8 = FACET.getVersion("JRE8");

static final String DEFAULT_RUNTIME_ID =
"com.google.cloud.tools.eclipse.appengine.standard.runtime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ Import-Package: com.google.cloud.tools.eclipse.test.util,
org.eclipse.core.runtime.spi;version="3.4.0",
org.eclipse.jst.common.project.facet.core,
org.eclipse.wst.common.project.facet.core
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
public class BuildPathTest {

@Rule public TestProjectCreator projectCreator = new TestProjectCreator()
.withFacets(JavaFacet.VERSION_1_7);
.withFacets(JavaFacet.VERSION_1_8);

private final IProgressMonitor monitor = new NullProgressMonitor();
private IJavaProject project;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Import-Package: com.google.cloud.tools.eclipse.appengine.libraries.ui,
org.eclipse.jst.common.project.facet.core,
org.eclipse.jst.j2ee.web.project.facet,
org.eclipse.swtbot.swt.finder.widgets
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,6 @@ public void testNonAppEngineLibraries_foundOnAppEngineFlexProject() {
assertThat(page.libraryGroups, Matchers.hasKey(CloudLibraries.NON_APP_ENGINE_STANDARD_GROUP));
}

@Test
public void testNonAppEngineLibraries_missingOnAppEngineStandardProject() {
IJavaProject javaProject = plainJavaProjectCreator
.withFacets(WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7).getJavaProject();
page.initialize(javaProject, null);
page.createControl(shellTestResource.getShell());
assertThat(page.libraryGroups,
Matchers.not(Matchers.hasKey(CloudLibraries.NON_APP_ENGINE_STANDARD_GROUP)));
}

@Test
public void testSelectionMaintained() {
// explicitly configure App Engine and GCP libraries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Import-Package: com.google.cloud.tools.eclipse.swtbot,
org.eclipse.jst.j2ee.web.project.facet,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.swt.finder.widgets
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class RunAppEngineShortcutTest {

@Rule public TestProjectCreator emptyProjectCreator = new TestProjectCreator();
@Rule public TestProjectCreator appEngineProjectCreator = new TestProjectCreator()
.withFacets(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7);
.withFacets(JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE8);

@Test
public void testRunAppEngine_enabledForAppEngineProject() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public class LaunchHelperTest {

@Rule
public TestProjectCreator appEngineStandardProject1 = new TestProjectCreator().withFacets(
JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7);
JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE8);
@Rule
public TestProjectCreator appEngineStandardProject2 = new TestProjectCreator().withFacets(
JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7);
JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE8);

@Rule
public TestProjectCreator projectCreator = new TestProjectCreator().withFacets(
JavaFacet.VERSION_1_7);
JavaFacet.VERSION_1_8);

@Before
public void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Import-Package: com.google.cloud.tools.eclipse.test.util,
org.eclipse.jdt.core,
org.eclipse.swtbot.swt.finder.widgets,
org.eclipse.wst.common.componentcore.internal
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class DeployAssemblyEntryRemoveJobTest {

@Rule public TestProjectCreator projectCreator = new TestProjectCreator()
.withFacets(JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25);
.withFacets(JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25);

@Test
public void testRun_entryRemoved() throws OperationCanceledException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ Import-Package: com.google.cloud.tools.appengine;version="0.8.1",
org.eclipse.m2e.core.project.configurator,
org.eclipse.wst.common.frameworks.datamodel
Export-Package: com.google.cloud.tools.eclipse.appengine.standard.java8
Provide-Capability: com.google.cloud.tools.facets.appengine;type:List="jre8"
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ Import-Package: com.google.cloud.tools.eclipse.test.util,
org.eclipse.jst.common.project.facet.core,
org.eclipse.jst.j2ee.web.project.facet,
org.eclipse.swt.widgets
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class AppEngineWebXmlValidationTest {

@Rule public TestProjectCreator projectCreator = new TestProjectCreator().withFacets(
JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7);
JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE8);

@Test
public void testValidElementsInAppEngineWebXml() throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class ApplicationSourceQuickFixTest {

@Rule
public TestProjectCreator appEngineStandardProject = new TestProjectCreator().withFacets(
JavaFacet.VERSION_1_7, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE7);
JavaFacet.VERSION_1_8, WebFacetUtils.WEB_25, AppEngineStandardFacet.JRE8);

@Test
public void testApply() throws CoreException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ public void testValidate() throws IOException {
IFile file = Mockito.mock(IFile.class);
when(file.getProject()).thenReturn(appEngineStandardProject.getProject());
validator.validate(reporter, file, xml.getBytes(StandardCharsets.UTF_8));
assertEquals(1, reporter.getMessages().size());
List<IMessage> messages = reporter.getMessages();
assertEquals(1, messages.size());
assertEquals(
"App Engine Standard does not support this servlet version", messages.get(0).getText());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Import-Package: com.google.cloud.tools.eclipse.test.util,
com.google.cloud.tools.eclipse.test.util.project,
org.eclipse.jdt.core,
org.eclipse.jst.common.project.facet.core
Require-Capability: com.google.cloud.tools.facets.appengine;filter:="(type=jre8)"

0 comments on commit b41fdcf

Please sign in to comment.