felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1716193 - in /felix/trunk/deploymentadmin: deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/ deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/ itest/ itest/src/test/java/org/apache/felix/deploymentadmin/ites...
Date Tue, 24 Nov 2015 16:15:36 GMT
Author: jawi
Date: Tue Nov 24 16:15:35 2015
New Revision: 1716193

URL: http://svn.apache.org/viewvc?rev=1716193&view=rev
Log:
FELIX-518 - support localization and signature files:

- ignore signature files (for now);
- allow localization files to precede bundle files.


Added:
    felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java
  (with props)
    felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties   (with props)
Modified:
    felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
    felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
    felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
    felix/trunk/deploymentadmin/itest/pom.xml
    felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
    felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallDeploymentPackageTest.java
    felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/ArtifactData.java
    felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/DeploymentPackageBuilder.java

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/AbstractDeploymentPackage.java
Tue Nov 24 16:15:35 2015
@@ -24,6 +24,7 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.jar.Manifest;
 
@@ -160,7 +161,7 @@ public abstract class AbstractDeployment
      * @param manifest The manifest of the deployment package.
      * @param bundleContext The bundle context.
      * @throws DeploymentException Thrown if the specified manifest does not
-     *         describe a valid deployment package.
+     *             describe a valid deployment package.
      */
     public AbstractDeploymentPackage(Manifest manifest, BundleContext bundleContext, DeploymentAdminImpl
deploymentAdmin) throws DeploymentException {
         m_manifest = new DeploymentPackageManifest(manifest);
@@ -279,7 +280,7 @@ public abstract class AbstractDeployment
      * @return Stream to the bundle identified by the specified symbolic name or
      *         null if no such bundle exists in this deployment package.
      * @throws IOException If the bundle can not be properly offered as an
-     *         inputstream
+     *             inputstream
      */
     public abstract InputStream getBundleStream(String symbolicName) throws IOException;
 
@@ -491,7 +492,7 @@ public abstract class AbstractDeployment
      * it's path/resource-id.
      *
      * @param path String containing a resource path (either bundle or processed
-     *        resource)
+     *            resource)
      * @return <code>AbstractInfoImpl</code> for the resource identified by the
      *         specified path or null if the path is unknown
      */
@@ -499,4 +500,17 @@ public abstract class AbstractDeployment
         return (AbstractInfo) m_pathToEntry.get(path);
     }
 
+    /**
+     * Returns whether the given name (which is expected to be the name of a
+     * JarEntry) is a signature file or the JAR index file.
+     * 
+     * @param name the name of the JAR entry to test, cannot be
+     *            <code>null</code>.
+     * @return <code>true</code> if the given JAR entry name is a signature file
+     *         or JAR index file, <code>false</code> otherwise.
+     */
+    protected boolean isMetaInfFile(String name) {
+        name = name.toUpperCase(Locale.US);
+        return name.startsWith("META-INF/") && (name.endsWith("/INDEX.LIST") || name.endsWith(".SF")
|| name.endsWith(".DSA") || name.endsWith(".RS"));
+    }
 }

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/StreamDeploymentPackage.java
Tue Nov 24 16:15:35 2015
@@ -35,6 +35,7 @@ import org.osgi.service.deploymentadmin.
 public class StreamDeploymentPackage extends AbstractDeploymentPackage {
     private final JarInputStream m_input;
     private final List m_names = new ArrayList();
+    private boolean m_inMetaInf = true;
 
     /**
      * Creates an instance of this class.
@@ -57,17 +58,37 @@ public class StreamDeploymentPackage ext
     }
 
     public AbstractInfo getNextEntry() throws IOException {
-        ZipEntry nextEntry = m_input.getNextJarEntry();
-        if (nextEntry == null) {
-            return null;
+        String name;
+
+        boolean metaInfFile = true;
+        do {
+            ZipEntry nextEntry = m_input.getNextJarEntry();
+            if (nextEntry == null) {
+                return null;
+            }
+            name = nextEntry.getName();
+
+            // FELIX-518: do not try to process signature or localization files...
+            metaInfFile = isMetaInfFile(name);
+            if (metaInfFile) {
+                if (!m_inMetaInf) {
+                    throw new IOException("Unexpected signature file found after manifest
files: " + name);
+                }
+                else {
+                    continue;
+                }
+            }
         }
-        String name = nextEntry.getName();
+        while (metaInfFile);
+
+        m_inMetaInf = false;
         m_names.add(name);
-        AbstractInfo abstractInfoByPath = getAbstractInfoByPath(name);
-        return abstractInfoByPath;
+
+        return getAbstractInfoByPath(name);
     }
 
-    // This only works for those resources that have been read from the stream already, no
guarantees for remainder of stream
+    // This only works for those resources that have been read from the stream already, no
guarantees for remainder of
+    // stream
     public BundleInfoImpl[] getOrderedBundleInfos() {
         List result = new ArrayList();
 

Modified: felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
(original)
+++ felix/trunk/deploymentadmin/deploymentadmin/src/main/java/org/apache/felix/deploymentadmin/spi/UpdateCommand.java
Tue Nov 24 16:15:35 2015
@@ -65,6 +65,10 @@ public class UpdateCommand extends Comma
                 String name = entry.getPath();
                 BundleInfoImpl bundleInfo = (BundleInfoImpl) expectedBundles.remove(name);
                 if (bundleInfo == null) {
+                    if (isLocalizationFile(name)) {
+                        // FELIX-518: do not try to process signature or localization files...
+                        continue;
+                    }
                     throw new DeploymentException(CODE_OTHER_ERROR, "Resource '" + name +
"' is not described in the manifest.");
                 }
 
@@ -100,8 +104,8 @@ public class UpdateCommand extends Comma
 
                 Version targetVersion = getVersion(bundle);
                 if (!sourceVersion.equals(targetVersion)) {
-                    throw new DeploymentException(CODE_OTHER_ERROR, "Installed/updated bundle
version (" + targetVersion + ") do not match what was installed/updated: " + sourceVersion
-                        + ", offending bundle = " + bsn);
+                    throw new DeploymentException(CODE_OTHER_ERROR,
+                        "Installed/updated bundle version (" + targetVersion + ") do not
match what was installed/updated: " + sourceVersion + ", offending bundle = " + bsn);
                 }
             }
         }
@@ -114,6 +118,10 @@ public class UpdateCommand extends Comma
         return Version.parseVersion((String) bundle.getHeaders().get(BUNDLE_VERSION));
     }
 
+    private boolean isLocalizationFile(String name) {
+        return name.startsWith("OSGI-INF/l10n/");
+    }
+
     private static class UninstallBundleRunnable extends AbstractAction {
         private final Bundle m_bundle;
         private final LogService m_log;

Modified: felix/trunk/deploymentadmin/itest/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/pom.xml?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/itest/pom.xml (original)
+++ felix/trunk/deploymentadmin/itest/pom.xml Tue Nov 24 16:15:35 2015
@@ -20,7 +20,7 @@
 	</parent>
 	<properties>
 		<osgi.version>4.2.0</osgi.version>
-		<pax.exam.version>3.4.0</pax.exam.version>
+		<pax.exam.version>3.6.0</pax.exam.version>
 		<pax.url.version>1.6.0</pax.url.version>
 	</properties>
 	<name>Apache Felix DeploymentAdmin Integration Tests</name>
@@ -46,7 +46,7 @@
 		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.dependencymanager</artifactId>
-			<version>3.1.0</version>
+			<version>4.1.1</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -58,7 +58,7 @@
 		<dependency>
 			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.metatype</artifactId>
-			<version>1.0.6</version>
+			<version>1.1.2</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -82,7 +82,12 @@
 		<dependency>
 			<groupId>junit</groupId>
 			<artifactId>junit</artifactId>
-			<version>4.11</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+			<version>1.10</version>
 			<scope>test</scope>
 		</dependency>
 
@@ -114,13 +119,13 @@
 		<dependency>
 			<groupId>ch.qos.logback</groupId>
 			<artifactId>logback-core</artifactId>
-			<version>1.1.2</version>
+			<version>1.1.3</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
 			<groupId>ch.qos.logback</groupId>
 			<artifactId>logback-classic</artifactId>
-			<version>1.1.2</version>
+			<version>1.1.3</version>
 			<scope>test</scope>
 		</dependency>
 
@@ -147,6 +152,14 @@
 					<source>1.6</source>
 				</configuration>
 			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+			</plugin>
 		</plugins>
 		<pluginManagement>
 			<plugins>

Modified: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
(original)
+++ felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/BaseIntegrationTest.java
Tue Nov 24 16:15:35 2015
@@ -88,6 +88,7 @@ public abstract class BaseIntegrationTes
             mavenBundle("org.apache.felix", "org.apache.felix.deploymentadmin").versionAsInProject(),
             mavenBundle("org.apache.felix", "org.apache.felix.eventadmin").versionAsInProject(),
             mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject(),
+            mavenBundle("commons-codec", "commons-codec").versionAsInProject(),
             
             junitBundles()
         );

Modified: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallDeploymentPackageTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallDeploymentPackageTest.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallDeploymentPackageTest.java
(original)
+++ felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/InstallDeploymentPackageTest.java
Tue Nov 24 16:15:35 2015
@@ -19,6 +19,7 @@
 package org.apache.felix.deploymentadmin.itest;
 
 import java.io.File;
+import java.net.URL;
 
 import org.apache.felix.deploymentadmin.itest.util.DeploymentPackageBuilder;
 import org.apache.felix.deploymentadmin.itest.util.DeploymentPackageBuilder.JarManifestManipulatingFilter;
@@ -37,6 +38,24 @@ import org.osgi.service.deploymentadmin.
 public class InstallDeploymentPackageTest extends BaseIntegrationTest
 {
     /**
+     * FELIX-518 - Test that DP with localization and signature files are properly deployed.
+     */
+    @Test
+    public void testInstallDeploymentPackageWithLocalizationAndSignatureFilesOk() throws
Exception {
+        URL dpProps = getClass().getResource("/dp.properties");
+        assertNotNull(dpProps);
+        
+        DeploymentPackageBuilder dpBuilder = createNewDeploymentPackageBuilder("1.0.0");
+        dpBuilder
+            .addSignatures()
+            .add(dpBuilder.createLocalizationResource().setUrl(dpProps).setResourceProcessorPID(TEST_FAILING_BUNDLE_RP1).setFilename("dp.properties"))
+            .add(dpBuilder.createResourceProcessorResource().setUrl(getTestBundleURL("rp1")));
+
+        installDeploymentPackage(dpBuilder);
+    }
+    
+    
+    /**
      * FELIX-4409/4410/4463 - test the installation of an invalid deployment package.
      */
     @Test

Modified: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/ArtifactData.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/ArtifactData.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/ArtifactData.java
(original)
+++ felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/ArtifactData.java
Tue Nov 24 16:15:35 2015
@@ -66,6 +66,10 @@ public class ArtifactData {
         return m_isBundle;
     }
 
+    public boolean isLocalizationFile() {
+        return m_filename.startsWith("OSGI-INF/l10n/");
+    }
+
     public boolean isCustomizer() {
         return m_isCustomizer;
     }

Modified: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/DeploymentPackageBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/DeploymentPackageBuilder.java?rev=1716193&r1=1716192&r2=1716193&view=diff
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/DeploymentPackageBuilder.java
(original)
+++ felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/DeploymentPackageBuilder.java
Tue Nov 24 16:15:35 2015
@@ -20,6 +20,7 @@ package org.apache.felix.deploymentadmin
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.Closeable;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -99,35 +100,39 @@ public class DeploymentPackageBuilder {
 
     private static final int BUFFER_SIZE = 32 * 1024;
 
+    /**
+     * Creates a new deployment package builder.
+     * 
+     * @param name the name of the deployment package
+     * @param version the version of the deployment package
+     * @return a builder to further add data to the deployment package
+     */
+    public static DeploymentPackageBuilder create(String name, String version) {
+        return new DeploymentPackageBuilder(name, version);
+    }
+
     private final String m_symbolicName;
     private final String m_version;
+    private final List<ArtifactData> m_localizationFiles = new ArrayList<ArtifactData>();
     private final List<ArtifactData> m_bundles = new ArrayList<ArtifactData>();
     private final List<ArtifactData> m_processors = new ArrayList<ArtifactData>();
 
     private final List<ArtifactData> m_artifacts = new ArrayList<ArtifactData>();
+
     private String m_fixPackageVersion;
 
+    private boolean m_addSignatures;
     private boolean m_verification;
 
     private DeploymentPackageBuilder(String symbolicName, String version) {
         m_symbolicName = symbolicName;
         m_version = version;
 
+        m_addSignatures = false;
         m_verification = true;
     }
 
     /**
-     * Creates a new deployment package builder.
-     * 
-     * @param name the name of the deployment package
-     * @param version the version of the deployment package
-     * @return a builder to further add data to the deployment package
-     */
-    public static DeploymentPackageBuilder create(String name, String version) {
-        return new DeploymentPackageBuilder(name, version);
-    }
-
-    /**
      * Adds an artifact to the deployment package.
      * 
      * @param builder the artifact data builder to use.
@@ -142,12 +147,20 @@ public class DeploymentPackageBuilder {
         else if (artifactData.isBundle()) {
             m_bundles.add(artifactData);
         }
+        else if (artifactData.isLocalizationFile()) {
+            m_localizationFiles.add(artifactData);
+        }
         else {
             m_artifacts.add(artifactData);
         }
         return this;
     }
 
+    public DeploymentPackageBuilder addSignatures() {
+        m_addSignatures = true;
+        return this;
+    }
+
     /**
      * Creates a new deployment package builder with the same symbolic name as this builder.
      * 
@@ -163,6 +176,10 @@ public class DeploymentPackageBuilder {
         return new BundleDataBuilder();
     }
 
+    public LocalizationResourceDataBuilder createLocalizationResource() {
+        return new LocalizationResourceDataBuilder();
+    }
+
     public ResourceDataBuilder createResource() {
         return new ResourceDataBuilder();
     }
@@ -207,6 +224,7 @@ public class DeploymentPackageBuilder {
      */
     public void generate(OutputStream output) throws Exception {
         List<ArtifactData> artifacts = new ArrayList<ArtifactData>();
+        artifacts.addAll(m_localizationFiles);
         artifacts.addAll(m_bundles);
         artifacts.addAll(m_processors);
         artifacts.addAll(m_artifacts);
@@ -217,6 +235,14 @@ public class DeploymentPackageBuilder {
         }
 
         Manifest m = createManifest(artifacts);
+
+        // The order in which the actual entries are added to the JAR is different than we're
using for the manifest...
+        artifacts.clear();
+        artifacts.addAll(m_bundles);
+        artifacts.addAll(m_processors);
+        artifacts.addAll(m_localizationFiles);
+        artifacts.addAll(m_artifacts);
+
         writeStream(artifacts, m, output);
     }
 
@@ -293,6 +319,10 @@ public class DeploymentPackageBuilder {
                 a.putValue("DeploymentPackage-Missing", "true");
             }
 
+            if (m_addSignatures) {
+                a.putValue("SHA-256-Digest", "bogusdata=");
+            }
+
             entries.put(file.getFilename(), a);
         }
 
@@ -337,12 +367,40 @@ public class DeploymentPackageBuilder {
         }
     }
 
+    private InputStream getArtifactDataInputStream(ArtifactData file) throws IOException
{
+        ResourceFilter filter = file.getFilter();
+        if (filter != null) {
+            return filter.createInputStream(file.getURL());
+        }
+        return file.getURL().openStream();
+    }
+
     private void writeStream(List<ArtifactData> files, Manifest manifest, OutputStream
outputStream) throws Exception {
+        byte[] buffer = new byte[BUFFER_SIZE];
         JarOutputStream output = null;
-        InputStream fis = null;
+        InputStream is = null;
         try {
             output = new JarOutputStream(outputStream, manifest);
-            byte[] buffer = new byte[BUFFER_SIZE];
+
+            if (m_addSignatures) {
+                // Empty file index...
+                output.putNextEntry(new JarEntry("META-INF/INDEX.LIST"));
+                output.write(new byte[0]);
+                output.closeEntry();
+                
+                // Create a signature file + signature block
+                Manifest mf = new Manifest();
+                mf.getMainAttributes().put(Attributes.Name.SIGNATURE_VERSION, "1.0");
+                mf.getMainAttributes().putValue("SHA-256-Digest-Manifest", "bogusdata=");
+
+                output.putNextEntry(new JarEntry("META-INF/DP.SF"));
+                mf.write(output);
+                output.closeEntry();
+
+                output.putNextEntry(new JarEntry("META-INF/DP.DSA"));
+                output.write(new byte[] { 1, 2, 3, 4 });
+                output.closeEntry();
+            }
 
             Iterator<ArtifactData> filesIter = files.iterator();
             while (filesIter.hasNext()) {
@@ -354,35 +412,33 @@ public class DeploymentPackageBuilder {
 
                 output.putNextEntry(new JarEntry(file.getFilename()));
 
-                ResourceFilter filter = file.getFilter();
-                if (filter != null) {
-                    fis = filter.createInputStream(file.getURL());
-                }
-                else {
-                    fis = file.getURL().openStream();
-                }
-
+                is = getArtifactDataInputStream(file);
                 try {
-                    int bytes = fis.read(buffer);
-                    while (bytes != -1) {
+                    int bytes;
+                    while ((bytes = is.read(buffer)) != -1) {
                         output.write(buffer, 0, bytes);
-                        bytes = fis.read(buffer);
                     }
                 }
                 finally {
-                    fis.close();
-                    fis = null;
+                    closeSilently(is);
 
                     output.closeEntry();
                 }
             }
         }
         finally {
-            if (fis != null) {
-                fis.close();
+            closeSilently(is);
+            closeSilently(output);
+        }
+    }
+
+    static void closeSilently(Closeable resource) {
+        if (resource != null) {
+            try {
+                resource.close();
             }
-            if (output != null) {
-                output.close();
+            catch (IOException e) {
+                // Ignore...
             }
         }
     }

Added: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java?rev=1716193&view=auto
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java
(added)
+++ felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java
Tue Nov 24 16:15:35 2015
@@ -0,0 +1,43 @@
+/*
+ * 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.felix.deploymentadmin.itest.util;
+
+/**
+ * Provides a resource data builder.
+ */
+public class LocalizationResourceDataBuilder extends ResourceDataBuilder {
+
+    public LocalizationResourceDataBuilder() {
+        // Nop
+    }
+
+    @Override
+    public LocalizationResourceDataBuilder setFilename(String filename) {
+        String prefix = "OSGI-INF/l10n/";
+        if (!filename.startsWith(prefix)) {
+            filename = prefix.concat(filename);
+        }
+        return (LocalizationResourceDataBuilder) super.setFilename(filename);
+    }
+
+    @Override
+    LocalizationResourceDataBuilder getThis() {
+        return this;
+    }
+}

Propchange: felix/trunk/deploymentadmin/itest/src/test/java/org/apache/felix/deploymentadmin/itest/util/LocalizationResourceDataBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties
URL: http://svn.apache.org/viewvc/felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties?rev=1716193&view=auto
==============================================================================
--- felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties (added)
+++ felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties Tue Nov 24 16:15:35
2015
@@ -0,0 +1,18 @@
+# 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.
+#
+# no additional properties
\ No newline at end of file

Propchange: felix/trunk/deploymentadmin/itest/src/test/resources/dp.properties
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message