aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1126104 - in /aries/trunk/application: application-itests/src/test/java/org/apache/aries/application/runtime/itests/ application-utils/src/main/java/org/apache/aries/application/impl/ application-utils/src/main/java/org/apache/aries/applic...
Date Sun, 22 May 2011 17:16:28 GMT
Author: not
Date: Sun May 22 17:16:27 2011
New Revision: 1126104

URL: http://svn.apache.org/viewvc?rev=1126104&view=rev
Log:
ARIES-661 Stop using the NameValueMap.toString method when storing the Deployment.mf. Also
add a test to ensure
store and install round trips correctly.


Modified:
    aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
    aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
    aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java

Modified: aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java?rev=1126104&r1=1126103&r2=1126104&view=diff
==============================================================================
--- aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
(original)
+++ aries/trunk/application/application-itests/src/test/java/org/apache/aries/application/runtime/itests/BasicAppManagerTest.java
Sun May 22 17:16:27 2011
@@ -114,6 +114,30 @@ public class BasicAppManagerTest extends
     manager.uninstall(ctx);
   }
 
+  @Test
+  public void testAppStore() throws Exception {
+    AriesApplicationManager manager = getOsgiService(AriesApplicationManager.class);
+    AriesApplication app = manager.createApplication(FileSystem.getFSRoot(new File("test2.eba")));
+    app = manager.resolve(app);
+
+    app.store(new FileOutputStream("test2-resolved.eba"));
+
+    app = manager.createApplication(FileSystem.getFSRoot(new File("test2-resolved.eba")));
+
+    // application name should equal to whatever Application name provided in the application.mf
+    assertEquals("test application 2", app.getApplicationMetadata().getApplicationName());
+
+    AriesApplicationContext ctx = manager.install(app);
+    ctx.start();
+
+    HelloWorld hw = getOsgiService(HelloWorld.class);
+    String result = hw.getMessage();
+    assertEquals (result, "hello world");
+
+    ctx.stop();
+    manager.uninstall(ctx);
+  }
+
   
   @org.ops4j.pax.exam.junit.Configuration
   public static Option[] configuration() {

Modified: aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java?rev=1126104&r1=1126103&r2=1126104&view=diff
==============================================================================
--- aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
(original)
+++ aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/impl/ContentImpl.java
Sun May 22 17:16:27 2011
@@ -146,9 +146,24 @@ public final class ContentImpl implement
   @Override
   public String toString()
   {
-    return this.contentName + ";" + this.nameValueMap.toString();
+    StringBuilder builder = new StringBuilder();
+    
+    builder.append(this.contentName);
+    
+    if (!!!nameValueMap.isEmpty()) {
+      for (Map.Entry<String, String> entry : nameValueMap.entrySet()) {
+        builder.append(';');
+        builder.append(entry.getKey());
+        builder.append('=').append('\"');
+        builder.append(entry.getValue());
+        builder.append('\"');
+      }
+    }
+    
+    
+    return builder.toString();
   }
-  
+
   @Override
   public boolean equals(Object other)
   {

Modified: aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java?rev=1126104&r1=1126103&r2=1126104&view=diff
==============================================================================
--- aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java
(original)
+++ aries/trunk/application/application-utils/src/main/java/org/apache/aries/application/utils/manifest/ManifestHeaderProcessor.java
Sun May 22 17:16:27 2011
@@ -132,7 +132,7 @@ public class ManifestHeaderProcessor
     }
    @Override
    public String toString(){
-      StringBuffer sb = new StringBuffer();
+      StringBuilder sb = new StringBuilder();
       sb.append("{");
       boolean first=true;
       for(Map.Entry<N, V> entry : this.entrySet()){



Mime
View raw message