incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r952409 - in /incubator/aries/trunk/application: application-itests/src/test/java/org/apache/aries/application/runtime/itests/ application-utils/src/main/java/org/apache/aries/application/impl/
Date Mon, 07 Jun 2010 20:16:21 GMT
Author: linsun
Date: Mon Jun  7 20:16:21 2010
New Revision: 952409

URL: http://svn.apache.org/viewvc?rev=952409&view=rev
Log:
ARIES-327 From time to time OBRResolverTest causes Aries build to fail - patch from Bartosz
Kowalewski

Modified:
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
    incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
    incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java?rev=952409&r1=952408&r2=952409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/AbstractIntegrationTest.java
Mon Jun  7 20:16:21 2010
@@ -16,6 +16,7 @@
  */
 package org.apache.aries.application.runtime.itests;
 
+import static org.junit.Assert.assertNotNull;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.wrappedBundle;
 import static org.ops4j.pax.exam.OptionUtils.combine;
@@ -23,6 +24,8 @@ import static org.ops4j.pax.exam.OptionU
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.aries.application.management.AriesApplicationResolver;
+import org.apache.aries.blueprint.BlueprintConstants;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.runner.RunWith;
@@ -33,6 +36,7 @@ import org.ops4j.pax.exam.junit.JUnit4Te
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Filter;
 import org.osgi.framework.FrameworkUtil;
@@ -149,5 +153,26 @@ public class AbstractIntegrationTest {
       throw new RuntimeException(e);
     }
   }
+  
+  /**
+   * Checks if the OBR Resolver is available. If this test succeeds, it starts 
+   * the 'org.apache.aries.application.runtime' bundle. Of course this method 
+   * can only work properly if org.apache.aries.application.runtime was added
+   * to Pax Exam configuration with 'noStart()'. 
+   * @throws BundleException 
+   */
+  protected void startApplicationRuntimeBundle() throws BundleException{
+    // Need to make sure that the OBR resolver was made available. This 
+    // resolver is registered by the org.apache.aries.application.resolver.obr
+    // bundle with osgi.service.blueprint.compname=obr-resolver.
+    getOsgiService(AriesApplicationResolver.class, "(" + 
+        BlueprintConstants.COMPONENT_NAME_PROPERTY + "=obr-resolver)", 
+        DEFAULT_TIMEOUT);
+    // If we reached this point, initialization of the OBR resolver has been
+    // finished. Let's start the org.apache.aries.application.runtime bundle.
+    Bundle appRuntimeBundle = getBundle("org.apache.aries.application.runtime");
+    assertNotNull(appRuntimeBundle);
+    appRuntimeBundle.start();
+  }
 
 }
\ No newline at end of file

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java?rev=952409&r1=952408&r2=952409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
(original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRAppManagerTest.java
Mon Jun  7 20:16:21 2010
@@ -107,6 +107,8 @@ public class OBRAppManagerTest extends A
 
   @Test
   public void testAppWithApplicationManifest() throws Exception {
+    startApplicationRuntimeBundle();
+
     RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
     
     repositoryAdmin.addRepository(new File("repository.xml").toURI().toURL());
@@ -160,7 +162,7 @@ public class OBRAppManagerTest extends A
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
+        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime").noStart(),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
         mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),

Modified: incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java?rev=952409&r1=952408&r2=952409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
(original)
+++ incubator/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/OBRResolverTest.java
Mon Jun  7 20:16:21 2010
@@ -67,8 +67,8 @@ public class OBRResolverTest extends Abs
 {
   public static final String CORE_BUNDLE_BY_VALUE = "core.bundle.by.value";
   public static final String CORE_BUNDLE_BY_REFERENCE = "core.bundle.by.reference";
-  public static final String TRANSITIVE_BUNDLE_BY_VALUE = "transitive.bundle.by.reference";
-  public static final String TRANSITIVE_BUNDLE_BY_REFERENCE = "transitive.bundle.by.value";
+  public static final String TRANSITIVE_BUNDLE_BY_VALUE = "transitive.bundle.by.value";
+  public static final String TRANSITIVE_BUNDLE_BY_REFERENCE = "transitive.bundle.by.reference";
   
   
   /* Use @Before not @BeforeClass so as to ensure that these resources
@@ -142,6 +142,8 @@ public class OBRResolverTest extends Abs
   @Test(expected=ResolverException.class)
   public void testBlogAppResolveFail() throws ResolverException, Exception
   {
+    startApplicationRuntimeBundle();
+
     generateOBRRepoXML(TRANSITIVE_BUNDLE_BY_REFERENCE + ".jar", CORE_BUNDLE_BY_REFERENCE
+ "_0.0.0.jar");
     
     RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
@@ -163,6 +165,8 @@ public class OBRResolverTest extends Abs
   @Test
   public void testBlogApp() throws Exception 
   {
+    startApplicationRuntimeBundle();
+
     generateOBRRepoXML(TRANSITIVE_BUNDLE_BY_REFERENCE + ".jar", CORE_BUNDLE_BY_REFERENCE
+ ".jar");
     
     RepositoryAdmin repositoryAdmin = getOsgiService(RepositoryAdmin.class);
@@ -257,7 +261,7 @@ public class OBRResolverTest extends Abs
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.api"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.utils"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.management"),
-        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime"),
+        mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime").noStart(),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.resolver.obr"),
         mavenBundle("org.apache.felix", "org.apache.felix.bundlerepository"),
         mavenBundle("org.apache.aries.application", "org.apache.aries.application.runtime.itest.interfaces"),

Modified: incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java?rev=952409&r1=952408&r2=952409&view=diff
==============================================================================
--- incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
(original)
+++ incubator/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
Mon Jun  7 20:16:21 2010
@@ -32,7 +32,7 @@ import org.osgi.framework.Version;
 
 
 /**
- * Implementation of Content 
+ * Implementation of Content
  *
  */
 public final class ContentImpl implements Content



Mime
View raw message