sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefane...@apache.org
Subject svn commit: r1598056 - in /sling/trunk/tooling/ide/eclipse-test: ./ src/org/apache/sling/ide/test/impl/
Date Wed, 28 May 2014 15:57:48 GMT
Author: stefanegli
Date: Wed May 28 15:57:48 2014
New Revision: 1598056

URL: http://svn.apache.org/r1598056
Log:
SLING-3615 : added TychoJREHelper which allows to explicitly install a particular JRE (configured
in the pom via system property 'tycho.jre.helper.jre.home'). This is meant as a workaround
until someone finds a better/more appropriate solution

Added:
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java
  (with props)
Modified:
    sling/trunk/tooling/ide/eclipse-test/pom.xml
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt
    sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt

Modified: sling/trunk/tooling/ide/eclipse-test/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/pom.xml?rev=1598056&r1=1598055&r2=1598056&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/pom.xml (original)
+++ sling/trunk/tooling/ide/eclipse-test/pom.xml Wed May 28 15:57:48 2014
@@ -20,6 +20,8 @@
                 <version>${tycho.version}</version>
                 <configuration>
                     <useUIHarness>true</useUIHarness>
+                    <!-- use below useUIThread==false to be able to fiddle with eclipse
during 'mvn verify' -->
+<!--                    <useUIThread>false</useUIThread> -->
                     <argLine>-XX:MaxPermSize=512m ${ui.test.args}</argLine>
                     <dependencies>
                         <!-- Pull in all the artifacts we reference from 
@@ -149,7 +151,7 @@
                 </os>
             </activation>
             <properties>
-                <ui.test.args>-XstartOnFirstThread</ui.test.args>
+                <ui.test.args>-XstartOnFirstThread -Dtycho.jre.helper.jre.home=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home</ui.test.args>
             </properties>
         </profile>
     </profiles>

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java?rev=1598056&r1=1598055&r2=1598056&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java
(original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/BundleDeploymentTest.java
Wed May 28 15:57:48 2014
@@ -31,8 +31,8 @@ import org.apache.sling.ide.test.impl.he
 import org.apache.sling.ide.test.impl.helpers.OsgiBundleManifest;
 import org.apache.sling.ide.test.impl.helpers.Poller;
 import org.apache.sling.ide.test.impl.helpers.ProjectAdapter;
-import org.apache.sling.ide.test.impl.helpers.ServerAdapter;
 import org.apache.sling.ide.test.impl.helpers.RepositoryAccessor;
+import org.apache.sling.ide.test.impl.helpers.ServerAdapter;
 import org.apache.sling.ide.test.impl.helpers.SlingWstServer;
 import org.apache.sling.ide.test.impl.helpers.TemporaryProject;
 import org.apache.sling.ide.test.impl.helpers.ToolingSupportBundle;
@@ -105,6 +105,26 @@ public class BundleDeploymentTest {
         // install bundle facet
         project.installFacet("sling.bundle", "1.0");
 
+        if (!TychoJREHelper.hasDefaultVM()) {
+            String jreHome = System.getProperty("tycho.jre.helper.jre.home");
+            if (jreHome!=null && jreHome.length()>0) {
+                System.out.println("Installing Default VM to be : "+jreHome);
+                TychoJREHelper.installDefaultVM(jreHome);
+            } else {
+                System.out.println("Cannot install Default VM, system property 'tycho.jre.helper.jre.home'
not set! Test might fail!");
+            }
+        }
+
+//        bundleProject.build(IncrementalProjectBuilder.CLEAN_BUILD, pm);
+//        bundleProject.build(IncrementalProjectBuilder.FULL_BUILD, pm);
+//        ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, pm);
+//        bundleProject.refreshLocal(IResource.DEPTH_INFINITE, pm);
+        
+        System.out.println("Paranoia sleep of 5sec to make sure the bundle is properly built");
+        Thread.sleep(5000);
+        System.out.println("Continuing after 5sec sleep.");
+        
+
         ServerAdapter server = new ServerAdapter(wstServer.getServer());
         server.setAttribute(ISlingLaunchpadServer.PROP_INSTALL_LOCALLY, installBundleLocally);
         server.installModule(bundleProject);

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt?rev=1598056&r1=1598055&r2=1598056&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt
(original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v1.txt
Wed May 28 15:57:48 2014
@@ -7,7 +7,6 @@ import org.apache.sling.api.servlets.*;
 
 public class SimpleServlet extends SlingSafeMethodsServlet {
     
-    @Override
     protected void doGet(SlingHttpServletRequest request,
             SlingHttpServletResponse response) throws ServletException,
             IOException {

Modified: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt?rev=1598056&r1=1598055&r2=1598056&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt
(original)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/SimpleServlet.java.v2.txt
Wed May 28 15:57:48 2014
@@ -7,7 +7,6 @@ import org.apache.sling.api.servlets.*;
 
 public class SimpleServlet extends SlingSafeMethodsServlet {
     
-    @Override
     protected void doGet(SlingHttpServletRequest request,
             SlingHttpServletResponse response) throws ServletException,
             IOException {

Added: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java?rev=1598056&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java
(added)
+++ sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java
Wed May 28 15:57:48 2014
@@ -0,0 +1,51 @@
+/*
+ * 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.test.impl;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.internal.launching.StandardVMType;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.IVMInstallType;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.launching.VMStandin;
+
+public class TychoJREHelper {
+
+    public static boolean hasDefaultVM() {
+        IVMInstall vm = JavaRuntime.getDefaultVMInstall();
+        return vm!=null;
+    }
+    
+    public static void installDefaultVM(String jrePath) throws CoreException {
+        final IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
+        String id = null;
+        do {
+            id = String.valueOf(System.currentTimeMillis());
+        } while (vmInstallType.findVMInstall(id) != null);
+
+        VMStandin newVm = new VMStandin(vmInstallType, id);
+        newVm.setName("Default-VM");
+        File installLocation = new File(jrePath);
+        newVm.setInstallLocation(installLocation);
+        newVm.convertToRealVM();
+        JavaRuntime.setDefaultVMInstall(newVm, new NullProgressMonitor());
+    }
+
+}

Propchange: sling/trunk/tooling/ide/eclipse-test/src/org/apache/sling/ide/test/impl/TychoJREHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message