OSDN Git Service

Fix unit tests from the previous refactor.
authorXavier Ducrohet <xav@android.com>
Fri, 18 Mar 2011 19:13:51 +0000 (12:13 -0700)
committerXavier Ducrohet <xav@android.com>
Fri, 18 Mar 2011 19:13:51 +0000 (12:13 -0700)
Change-Id: I464fe3f94e701e619b474f82aaf84ee04d158e71

20 files changed:
eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/ConfigMatchTest.java
eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java [deleted file]
ide_common/tests/.classpath [new file with mode: 0644]
ide_common/tests/.project [new file with mode: 0644]
ide_common/tests/Android.mk [new file with mode: 0644]
ide_common/tests/src/com/android/ide/common/resources/configuration/CountryCodeQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/CountryCodeQualifierTest.java with 82% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/DockModeQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/DockModeQualifierTest.java with 89% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/FolderConfigurationTest.java [new file with mode: 0644]
ide_common/tests/src/com/android/ide/common/resources/configuration/KeyboardStateQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/KeyboardStateQualifierTest.java with 84% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/LanguageQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/LanguageQualifierTest.java with 79% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/NavigationMethodQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NavigationMethodQualifierTest.java with 86% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/NetworkCodeQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/NetworkCodeQualifierTest.java with 82% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/PixelDensityQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/PixelDensityQualifierTest.java with 92% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/RegionQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/RegionQualifierTest.java with 82% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenDimensionQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenDimensionQualifierTest.java with 84% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenOrientationQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenOrientationQualifierTest.java with 87% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/ScreenSizeQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/ScreenSizeQualifierTest.java with 87% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/TextInputMethodQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TextInputMethodQualifierTest.java with 87% similarity]
ide_common/tests/src/com/android/ide/common/resources/configuration/TouchScreenQualifierTest.java [moved from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/configurations/TouchScreenQualifierTest.java with 86% similarity]

index 7672a6a..73d3c93 100644 (file)
@@ -19,6 +19,7 @@ package com.android.ide.eclipse.adt.internal.resources;
 import com.android.ide.common.resources.ResourceDeltaKind;
 import com.android.ide.common.resources.configuration.CountryCodeQualifier;
 import com.android.ide.common.resources.configuration.DockModeQualifier;
+import com.android.ide.common.resources.configuration.FolderConfiguration;
 import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
 import com.android.ide.common.resources.configuration.LanguageQualifier;
 import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
@@ -48,60 +49,35 @@ import java.util.Map;
  */
 public class ResourceHelper {
 
-    private final static Map<Class<?>, Image> ICON_MAP = new HashMap<Class<?>, Image>(20);
+    private final static Map<Class<?>, Image> sIconMap = new HashMap<Class<?>, Image>(
+            FolderConfiguration.getQualifierCount());
+
+    static {
+        IconFactory factory = IconFactory.getInstance();
+        sIconMap.put(CountryCodeQualifier.class,       factory.getIcon("mcc")); //$NON-NLS-1$
+        sIconMap.put(NetworkCodeQualifier.class,       factory.getIcon("mnc")); //$NON-NLS-1$
+        sIconMap.put(LanguageQualifier.class,          factory.getIcon("language")); //$NON-NLS-1$
+        sIconMap.put(RegionQualifier.class,            factory.getIcon("region")); //$NON-NLS-1$
+        sIconMap.put(ScreenSizeQualifier.class,        factory.getIcon("size")); //$NON-NLS-1$
+        sIconMap.put(ScreenRatioQualifier.class,       factory.getIcon("ratio")); //$NON-NLS-1$
+        sIconMap.put(ScreenOrientationQualifier.class, factory.getIcon("orientation")); //$NON-NLS-1$
+        sIconMap.put(DockModeQualifier.class,          factory.getIcon("dockmode")); //$NON-NLS-1$
+        sIconMap.put(NightModeQualifier.class,         factory.getIcon("nightmode")); //$NON-NLS-1$
+        sIconMap.put(PixelDensityQualifier.class,      factory.getIcon("dpi")); //$NON-NLS-1$
+        sIconMap.put(TouchScreenQualifier.class,       factory.getIcon("touch")); //$NON-NLS-1$
+        sIconMap.put(KeyboardStateQualifier.class,     factory.getIcon("keyboard")); //$NON-NLS-1$
+        sIconMap.put(TextInputMethodQualifier.class,   factory.getIcon("text_input")); //$NON-NLS-1$
+        sIconMap.put(NavigationStateQualifier.class,   factory.getIcon("navpad")); //$NON-NLS-1$
+        sIconMap.put(NavigationMethodQualifier.class,  factory.getIcon("navpad")); //$NON-NLS-1$
+        sIconMap.put(ScreenDimensionQualifier.class,   factory.getIcon("dimension")); //$NON-NLS-1$
+        sIconMap.put(VersionQualifier.class,           factory.getIcon("version")); //$NON-NLS-1$
+    }
 
     /**
      * Returns the icon for the qualifier.
      */
     public static Image getIcon(Class<? extends ResourceQualifier> theClass) {
-        Image image = ICON_MAP.get(theClass);
-        if (image == null) {
-            image = computeImage(theClass);
-            ICON_MAP.put(theClass, image);
-        }
-
-        return image;
-    }
-
-    private static Image computeImage(Class<? extends ResourceQualifier> theClass) {
-        if (theClass == CountryCodeQualifier.class) {
-            return IconFactory.getInstance().getIcon("mcc"); //$NON-NLS-1$
-        } else if (theClass == NetworkCodeQualifier.class) {
-            return IconFactory.getInstance().getIcon("mnc"); //$NON-NLS-1$
-        } else if (theClass == LanguageQualifier.class) {
-            return IconFactory.getInstance().getIcon("language"); //$NON-NLS-1$
-        } else if (theClass == RegionQualifier.class) {
-            return IconFactory.getInstance().getIcon("region"); //$NON-NLS-1$
-        } else if (theClass == ScreenSizeQualifier.class) {
-            return IconFactory.getInstance().getIcon("size"); //$NON-NLS-1$
-        } else if (theClass == ScreenRatioQualifier.class) {
-            return IconFactory.getInstance().getIcon("ratio"); //$NON-NLS-1$
-        } else if (theClass == ScreenOrientationQualifier.class) {
-            return IconFactory.getInstance().getIcon("orientation"); //$NON-NLS-1$
-        } else if (theClass == DockModeQualifier.class) {
-            return IconFactory.getInstance().getIcon("dockmode"); //$NON-NLS-1$
-        } else if (theClass == NightModeQualifier.class) {
-            return IconFactory.getInstance().getIcon("nightmode"); //$NON-NLS-1$
-        } else if (theClass == PixelDensityQualifier.class) {
-            return IconFactory.getInstance().getIcon("dpi"); //$NON-NLS-1$
-        } else if (theClass == TouchScreenQualifier.class) {
-            return IconFactory.getInstance().getIcon("touch"); //$NON-NLS-1$
-        } else if (theClass == KeyboardStateQualifier.class) {
-            return IconFactory.getInstance().getIcon("keyboard"); //$NON-NLS-1$
-        } else if (theClass == TextInputMethodQualifier.class) {
-            return IconFactory.getInstance().getIcon("text_input"); //$NON-NLS-1$
-        } else if (theClass == NavigationStateQualifier.class) {
-            return IconFactory.getInstance().getIcon("navpad"); //$NON-NLS-1$
-        } else if (theClass == NavigationMethodQualifier.class) {
-            return IconFactory.getInstance().getIcon("navpad"); //$NON-NLS-1$
-        } else if (theClass == ScreenDimensionQualifier.class) {
-            return IconFactory.getInstance().getIcon("dimension"); //$NON-NLS-1$
-        } else if (theClass == VersionQualifier.class) {
-            return IconFactory.getInstance().getIcon("version"); //$NON-NLS-1$
-        }
-
-        // this can only happen if we forget to add a class above.
-        return null;
+        return sIconMap.get(theClass);
     }
 
     /**
index 3551d6f..f2a6b54 100644 (file)
@@ -21,13 +21,10 @@ import com.android.ide.common.resources.ResourceFolder;
 import com.android.ide.common.resources.ResourceRepository;
 import com.android.ide.common.resources.SingleResourceFile;
 import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.ResourceQualifier;
 import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
 import com.android.ide.eclipse.adt.io.IFileWrapper;
 import com.android.ide.eclipse.adt.io.IFolderWrapper;
 import com.android.ide.eclipse.mock.Mocks;
-import com.android.io.IAbstractFolder;
 import com.android.resources.DockMode;
 import com.android.resources.Keyboard;
 import com.android.resources.KeyboardState;
@@ -41,9 +38,6 @@ import com.android.resources.TouchScreen;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
 import junit.framework.TestCase;
 
 public class ConfigMatchTest extends TestCase {
@@ -51,8 +45,8 @@ public class ConfigMatchTest extends TestCase {
     private static final String MISC1_FILENAME = "foo.xml"; //$NON-NLS-1$
     private static final String MISC2_FILENAME = "bar.xml"; //$NON-NLS-1$
 
+    private FolderConfiguration mDefaultConfig;
     private ProjectResources mResources;
-    private ResourceQualifier[] mQualifierList;
     private FolderConfiguration config4;
     private FolderConfiguration config3;
     private FolderConfiguration config2;
@@ -62,15 +56,9 @@ public class ConfigMatchTest extends TestCase {
     protected void setUp() throws Exception {
         super.setUp();
 
-        // create a Resource Manager to get a list of qualifier as instantiated by the real code.
-        // Thanks for QualifierListTest we know this contains all the qualifiers.
-        ResourceManager manager = ResourceManager.getInstance();
-        Field qualifierListField = ResourceManager.class.getDeclaredField("mQualifiers");
-        assertNotNull(qualifierListField);
-        qualifierListField.setAccessible(true);
-
-        // get the actual list.
-        mQualifierList = (ResourceQualifier[])qualifierListField.get(manager);
+        // create a default config with all qualifiers.
+        mDefaultConfig = new FolderConfiguration();
+        mDefaultConfig.createDefault();
 
         // create the project resources.
         mResources = new ProjectResources(null /*project*/);
@@ -234,17 +222,18 @@ public class ConfigMatchTest extends TestCase {
      * this particular qualifier.
      */
     private FolderConfiguration getConfiguration(String... qualifierValues) {
-        FolderConfiguration config = new FolderConfiguration();
+        // FolderConfiguration.getQualifierCount is always valid and up to date.
+        final int count = FolderConfiguration.getQualifierCount();
 
-        // those must be of the same length
-        assertEquals(qualifierValues.length, mQualifierList.length);
+        // Check we have the right number of qualifier.
+        assertEquals(qualifierValues.length, count);
 
-        int index = 0;
+        FolderConfiguration config = new FolderConfiguration();
 
-        for (ResourceQualifier qualifier : mQualifierList) {
-            String value = qualifierValues[index++];
+        for (int i = 0 ; i < count ; i++) {
+            String value = qualifierValues[i];
             if (value != null) {
-                assertTrue(qualifier.checkAndSet(value, config));
+                assertTrue(mDefaultConfig.getQualifier(i).checkAndSet(value, config));
             }
         }
 
@@ -268,28 +257,11 @@ public class ConfigMatchTest extends TestCase {
         IFolder folder = Mocks.createFolder(folderName, memberList);
 
         // add it to the resource, and get back a ResourceFolder object.
-        ResourceFolder resFolder = _addProjectResourceFolder(resources, config, folder);
+        ResourceFolder resFolder = resources.processFolder(new IFolderWrapper(folder));
 
         // and fill it with files from the list.
         for (IFile file : memberList) {
             resFolder.addFile(new SingleResourceFile(new IFileWrapper(file), resFolder));
         }
     }
-
-    /** Calls ResourceRepository.add() method via reflection to circumvent access
-     * restrictions that are enforced when running in the plug-in environment
-     * ie cannot access package or protected members in a different plug-in, even
-     * if they are in the same declared package as the accessor
-     */
-    private ResourceFolder _addProjectResourceFolder(ResourceRepository resources,
-            FolderConfiguration config, IFolder folder) throws Exception {
-
-        Method addMethod = ResourceRepository.class.getDeclaredMethod("add",
-                ResourceFolderType.class, FolderConfiguration.class,
-                IAbstractFolder.class);
-        addMethod.setAccessible(true);
-        ResourceFolder resFolder = (ResourceFolder)addMethod.invoke(resources,
-                ResourceFolderType.LAYOUT, config, new IFolderWrapper(folder));
-        return resFolder;
-    }
 }
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/resources/manager/QualifierListTest.java
deleted file mode 100644 (file)
index 37ee37a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/org/documents/epl-v10.php
- *
- * 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 com.android.ide.eclipse.adt.internal.editors.resources.manager;
-
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.ResourceQualifier;
-import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
-
-import java.lang.reflect.Field;
-
-import junit.framework.TestCase;
-
-public class QualifierListTest extends TestCase {
-    
-    private ResourceManager mManager;
-
-    @Override
-    public void setUp()  throws Exception {
-        super.setUp();
-        
-        mManager = ResourceManager.getInstance();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        mManager = null;
-    }
-    
-    public void testQualifierList() {
-        try {
-            // get the list of qualifier in the resource manager
-            Field qualifierListField = ResourceManager.class.getDeclaredField("mQualifiers");
-            assertNotNull(qualifierListField);
-            qualifierListField.setAccessible(true);
-            
-            // get the actual list.
-            ResourceQualifier[] qualifierList =
-                (ResourceQualifier[])qualifierListField.get(mManager);
-            
-            // now get the number of qualifier in the FolderConfiguration
-            Field qualCountField = FolderConfiguration.class.getDeclaredField("INDEX_COUNT");
-            assertNotNull(qualCountField);
-            qualCountField.setAccessible(true);
-            
-            // get the constant value
-            Integer count = (Integer)qualCountField.get(null);
-            
-            // now compare
-            assertEquals(count.intValue(), qualifierList.length);
-        } catch (SecurityException e) {
-            assertTrue(false);
-        } catch (NoSuchFieldException e) {
-            assertTrue(false);
-        } catch (IllegalArgumentException e) {
-            assertTrue(false);
-        } catch (IllegalAccessException e) {
-            assertTrue(false);
-        }
-    }
-}
-
diff --git a/ide_common/tests/.classpath b/ide_common/tests/.classpath
new file mode 100644 (file)
index 0000000..3cc56e3
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+       <classpathentry kind="src" path="src"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/ide_common"/>
+       <classpathentry combineaccessrules="false" kind="src" path="/common"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/ide_common/tests/.project b/ide_common/tests/.project
new file mode 100644 (file)
index 0000000..1cfa60e
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>ide_common-tests</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+       </natures>
+</projectDescription>
diff --git a/ide_common/tests/Android.mk b/ide_common/tests/Android.mk
new file mode 100644 (file)
index 0000000..9443dba
--- /dev/null
@@ -0,0 +1,27 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# Only compile source java files in this lib.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := ide_common-tests
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_JAVA_LIBRARIES := common ide_common junit
+
+include $(BUILD_HOST_JAVA_LIBRARY)
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.common.resources.configuration.CountryCodeQualifier;
-import com.android.ide.common.resources.configuration.FolderConfiguration;
+package com.android.ide.common.resources.configuration;
 
 import junit.framework.TestCase;
 
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2010 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
@@ -14,9 +14,8 @@
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.DockModeQualifier;
 import com.android.resources.DockMode;
 
 import junit.framework.TestCase;
diff --git a/ide_common/tests/src/com/android/ide/common/resources/configuration/FolderConfigurationTest.java b/ide_common/tests/src/com/android/ide/common/resources/configuration/FolderConfigurationTest.java
new file mode 100644 (file)
index 0000000..6d0d487
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed 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 com.android.ide.common.resources.configuration;
+
+import junit.framework.TestCase;
+
+public class FolderConfigurationTest extends TestCase {
+
+    /*
+     * Test createDefault creates all the qualifiers.
+     */
+    public void testCreateDefault() {
+        FolderConfiguration defaultConfig = new FolderConfiguration();
+        defaultConfig.createDefault();
+
+        // this is always valid and up to date.
+        final int count = FolderConfiguration.getQualifierCount();
+
+        // make sure all the qualifiers were created.
+        for (int i = 0 ; i < count ; i++) {
+            assertNotNull(defaultConfig.getQualifier(i));
+        }
+    }
+}
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.KeyboardStateQualifier;
 import com.android.resources.KeyboardState;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.LanguageQualifier;
+package com.android.ide.common.resources.configuration;
 
 import junit.framework.TestCase;
 
 public class LanguageQualifierTest extends TestCase {
-    
+
     private FolderConfiguration config;
     private LanguageQualifier lq;
 
@@ -39,14 +36,14 @@ public class LanguageQualifierTest extends TestCase {
         config = null;
         lq = null;
     }
-    
+
     public void testCheckAndSet() {
         assertEquals(true, lq.checkAndSet("en", config)); //$NON-NLS-1$
         assertTrue(config.getLanguageQualifier() != null);
         assertEquals("en", config.getLanguageQualifier().toString()); //$NON-NLS-1$
-        
+
     }
-    
+
     public void testFailures() {
         assertEquals(false, lq.checkAndSet("", config)); //$NON-NLS-1$
         assertEquals(false, lq.checkAndSet("EN", config)); //$NON-NLS-1$
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.NavigationMethodQualifier;
 import com.android.resources.Navigation;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.NetworkCodeQualifier;
+package com.android.ide.common.resources.configuration;
 
 import junit.framework.TestCase;
 
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.PixelDensityQualifier;
 import com.android.resources.Density;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.RegionQualifier;
+package com.android.ide.common.resources.configuration;
 
 import junit.framework.TestCase;
 
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
-
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.ScreenDimensionQualifier;
+package com.android.ide.common.resources.configuration;
 
 import junit.framework.TestCase;
 
@@ -39,7 +36,7 @@ public class ScreenDimensionQualifierTest extends TestCase {
         sdq = null;
         config = null;
     }
-    
+
     public void testCheckAndSet() {
         assertEquals(true, sdq.checkAndSet("400x200", config));//$NON-NLS-1$
         assertTrue(config.getScreenDimensionQualifier() != null);
@@ -47,7 +44,7 @@ public class ScreenDimensionQualifierTest extends TestCase {
         assertEquals(200, config.getScreenDimensionQualifier().getValue2());
         assertEquals("400x200", config.getScreenDimensionQualifier().toString()); //$NON-NLS-1$
     }
-    
+
     public void testFailures() {
         assertEquals(false, sdq.checkAndSet("", config));//$NON-NLS-1$
         assertEquals(false, sdq.checkAndSet("400X200", config));//$NON-NLS-1$
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.ScreenOrientationQualifier;
 import com.android.resources.ScreenOrientation;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2010 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.ScreenSizeQualifier;
 import com.android.resources.ScreenSize;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
 import com.android.resources.Keyboard;
 
 import junit.framework.TestCase;
@@ -1,11 +1,11 @@
 /*
  * Copyright (C) 2007 The Android Open Source Project
  *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * Licensed 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.eclipse.org/org/documents/epl-v10.php
+ *      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,
  * limitations under the License.
  */
 
-package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
+package com.android.ide.common.resources.configuration;
 
-import com.android.ide.common.resources.configuration.FolderConfiguration;
-import com.android.ide.common.resources.configuration.TouchScreenQualifier;
 import com.android.resources.TouchScreen;
 
 import junit.framework.TestCase;