FELIX-4736 Refactor R4Library and R4LibraryClause to NativeLibrary and NativeLibraryClause respectively.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1647710 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java b/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
index f5f8bdd..16f8c2b 100644
--- a/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
+++ b/framework.security/src/main/java/org/apache/felix/framework/security/condpermadmin/ConditionalPermissionAdminImpl.java
@@ -56,7 +56,7 @@
import org.apache.felix.framework.security.util.LocalPermissions;
import org.apache.felix.framework.security.util.Permissions;
import org.apache.felix.framework.security.util.PropertiesCache;
-import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.apache.felix.framework.util.manifestparser.NativeLibrary;
/*
import org.apache.felix.moduleloader.ICapability;
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
index 8c8c548..01bf4b8 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
@@ -34,7 +34,7 @@
import org.apache.felix.framework.util.SecureAction;
import org.apache.felix.framework.util.Util;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.apache.felix.framework.util.manifestparser.NativeLibrary;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -63,7 +63,7 @@
private final List<BundleCapability> m_declaredCaps;
private final List<BundleRequirement> m_declaredReqs;
- private final List<R4Library> m_declaredNativeLibs;
+ private final List<NativeLibrary> m_declaredNativeLibs;
private final int m_declaredActivationPolicy;
private final List<String> m_activationIncludes;
private final List<String> m_activationExcludes;
@@ -283,7 +283,7 @@
return m_manifestVersion;
}
- public List<R4Library> getDeclaredNativeLibraries()
+ public List<NativeLibrary> getDeclaredNativeLibraries()
{
return m_declaredNativeLibs;
}
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index 9c9b09b..cd345cc 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -52,7 +52,7 @@
import org.apache.felix.framework.util.SecurityManagerEx;
import org.apache.felix.framework.util.Util;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.apache.felix.framework.util.manifestparser.NativeLibrary;
import org.apache.felix.framework.wiring.BundleRequirementImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -99,7 +99,7 @@
private final Map<String, List<List<String>>> m_includedPkgFilters;
private final Map<String, List<List<String>>> m_excludedPkgFilters;
private final List<BundleRequirement> m_resolvedReqs;
- private final List<R4Library> m_resolvedNativeLibs;
+ private final List<NativeLibrary> m_resolvedNativeLibs;
private final List<Content> m_fragmentContents;
private volatile List<BundleRequirement> m_wovenReqs = null;
@@ -401,14 +401,14 @@
m_excludedPkgFilters = (excludedPkgFilters.isEmpty())
? Collections.EMPTY_MAP : excludedPkgFilters;
- List<R4Library> libList = (m_revision.getDeclaredNativeLibraries() == null)
- ? new ArrayList<R4Library>()
- : new ArrayList<R4Library>(m_revision.getDeclaredNativeLibraries());
+ List<NativeLibrary> libList = (m_revision.getDeclaredNativeLibraries() == null)
+ ? new ArrayList<NativeLibrary>()
+ : new ArrayList<NativeLibrary>(m_revision.getDeclaredNativeLibraries());
for (int fragIdx = 0;
(m_fragments != null) && (fragIdx < m_fragments.size());
fragIdx++)
{
- List<R4Library> libs =
+ List<NativeLibrary> libs =
((BundleRevisionImpl) m_fragments.get(fragIdx))
.getDeclaredNativeLibraries();
for (int reqIdx = 0;
@@ -586,7 +586,7 @@
return null;
}
- public List<R4Library> getNativeLibraries()
+ public List<NativeLibrary> getNativeLibraries()
{
return m_resolvedNativeLibs;
}
@@ -2581,7 +2581,7 @@
// native library.
if (result == null)
{
- List<R4Library> libs = m_wiring.getNativeLibraries();
+ List<NativeLibrary> libs = m_wiring.getNativeLibraries();
for (int libIdx = 0; (libs != null) && (libIdx < libs.size()); libIdx++)
{
if (libs.get(libIdx).match(m_wiring.m_configMap, name))
diff --git a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
index 151c8fb..f146e7a 100644
--- a/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
+++ b/framework/src/main/java/org/apache/felix/framework/ExtensionManager.java
@@ -44,8 +44,8 @@
import org.apache.felix.framework.util.StringMap;
import org.apache.felix.framework.util.Util;
import org.apache.felix.framework.util.manifestparser.ManifestParser;
-import org.apache.felix.framework.util.manifestparser.R4Library;
-import org.apache.felix.framework.util.manifestparser.R4LibraryClause;
+import org.apache.felix.framework.util.manifestparser.NativeLibrary;
+import org.apache.felix.framework.util.manifestparser.NativeLibraryClause;
import org.apache.felix.framework.wiring.BundleCapabilityImpl;
import org.apache.felix.framework.wiring.BundleWireImpl;
import org.osgi.framework.AdminPermission;
@@ -258,17 +258,17 @@
if( osArchitecture != null )
{
- attributes.put(NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE, R4LibraryClause.getProcessorWithAliases(osArchitecture));
+ attributes.put(NativeNamespace.CAPABILITY_PROCESSOR_ATTRIBUTE, NativeLibraryClause.getProcessorWithAliases(osArchitecture));
}
if( osName != null)
{
- attributes.put(NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE, R4LibraryClause.getOsNameWithAliases(osName));
+ attributes.put(NativeNamespace.CAPABILITY_OSNAME_ATTRIBUTE, NativeLibraryClause.getOsNameWithAliases(osName));
}
if( osVersion != null)
{
- osVersion = R4LibraryClause.formatOSVersion(osVersion);
+ osVersion = NativeLibraryClause.formatOSVersion(osVersion);
attributes.put(NativeNamespace.CAPABILITY_OSVERSION_ATTRIBUTE, Version.parseVersion(osVersion));
}
@@ -877,7 +877,7 @@
}
@Override
- public List<R4Library> getNativeLibraries()
+ public List<NativeLibrary> getNativeLibraries()
{
return Collections.EMPTY_LIST;
}
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 26362d7..b7205fc 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -67,7 +67,7 @@
import org.apache.felix.framework.util.StringMap;
import org.apache.felix.framework.util.ThreadGate;
import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.util.manifestparser.R4LibraryClause;
+import org.apache.felix.framework.util.manifestparser.NativeLibraryClause;
import org.apache.felix.framework.wiring.BundleRequirementImpl;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
@@ -4553,9 +4553,9 @@
"false");
String s = null;
- s = R4LibraryClause.normalizeOSName(System.getProperty("os.name"));
+ s = NativeLibraryClause.normalizeOSName(System.getProperty("os.name"));
m_configMutableMap.put(FelixConstants.FRAMEWORK_OS_NAME, s);
- s = R4LibraryClause.normalizeProcessor(System.getProperty("os.arch"));
+ s = NativeLibraryClause.normalizeProcessor(System.getProperty("os.arch"));
m_configMutableMap.put(FelixConstants.FRAMEWORK_PROCESSOR, s);
m_configMutableMap.put(
FelixConstants.FELIX_VERSION_PROPERTY, getFrameworkVersion());
diff --git a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
index ae3bcfc..11464a1 100644
--- a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
@@ -41,7 +41,7 @@
import org.apache.felix.framework.resolver.ResolverWire;
import org.apache.felix.framework.util.ShrinkableCollection;
import org.apache.felix.framework.util.Util;
-import org.apache.felix.framework.util.manifestparser.R4Library;
+import org.apache.felix.framework.util.manifestparser.NativeLibrary;
import org.apache.felix.framework.wiring.BundleRequirementImpl;
import org.apache.felix.framework.wiring.BundleWireImpl;
import org.osgi.framework.Bundle;
@@ -1482,7 +1482,7 @@
{
// Next, try to resolve any native code, since the revision is
// not resolvable if its native code cannot be loaded.
- List<R4Library> libs = ((BundleRevisionImpl) revision).getDeclaredNativeLibraries();
+ List<NativeLibrary> libs = ((BundleRevisionImpl) revision).getDeclaredNativeLibraries();
if (libs != null)
{
String msg = null;
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
index 1cf00b2..47e80a2 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/ManifestParser.java
@@ -62,7 +62,7 @@
private volatile Version m_bundleVersion;
private volatile List<BundleCapability> m_capabilities;
private volatile List<BundleRequirement> m_requirements;
- private volatile List<R4LibraryClause> m_libraryClauses;
+ private volatile List<NativeLibraryClause> m_libraryClauses;
private volatile boolean m_libraryHeadersOptional = false;
public ManifestParser(Logger logger, Map configMap, BundleRevision owner, Map headerMap)
@@ -607,7 +607,7 @@
return reqList;
}
- static List<BundleRequirement> convertNativeCode(BundleRevision owner, List<R4LibraryClause> nativeLibraryClauses, boolean hasOptionalLibraryDirective)
+ static List<BundleRequirement> convertNativeCode(BundleRevision owner, List<NativeLibraryClause> nativeLibraryClauses, boolean hasOptionalLibraryDirective)
{
List<BundleRequirement> result = new ArrayList<BundleRequirement>();
@@ -615,7 +615,7 @@
if(nativeLibraryClauses != null)
{
- for(R4LibraryClause clause: nativeLibraryClauses)
+ for(NativeLibraryClause clause: nativeLibraryClauses)
{
String[] osNameArray = clause.getOSNames();
String[] osVersionArray = clause.getOSVersions();
@@ -1071,7 +1071,7 @@
return m_requirements;
}
- public List<R4LibraryClause> getLibraryClauses()
+ public List<NativeLibraryClause> getLibraryClauses()
{
return m_libraryClauses;
}
@@ -1093,25 +1093,25 @@
* <li><tt>null</tt> - if the are no native libraries for this module;
* this may also indicate the native libraries are optional and
* did not match the current platform.</li>
- * <li>Zero-length <tt>R4Library</tt> array - if no matching native library
+ * <li>Zero-length <tt>NativeLibrary</tt> array - if no matching native library
* clause was found; this bundle should not resolve.</li>
- * <li>Nonzero-length <tt>R4Library</tt> array - the native libraries
+ * <li>Nonzero-length <tt>NativeLibrary</tt> array - the native libraries
* associated with the matching native library clause.</li>
* </ul>
*
* @return <tt>null</tt> if there are no native libraries, a zero-length
* array if no libraries matched, or an array of selected libraries.
**/
- public List<R4Library> getLibraries()
+ public List<NativeLibrary> getLibraries()
{
- ArrayList<R4Library> libs = null;
+ ArrayList<NativeLibrary> libs = null;
try
{
- R4LibraryClause clause = getSelectedLibraryClause();
+ NativeLibraryClause clause = getSelectedLibraryClause();
if (clause != null)
{
String[] entries = clause.getLibraryEntries();
- libs = new ArrayList<R4Library>(entries.length);
+ libs = new ArrayList<NativeLibrary>(entries.length);
int current = 0;
for (int i = 0; i < entries.length; i++)
{
@@ -1123,7 +1123,7 @@
}
if (!found)
{
- libs.add(new R4Library(
+ libs.add(new NativeLibrary(
clause.getLibraryEntries()[i],
clause.getOSNames(), clause.getProcessors(), clause.getOSVersions(),
clause.getLanguages(), clause.getSelectionFilter()));
@@ -1134,7 +1134,7 @@
}
catch (Exception ex)
{
- libs = new ArrayList<R4Library>(0);
+ libs = new ArrayList<NativeLibrary>(0);
}
return libs;
}
@@ -1149,14 +1149,14 @@
return path;
}
- private R4LibraryClause getSelectedLibraryClause() throws BundleException
+ private NativeLibraryClause getSelectedLibraryClause() throws BundleException
{
if ((m_libraryClauses != null) && (m_libraryClauses.size() > 0))
{
List clauseList = new ArrayList();
// Search for matching native clauses.
- for (R4LibraryClause libraryClause : m_libraryClauses)
+ for (NativeLibraryClause libraryClause : m_libraryClauses)
{
if (libraryClause.match(m_configMap))
{
@@ -1186,13 +1186,13 @@
{
selected = firstSortedClause(clauseList);
}
- return ((R4LibraryClause) clauseList.get(selected));
+ return ((NativeLibraryClause) clauseList.get(selected));
}
return null;
}
- private int firstSortedClause(List<R4LibraryClause> clauseList)
+ private int firstSortedClause(List<NativeLibraryClause> clauseList)
{
ArrayList indexList = new ArrayList();
ArrayList selection = new ArrayList();
@@ -1209,7 +1209,7 @@
for (int i = 0; i < indexList.size(); i++)
{
int index = Integer.parseInt(indexList.get(i).toString());
- String[] osversions = ((R4LibraryClause) clauseList.get(index)).getOSVersions();
+ String[] osversions = ((NativeLibraryClause) clauseList.get(index)).getOSVersions();
if (osversions != null)
{
selection.add("" + indexList.get(i));
@@ -1237,7 +1237,7 @@
for (int i = 0; i < indexList.size(); i++)
{
int index = Integer.parseInt(indexList.get(i).toString());
- String[] osversions = ((R4LibraryClause) clauseList.get(index)).getOSVersions();
+ String[] osversions = ((NativeLibraryClause) clauseList.get(index)).getOSVersions();
for (int k = 0; k < osversions.length; k++)
{
VersionRange range = VersionRange.parse(osversions[k]);
@@ -1273,7 +1273,7 @@
for (int i = 0; i < indexList.size(); i++)
{
int index = Integer.parseInt(indexList.get(i).toString());
- if (((R4LibraryClause) clauseList.get(index)).getLanguages() != null)
+ if (((NativeLibraryClause) clauseList.get(index)).getLanguages() != null)
{
selection.add("" + indexList.get(i));
}
@@ -2164,20 +2164,20 @@
* @return an array of <tt>LibraryInfo</tt> objects for the
* passed in strings.
**/
- private static List<R4LibraryClause> parseLibraryStrings(
+ private static List<NativeLibraryClause> parseLibraryStrings(
Logger logger, List<String> libStrs)
throws IllegalArgumentException
{
if (libStrs == null)
{
- return new ArrayList<R4LibraryClause>(0);
+ return new ArrayList<NativeLibraryClause>(0);
}
- List<R4LibraryClause> libList = new ArrayList(libStrs.size());
+ List<NativeLibraryClause> libList = new ArrayList(libStrs.size());
for (int i = 0; i < libStrs.size(); i++)
{
- R4LibraryClause clause = R4LibraryClause.parse(logger, libStrs.get(i));
+ NativeLibraryClause clause = NativeLibraryClause.parse(logger, libStrs.get(i));
libList.add(clause);
}
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibrary.java
similarity index 98%
rename from framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
rename to framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibrary.java
index e82c2a1..fbb3a1e 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4Library.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibrary.java
@@ -23,7 +23,7 @@
import java.util.Map;
import org.osgi.framework.Constants;
-public class R4Library
+public class NativeLibrary
{
private String m_libraryFile;
private String[] m_osnames;
@@ -32,7 +32,7 @@
private String[] m_languages;
private String m_selectionFilter;
- public R4Library(
+ public NativeLibrary(
String libraryFile, String[] osnames, String[] processors, String[] osversions,
String[] languages, String selectionFilter) throws Exception
{
diff --git a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
similarity index 98%
rename from framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
rename to framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
index b59d18b..5c46f0e 100644
--- a/framework/src/main/java/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java
+++ b/framework/src/main/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClause.java
@@ -42,7 +42,7 @@
import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.Version;
-public class R4LibraryClause
+public class NativeLibraryClause
{
private static final String OS_AIX = "aix";
private static final String OS_DIGITALUNIX = "digitalunix";
@@ -133,7 +133,7 @@
private final String[] m_languages;
private final String m_selectionFilter;
- public R4LibraryClause(String[] libraryEntries, String[] osnames,
+ public NativeLibraryClause(String[] libraryEntries, String[] osnames,
String[] processors, String[] osversions, String[] languages,
String selectionFilter)
{
@@ -145,7 +145,7 @@
m_selectionFilter = selectionFilter;
}
- public R4LibraryClause(R4LibraryClause library)
+ public NativeLibraryClause(NativeLibraryClause library)
{
this(library.m_libraryEntries, library.m_osnames, library.m_osversions,
library.m_processors, library.m_languages,
@@ -319,7 +319,7 @@
}
}
- public static R4LibraryClause parse(Logger logger, String s)
+ public static NativeLibraryClause parse(Logger logger, String s)
{
try
{
@@ -331,7 +331,7 @@
s = s.trim();
if (s.equals(FelixConstants.BUNDLE_NATIVECODE_OPTIONAL))
{
- return new R4LibraryClause(null, null, null, null, null, null);
+ return new NativeLibraryClause(null, null, null, null, null, null);
}
// The tokens are separated by semicolons and may include
@@ -432,7 +432,7 @@
// Shrink lib file array.
String[] actualLibEntries = new String[libCount];
System.arraycopy(libEntries, 0, actualLibEntries, 0, libCount);
- return new R4LibraryClause(
+ return new NativeLibraryClause(
actualLibEntries,
(String[]) osNameList.toArray(new String[osNameList.size()]),
(String[]) processorList.toArray(new String[processorList.size()]),
diff --git a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/ManifestParserTest.java b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/ManifestParserTest.java
index 3d826f4..6fee6e6 100644
--- a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/ManifestParserTest.java
+++ b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/ManifestParserTest.java
@@ -112,14 +112,14 @@
public void testConvertNativeCode() throws InvalidSyntaxException
{
- List<R4LibraryClause> nativeLibraryClauses = new ArrayList<R4LibraryClause>();
+ List<NativeLibraryClause> nativeLibraryClauses = new ArrayList<NativeLibraryClause>();
String[] libraryFiles = {"lib/http.dll", "lib/zlib.dll"};
String[] osNames = {"Windows95", "Windows98", "WindowsNT"};
String[] processors = {"x86"};
String[] osVersions = null;
String[] languages = {"en", "se"};
String selectionFilter = "(com.acme.windowing=win32)";
- R4LibraryClause clause = new R4LibraryClause(libraryFiles, osNames, processors, osVersions, languages, selectionFilter);
+ NativeLibraryClause clause = new NativeLibraryClause(libraryFiles, osNames, processors, osVersions, languages, selectionFilter);
BundleRevision owner = mock(BundleRevision.class);
nativeLibraryClauses.add(clause);
diff --git a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java
new file mode 100644
index 0000000..505697a
--- /dev/null
+++ b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/NativeLibraryClauseTest.java
@@ -0,0 +1,145 @@
+/*
+ * 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.framework.util.manifestparser;
+
+import junit.framework.TestCase;
+
+public class NativeLibraryClauseTest extends TestCase {
+ public void testNormalizeOSName() {
+ assertEquals("win32", NativeLibraryClause.normalizeOSName("win 32"));
+ assertEquals("win32", NativeLibraryClause.normalizeOSName("Win*"));
+ assertEquals("windows95", NativeLibraryClause.normalizeOSName("Windows 95"));
+ assertEquals("windows98", NativeLibraryClause.normalizeOSName("Windows 98"));
+ assertEquals("windowsnt", NativeLibraryClause.normalizeOSName("WinNT"));
+ assertEquals("windows2000", NativeLibraryClause.normalizeOSName("Win2000"));
+ assertEquals("windows2003", NativeLibraryClause.normalizeOSName("Win2003"));
+ assertEquals("windowsserver2008", NativeLibraryClause.normalizeOSName("Windows Server 2008"));
+ assertEquals("windowsserver2012", NativeLibraryClause.normalizeOSName("Windows Server 2012"));
+ assertEquals("windowsxp", NativeLibraryClause.normalizeOSName("WinXP"));
+ assertEquals("windowsce", NativeLibraryClause.normalizeOSName("WinCE"));
+ assertEquals("windowsvista", NativeLibraryClause.normalizeOSName("WinVista"));
+ assertEquals("windows7", NativeLibraryClause.normalizeOSName("Windows 7"));
+ assertEquals("windows8", NativeLibraryClause.normalizeOSName("Win8"));
+ assertEquals("linux", NativeLibraryClause.normalizeOSName("Linux1.2.3"));
+ assertEquals("aix", NativeLibraryClause.normalizeOSName("AIX-4.5.6"));
+ assertEquals("digitalunix", NativeLibraryClause.normalizeOSName("digitalunix_blah"));
+ assertEquals("hpux", NativeLibraryClause.normalizeOSName("HPUX-999"));
+ assertEquals("irix", NativeLibraryClause.normalizeOSName("Irixxxx"));
+ assertEquals("macosx", NativeLibraryClause.normalizeOSName("mac OS X"));
+ assertEquals("netware", NativeLibraryClause.normalizeOSName("Netware"));
+ assertEquals("openbsd", NativeLibraryClause.normalizeOSName("OpenBSD-0000"));
+ assertEquals("netbsd", NativeLibraryClause.normalizeOSName("netbsd "));
+ assertEquals("os2", NativeLibraryClause.normalizeOSName("os/2"));
+ assertEquals("qnx", NativeLibraryClause.normalizeOSName("procnto"));
+ assertEquals("solaris", NativeLibraryClause.normalizeOSName("Solaris 9"));
+ assertEquals("sunos", NativeLibraryClause.normalizeOSName("SunOS8"));
+ assertEquals("vxworks", NativeLibraryClause.normalizeOSName("VxWorks"));
+
+ // Try all the already normalized names
+ assertEquals("aix", NativeLibraryClause.normalizeOSName("aix"));
+ assertEquals("digitalunix", NativeLibraryClause.normalizeOSName("digitalunix"));
+ assertEquals("hpux", NativeLibraryClause.normalizeOSName("hpux"));
+ assertEquals("irix", NativeLibraryClause.normalizeOSName("irix"));
+ assertEquals("linux", NativeLibraryClause.normalizeOSName("linux"));
+ assertEquals("macos", NativeLibraryClause.normalizeOSName("macos"));
+ assertEquals("netbsd", NativeLibraryClause.normalizeOSName("netbsd"));
+ assertEquals("netware", NativeLibraryClause.normalizeOSName("netware"));
+ assertEquals("openbsd", NativeLibraryClause.normalizeOSName("openbsd"));
+ assertEquals("os2", NativeLibraryClause.normalizeOSName("os2"));
+ assertEquals("qnx", NativeLibraryClause.normalizeOSName("qnx"));
+ assertEquals("solaris", NativeLibraryClause.normalizeOSName("solaris"));
+ assertEquals("sunos", NativeLibraryClause.normalizeOSName("sunos"));
+ assertEquals("vxworks", NativeLibraryClause.normalizeOSName("vxworks"));
+ assertEquals("windows2000", NativeLibraryClause.normalizeOSName("windows2000"));
+ assertEquals("windows2003", NativeLibraryClause.normalizeOSName("windows2003"));
+ assertEquals("windows7", NativeLibraryClause.normalizeOSName("windows7"));
+ assertEquals("windows8", NativeLibraryClause.normalizeOSName("windows8"));
+ assertEquals("windows9", NativeLibraryClause.normalizeOSName("windows9"));
+ assertEquals("windows95", NativeLibraryClause.normalizeOSName("windows95"));
+ assertEquals("windows98", NativeLibraryClause.normalizeOSName("windows98"));
+ assertEquals("windowsce", NativeLibraryClause.normalizeOSName("windowsce"));
+ assertEquals("windowsnt", NativeLibraryClause.normalizeOSName("windowsnt"));
+ assertEquals("windowsserver2008", NativeLibraryClause.normalizeOSName("windowsserver2008"));
+ assertEquals("windowsserver2012", NativeLibraryClause.normalizeOSName("windowsserver2012"));
+ assertEquals("windowsvista", NativeLibraryClause.normalizeOSName("windowsvista"));
+ assertEquals("windowsxp", NativeLibraryClause.normalizeOSName("windowsxp"));
+ assertEquals("win32", NativeLibraryClause.normalizeOSName("win32"));
+ }
+
+ public void testgetOsNameWithAliases() {
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("win 32").contains("win32"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Win*").contains("win32"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows 95").contains("windows95"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows 98").contains("windows98"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("WinNT").contains("windowsnt"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Win2000").contains("windows2000"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Win2003").contains("windows2003"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows Server 2008").contains("windowsserver2008"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows Server 2012").contains("windowsserver2012"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("WinXP").contains("windowsxp"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("WinCE").contains("windowsce"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("WinVista").contains("windowsvista"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Windows 7").contains("windows7"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Win8").contains("windows8"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Linux1.2.3").contains("linux"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("AIX-4.5.6").contains("aix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("digitalunix_blah").contains("digitalunix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("HPUX-999").contains("hpux"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Irixxxx").contains("irix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("mac OS X").contains("mac os x"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Netware").contains("netware"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("OpenBSD-0000").contains("openbsd"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("netbsd ").contains("netbsd"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("os/2").contains("os2"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("procnto").contains("qnx"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("Solaris 9").contains("solaris"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("SunOS8").contains("sunos"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("VxWorks").contains("vxworks"));
+
+ // Try all the already normalized names
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("aix").contains("aix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("digitalunix").contains("digitalunix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("hpux").contains("hpux"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("irix").contains("irix"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("linux").contains("linux"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("mac os").contains("mac os"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("netbsd").contains("netbsd"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("netware").contains("netware"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("openbsd").contains("openbsd"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("os2").contains("os2"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("qnx").contains("qnx"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("solaris").contains("solaris"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("sunos").contains("sunos"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("vxworks").contains("vxworks"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows2000").contains("windows2000"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows2003").contains("windows2003"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows7").contains("windows7"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows8").contains("windows8"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows9").contains("windows9"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows95").contains("windows95"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windows98").contains("windows98"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsce").contains("windowsce"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsnt").contains("windowsnt"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsserver2008").contains("windowsserver2008"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsserver2012").contains("windowsserver2012"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsvista").contains("windowsvista"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("windowsxp").contains("windowsxp"));
+ assertTrue(NativeLibraryClause.getOsNameWithAliases("win32").contains("win32"));
+ }
+}
diff --git a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/R4LibraryClauseTest.java b/framework/src/test/java/org/apache/felix/framework/util/manifestparser/R4LibraryClauseTest.java
deleted file mode 100644
index 70ee7e8..0000000
--- a/framework/src/test/java/org/apache/felix/framework/util/manifestparser/R4LibraryClauseTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.framework.util.manifestparser;
-
-import junit.framework.TestCase;
-
-public class R4LibraryClauseTest extends TestCase {
- public void testNormalizeOSName() {
- assertEquals("win32", R4LibraryClause.normalizeOSName("win 32"));
- assertEquals("win32", R4LibraryClause.normalizeOSName("Win*"));
- assertEquals("windows95", R4LibraryClause.normalizeOSName("Windows 95"));
- assertEquals("windows98", R4LibraryClause.normalizeOSName("Windows 98"));
- assertEquals("windowsnt", R4LibraryClause.normalizeOSName("WinNT"));
- assertEquals("windows2000", R4LibraryClause.normalizeOSName("Win2000"));
- assertEquals("windows2003", R4LibraryClause.normalizeOSName("Win2003"));
- assertEquals("windowsserver2008", R4LibraryClause.normalizeOSName("Windows Server 2008"));
- assertEquals("windowsserver2012", R4LibraryClause.normalizeOSName("Windows Server 2012"));
- assertEquals("windowsxp", R4LibraryClause.normalizeOSName("WinXP"));
- assertEquals("windowsce", R4LibraryClause.normalizeOSName("WinCE"));
- assertEquals("windowsvista", R4LibraryClause.normalizeOSName("WinVista"));
- assertEquals("windows7", R4LibraryClause.normalizeOSName("Windows 7"));
- assertEquals("windows8", R4LibraryClause.normalizeOSName("Win8"));
- assertEquals("linux", R4LibraryClause.normalizeOSName("Linux1.2.3"));
- assertEquals("aix", R4LibraryClause.normalizeOSName("AIX-4.5.6"));
- assertEquals("digitalunix", R4LibraryClause.normalizeOSName("digitalunix_blah"));
- assertEquals("hpux", R4LibraryClause.normalizeOSName("HPUX-999"));
- assertEquals("irix", R4LibraryClause.normalizeOSName("Irixxxx"));
- assertEquals("macosx", R4LibraryClause.normalizeOSName("mac OS X"));
- assertEquals("netware", R4LibraryClause.normalizeOSName("Netware"));
- assertEquals("openbsd", R4LibraryClause.normalizeOSName("OpenBSD-0000"));
- assertEquals("netbsd", R4LibraryClause.normalizeOSName("netbsd "));
- assertEquals("os2", R4LibraryClause.normalizeOSName("os/2"));
- assertEquals("qnx", R4LibraryClause.normalizeOSName("procnto"));
- assertEquals("solaris", R4LibraryClause.normalizeOSName("Solaris 9"));
- assertEquals("sunos", R4LibraryClause.normalizeOSName("SunOS8"));
- assertEquals("vxworks", R4LibraryClause.normalizeOSName("VxWorks"));
-
- // Try all the already normalized names
- assertEquals("aix", R4LibraryClause.normalizeOSName("aix"));
- assertEquals("digitalunix", R4LibraryClause.normalizeOSName("digitalunix"));
- assertEquals("hpux", R4LibraryClause.normalizeOSName("hpux"));
- assertEquals("irix", R4LibraryClause.normalizeOSName("irix"));
- assertEquals("linux", R4LibraryClause.normalizeOSName("linux"));
- assertEquals("macos", R4LibraryClause.normalizeOSName("macos"));
- assertEquals("netbsd", R4LibraryClause.normalizeOSName("netbsd"));
- assertEquals("netware", R4LibraryClause.normalizeOSName("netware"));
- assertEquals("openbsd", R4LibraryClause.normalizeOSName("openbsd"));
- assertEquals("os2", R4LibraryClause.normalizeOSName("os2"));
- assertEquals("qnx", R4LibraryClause.normalizeOSName("qnx"));
- assertEquals("solaris", R4LibraryClause.normalizeOSName("solaris"));
- assertEquals("sunos", R4LibraryClause.normalizeOSName("sunos"));
- assertEquals("vxworks", R4LibraryClause.normalizeOSName("vxworks"));
- assertEquals("windows2000", R4LibraryClause.normalizeOSName("windows2000"));
- assertEquals("windows2003", R4LibraryClause.normalizeOSName("windows2003"));
- assertEquals("windows7", R4LibraryClause.normalizeOSName("windows7"));
- assertEquals("windows8", R4LibraryClause.normalizeOSName("windows8"));
- assertEquals("windows9", R4LibraryClause.normalizeOSName("windows9"));
- assertEquals("windows95", R4LibraryClause.normalizeOSName("windows95"));
- assertEquals("windows98", R4LibraryClause.normalizeOSName("windows98"));
- assertEquals("windowsce", R4LibraryClause.normalizeOSName("windowsce"));
- assertEquals("windowsnt", R4LibraryClause.normalizeOSName("windowsnt"));
- assertEquals("windowsserver2008", R4LibraryClause.normalizeOSName("windowsserver2008"));
- assertEquals("windowsserver2012", R4LibraryClause.normalizeOSName("windowsserver2012"));
- assertEquals("windowsvista", R4LibraryClause.normalizeOSName("windowsvista"));
- assertEquals("windowsxp", R4LibraryClause.normalizeOSName("windowsxp"));
- assertEquals("win32", R4LibraryClause.normalizeOSName("win32"));
- }
-
- public void testgetOsNameWithAliases() {
- assertTrue(R4LibraryClause.getOsNameWithAliases("win 32").contains("win32"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Win*").contains("win32"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Windows 95").contains("windows95"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Windows 98").contains("windows98"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("WinNT").contains("windowsnt"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Win2000").contains("windows2000"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Win2003").contains("windows2003"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Windows Server 2008").contains("windowsserver2008"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Windows Server 2012").contains("windowsserver2012"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("WinXP").contains("windowsxp"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("WinCE").contains("windowsce"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("WinVista").contains("windowsvista"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Windows 7").contains("windows7"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Win8").contains("windows8"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Linux1.2.3").contains("linux"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("AIX-4.5.6").contains("aix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("digitalunix_blah").contains("digitalunix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("HPUX-999").contains("hpux"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Irixxxx").contains("irix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("mac OS X").contains("mac os x"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Netware").contains("netware"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("OpenBSD-0000").contains("openbsd"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("netbsd ").contains("netbsd"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("os/2").contains("os2"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("procnto").contains("qnx"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("Solaris 9").contains("solaris"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("SunOS8").contains("sunos"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("VxWorks").contains("vxworks"));
-
- // Try all the already normalized names
- assertTrue(R4LibraryClause.getOsNameWithAliases("aix").contains("aix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("digitalunix").contains("digitalunix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("hpux").contains("hpux"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("irix").contains("irix"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("linux").contains("linux"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("mac os").contains("mac os"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("netbsd").contains("netbsd"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("netware").contains("netware"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("openbsd").contains("openbsd"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("os2").contains("os2"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("qnx").contains("qnx"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("solaris").contains("solaris"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("sunos").contains("sunos"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("vxworks").contains("vxworks"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows2000").contains("windows2000"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows2003").contains("windows2003"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows7").contains("windows7"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows8").contains("windows8"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows9").contains("windows9"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows95").contains("windows95"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windows98").contains("windows98"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsce").contains("windowsce"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsnt").contains("windowsnt"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsserver2008").contains("windowsserver2008"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsserver2012").contains("windowsserver2012"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsvista").contains("windowsvista"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("windowsxp").contains("windowsxp"));
- assertTrue(R4LibraryClause.getOsNameWithAliases("win32").contains("win32"));
- }
-}