You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2016/11/02 15:07:06 UTC

svn commit: r1767700 - in /sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e: LegacyMavenBundleProjectTest.java legacy-pom.xml

Author: rombert
Date: Wed Nov  2 15:07:05 2016
New Revision: 1767700

URL: http://svn.apache.org/viewvc?rev=1767700&view=rev
Log:
SLING-6112 - Make Sling IDE independent of m2e-tycho 

Create a test validating that a legacy Maven bundle project has the
correct error marker attached.

Added:
    sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/LegacyMavenBundleProjectTest.java
    sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/legacy-pom.xml

Added: sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/LegacyMavenBundleProjectTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/LegacyMavenBundleProjectTest.java?rev=1767700&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/LegacyMavenBundleProjectTest.java (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/LegacyMavenBundleProjectTest.java Wed Nov  2 15:07:05 2016
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+package org.apache.sling.ide.eclipse.m2e;
+
+import org.apache.sling.ide.eclipse.m2e.impl.helpers.MavenProjectAdapter;
+import org.apache.sling.ide.test.impl.helpers.DefaultJavaVMInstall;
+import org.apache.sling.ide.test.impl.helpers.DisableDebugStatusHandlers;
+import org.apache.sling.ide.test.impl.helpers.Poller;
+import org.apache.sling.ide.test.impl.helpers.TemporaryProject;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * This tests ensures that a legacy project has the correct error marker attached.
+ * 
+ * <p>By legacy projects we understand those that use the <tt>maven-bundle-plugin</tt> with a version older than 3.2.0.</p>
+ *
+ */
+public class LegacyMavenBundleProjectTest {
+
+    @Rule
+    public TemporaryProject projectRule = new TemporaryProject();
+
+    @Rule
+    public DisableDebugStatusHandlers disableDebugHandlers = new DisableDebugStatusHandlers();
+    
+    @Rule
+    public DefaultJavaVMInstall jvm = new DefaultJavaVMInstall();
+    
+    @Test
+    public void testLegacyMavenBundleProjectHasErrorMarker() throws Exception {
+        
+        // create project
+        final IProject bundleProject = projectRule.getProject();
+
+        MavenProjectAdapter project = new MavenProjectAdapter(bundleProject);
+        project.createOrUpdateFile(Path.fromPortableString("pom.xml"), getClass().getResourceAsStream("legacy-pom.xml"));
+        
+        project.convertToMavenProject();
+
+        Poller markerPoller = new Poller();
+        markerPoller.pollUntilSuccessful(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    IMarker[] markers = bundleProject.findMarkers(null, true, IResource.DEPTH_ONE);
+                    
+                    for ( IMarker marker : markers ) {
+                        if ( marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) != IMarker.SEVERITY_ERROR ) {
+                            continue;
+                        }
+                        
+                        if ( marker.getAttribute(IMarker.MESSAGE, "").startsWith("Missing m2e incremental support")) {
+                            return;
+                        }
+                    }
+                    
+                    throw new RuntimeException("Did not find error message starting with 'Missing m2e incremental support'");
+                } catch (CoreException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+    }
+}

Added: sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/legacy-pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/legacy-pom.xml?rev=1767700&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/legacy-pom.xml (added)
+++ sling/trunk/tooling/ide/eclipse-m2e-test/src/org/apache/sling/ide/eclipse/m2e/legacy-pom.xml Wed Nov  2 15:07:05 2016
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+	
+<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.apache.sling.ide.testing</groupId>
+    <artifactId>legacy-bundle</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+    <name>Legacy Bundle - using older maven-bundle-plugin</name>
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <version>1.23.0</version>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <version>3.0.1</version>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <!-- OSGi Dependencies -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr</artifactId>
+            <version>2.0.6</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <version>1.12.0</version>
+        </dependency>
+        <!--
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+            <version>2.4.0</version>
+        </dependency>
+        -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>6.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>5.0.0</version>
+        </dependency>
+    </dependencies>
+</project>