You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by py...@apache.org on 2007/10/31 09:02:08 UTC

svn commit: r590584 - in /harmony/enhanced/classlib/branches/java6: modules/luni/src/main/java/java/util/ modules/luni/src/test/api/common/tests/api/java/util/ support/src/test/java/tests/resources/ServiceLoader/

Author: pyang
Date: Wed Oct 31 01:02:06 2007
New Revision: 590584

URL: http://svn.apache.org/viewvc?rev=590584&view=rev
Log:
Add the implementation of Java 6 new class java.util.ServiceLoader

Added:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java   (with props)
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services.jar   (with props)
    harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services2.jar   (with props)
Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java?rev=590584&r1=590583&r2=590584&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/Formatter.java Wed Oct 31 01:02:06 2007
@@ -52,6 +52,11 @@
  */
 public final class Formatter implements Closeable, Flushable {
 
+    /**
+     * a enum big decimal layout form
+     * 
+     * @since 1.6
+     */
     public enum BigDecimalLayoutForm {
         SCIENTIFIC, DECIMAL_FLOAT
     }

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,267 @@
+/*
+ *  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 java.util;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.apache.harmony.luni.util.Msg;
+
+/**
+ * Service loader is a service-provider loading utility class.
+ * @param <S> 
+ * 
+ * @since 1.6
+ */
+public final class ServiceLoader<S> implements Iterable<S> {
+
+    private static final String META_INF_SERVICES = "META-INF/services/"; //$NON-NLS-1$
+
+    private Set<URL> services;
+
+    private Class<S> service;
+
+    private ClassLoader loader;
+    
+    private ServiceLoader(){
+        // do nothing
+    }
+
+    /**
+     * reloads the services
+     * 
+     */
+    public void reload() {
+        internalLoad(this, service, loader);
+    }
+
+    /**
+     * Answers the iterator of this ServiceLoader
+     * 
+     * @return the iterator of this ServiceLoader
+     */
+    public Iterator<S> iterator() {
+        return new ServiceIterator(this);
+    }
+
+    /**
+     * Constructs a serviceloader.
+     * 
+     * @param service
+     *            the given service class or interface
+     * @param loader
+     *            the given class loader
+     * @return a new ServiceLoader
+     */
+    public static <S> ServiceLoader<S> load(Class<S> service, ClassLoader loader) {
+        ServiceLoader<S> sl = new ServiceLoader<S>();
+        sl.service = service;
+        sl.loader = loader;
+        sl.services = new HashSet<URL>();
+        internalLoad(sl, service, loader);
+        return sl;
+    }
+
+    // try to find all jars that contains the service. Note according to the
+    // lazy load, the service will not load this time.
+    private static void internalLoad(ServiceLoader<?> sl, Class<?> service,
+            ClassLoader loader) {
+        Enumeration<URL> profiles = null;
+        if (null == service) {
+            sl.services.add(null);
+            return;
+        }
+        try {
+            if (null == loader) {
+                profiles = ClassLoader.getSystemResources(META_INF_SERVICES
+                        + service.getName());
+            } else {
+                profiles = loader.getResources(META_INF_SERVICES
+                        + service.getName());
+            }
+        } catch (IOException e) {
+            return;
+        }
+        if (null != profiles) {
+            while (profiles.hasMoreElements()) {
+                URL url = profiles.nextElement();
+                sl.services.add(url);
+            }
+        }
+    }
+
+    /**
+     * Constructs a serviceloader.
+     * 
+     * @param service
+     *            the given service class or interface
+     * @return a new ServiceLoader
+     */
+    public static <S> ServiceLoader<S> load(Class<S> service) {
+        return ServiceLoader.load(service, Thread.currentThread()
+                .getContextClassLoader());
+    }
+
+    /**
+     * Constructs a serviceloader with extension class loader.
+     * 
+     * @param service
+     *            the given service class or interface
+     * @return a new ServiceLoader
+     */
+    public static <S> ServiceLoader<S> loadInstalled(Class<S> service) {
+        // extClassLoader
+        ClassLoader cl = ClassLoader.getSystemClassLoader();
+        if (null != cl) {
+            while (null != cl.getParent()) {
+                cl = cl.getParent();
+            }
+        }
+        return ServiceLoader.load(service, cl);
+    }
+
+    /**
+     * Answers a string that indicate the information of this ServiceLoader
+     * 
+     * @return a string that indicate the information of this ServiceLoader
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("ServiceLoader of "); //$NON-NLS-1$
+        sb.append(service.getName());
+        return sb.toString();
+    }
+
+    // inner class for returning
+    private class ServiceIterator implements Iterator<S> {
+
+        private static final String SINGAL_SHARP = "#"; //$NON-NLS-1$
+
+        private ClassLoader cl;
+
+        private Class<S> service;
+
+        private Set<URL> services;
+
+        private BufferedReader reader = null;
+
+        private boolean isRead = false;
+
+        private Queue<String> que;
+
+        public ServiceIterator(ServiceLoader<S> sl) {
+            cl = sl.loader;
+            service = sl.service;
+            services = sl.services;
+        }
+
+        public boolean hasNext() {
+            if (!isRead) {
+                readClass();
+            }
+            if (null != que && !que.isEmpty()) {
+                return true;
+            }
+            return false;
+        }
+
+        @SuppressWarnings("unchecked")
+        public S next() {
+            if (!hasNext()) {
+                throw new NoSuchElementException();
+            }
+            String clsName = que.remove();
+            try {
+                S ret;
+                if (null == cl) {
+                    ret = service.cast(Class.forName(clsName).newInstance());
+                } else {
+                    ret = service.cast(cl.loadClass(clsName).newInstance());
+                }
+                return ret;
+            } catch (Exception e) {
+                // according to spec, this is a special design
+                throw new ServiceConfigurationError(Msg.getString("KB005", //$NON-NLS-1$
+                        clsName), e);
+            }
+        }
+
+        private void readClass() {
+            if (null == services) {
+                isRead = true;
+                return;
+            }
+            Iterator<URL> iter = services.iterator();
+            que = new LinkedList<String>();
+            while (iter.hasNext()) {                
+                URL url = iter.next();                
+                if (null == url) {
+                    // follow RI
+                    throw new NullPointerException();
+                }
+                try {
+                    reader = new BufferedReader(new InputStreamReader(url
+                            .openStream(), "UTF-8")); //$NON-NLS-1$
+                    
+                    String str;
+                    // find class name (skip lines starts with "#")
+                    while (true) {
+                        str = reader.readLine();
+                        if (null == str) {
+                            break;
+                        }
+                        String[] strs = str.trim().split(SINGAL_SHARP);
+                        if (0 != strs.length) {
+                            str = strs[0].trim();
+                            if (!(str.startsWith(SINGAL_SHARP) || 0 == str
+                                    .length())) {
+                                // a java class name, check if identifier
+                                // correct
+                                char[] namechars = str.toCharArray();
+                                for (int i = 0; i < namechars.length; i++) {
+                                    if (!(Character
+                                            .isJavaIdentifierPart(namechars[i]) || namechars[i] == '.')) {
+                                        throw new ServiceConfigurationError(Msg
+                                                .getString("KB006", //$NON-NLS-1$
+                                                        namechars[i]));
+                                    }
+                                }
+                                // correct, if it does not exist in the que, add
+                                // it to que
+                                if (!que.contains(str)) {
+                                    que.add(str);
+                                }
+                            }
+                        }
+                    }
+                } catch (Exception e) {
+                    // according to spec, this is a special design
+                    throw new ServiceConfigurationError(Msg.getString("KB006", //$NON-NLS-1$
+                            url), e);
+                }
+            }
+            isRead = true;
+        }
+
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/main/java/java/util/ServiceLoader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,491 @@
+/*
+ *  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 tests.api.java.util;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.ServiceConfigurationError;
+import java.util.ServiceLoader;
+
+import junit.framework.TestCase;
+import tests.resources.ServiceLoader.AbstractService;
+import tests.resources.ServiceLoader.Service;
+import tests.resources.ServiceLoader.ServiceDuplicateIn2File;
+import tests.resources.ServiceLoader.ServiceFinalClass;
+import tests.resources.ServiceLoader.ServiceForAllCommentTest;
+import tests.resources.ServiceLoader.ServiceForEmptyTest;
+import tests.resources.ServiceLoader.ServiceForIllegalNameTest;
+import tests.resources.ServiceLoader.ServiceForWrongNameTest;
+import tests.resources.ServiceLoader.ServiceIn2File;
+import tests.resources.ServiceLoader.ServiceIn2FileWithEmptyConfig;
+import tests.resources.ServiceLoader.ServiceMoreThanOne;
+import tests.resources.ServiceLoader.ServiceWithDuplicateSons;
+import tests.support.resource.Support_Resources;
+
+/**
+ * Test cases for java.util.ServiceLoader
+ */
+public class ServiceLoaderTest extends TestCase {
+
+    private static URL jarFile = null;
+
+    /**
+     * @throws MalformedURLException
+     * @tests {@link java.util.ServiceLoader#reload()}.
+     */
+    @SuppressWarnings("nls")
+    public void test_reload() throws MalformedURLException {
+        class SubURLClassLoader extends URLClassLoader {
+            /**
+             * @param urls
+             */
+            public SubURLClassLoader(URL[] urls) {
+                super(urls);
+            }
+
+            @Override
+            public void addURL(URL url) {
+                super.addURL(url);
+            }
+        }
+        SubURLClassLoader ucl = new SubURLClassLoader(new URL[] { new URL(
+                "file:/no/such/file") });
+        ServiceLoader<Service> serviceLoader = ServiceLoader.load(
+                Service.class, ucl);
+        Iterator<Service> itr = serviceLoader.iterator();
+        assertFalse(itr.hasNext());
+        // change the ucl to install a jar file
+        ucl.addURL(jarFile);
+        // before reload, the Iterator is unchanged
+        itr = serviceLoader.iterator();
+        assertNotSame(itr, serviceLoader.iterator());
+        assertFalse(itr.hasNext());
+        // after reload, the Iterator update
+        serviceLoader.reload();
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfService", itr.next().myNameIs());
+        assertFalse(itr.hasNext());
+    }
+
+    /**
+     * @tests {@link java.util.ServiceLoader#iterator()}.
+     */
+    @SuppressWarnings( { "nls", "unchecked" })
+    public void test_iterator() {
+        URLClassLoader ucl = new URLClassLoader(new URL[] { jarFile });
+        Iterator itr = ServiceLoader.load(Service.class, ucl).iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfService", ((Service) itr.next())
+                .myNameIs());
+        assertFalse(itr.hasNext());
+        try {
+            itr.remove();
+            fail("Should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        itr = ServiceLoader.load(ServiceForWrongNameTest.class, ucl).iterator();
+        assertTrue(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw ServiceConfigurationError");
+        } catch (ServiceConfigurationError e) {
+            // expected
+        }
+        try {
+            itr.remove();
+            fail("Should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+
+        // null test
+        itr = ServiceLoader.load(null).iterator();
+        nullIteratorTester(itr);
+
+        itr = ServiceLoader.load(null, null).iterator();
+        nullIteratorTester(itr);
+
+        itr = ServiceLoader.load(null, ClassLoader.getSystemClassLoader())
+                .iterator();
+        nullIteratorTester(itr);
+
+        itr = ServiceLoader.load(Service.class, null).iterator();
+        assertFalse(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+        try {
+            itr.remove();
+            fail("Should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    @SuppressWarnings( { "nls", "unchecked" })
+    private void nullIteratorTester(Iterator itr) {
+        assertNotNull(itr);
+        try {
+            itr.hasNext();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        try {
+            itr.next();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        try {
+            itr.remove();
+            fail("Should throw UnsupportedOperationException");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @throws MalformedURLException
+     * @tests {@link java.util.ServiceLoader#load(java.lang.Class, java.lang.ClassLoader)}.
+     */
+    @SuppressWarnings( { "nls", "unchecked" })
+    public void test_loadLjava_lang_ClassLjava_lang_ClassLoader()
+            throws MalformedURLException {
+        URLClassLoader ucl = new URLClassLoader(new URL[] { jarFile });
+        // normal config file
+        ServiceLoader serviceLoader = ServiceLoader.load(Service.class, ucl);
+        Iterator itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfService", ((Service) itr.next())
+                .myNameIs());
+        assertFalse(itr.hasNext());
+
+        // class that can not cast correctly
+        serviceLoader = ServiceLoader.load(ServiceFinalClass.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw ServiceConfigurationError");
+        } catch (ServiceConfigurationError e) {
+            // expected
+        }
+
+        // abstract class with comment in config file
+        serviceLoader = ServiceLoader.load(AbstractService.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfAbstractService", ((AbstractService) itr
+                .next()).myNameIs());
+        assertFalse(itr.hasNext());
+
+        // one service with two implementation class
+        serviceLoader = ServiceLoader.load(ServiceMoreThanOne.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        String name = ((ServiceMoreThanOne) itr.next()).myNameIs();
+        if ("ImplementationOfServiceMoreThanOne1".equals(name)) {
+            assertEquals("ImplementationOfServiceMoreThanOne2",
+                    ((ServiceMoreThanOne) itr.next()).myNameIs());
+        } else if ("ImplementationOfServiceMoreThanOne2".equals(name)) {
+            assertEquals("ImplementationOfServiceMoreThanOne1",
+                    ((ServiceMoreThanOne) itr.next()).myNameIs());
+        } else {
+            fail("Should load ImplementationOfServiceMoreThanOne1 or ImplementationOfServiceMoreThanOne2");
+        }
+        assertFalse(itr.hasNext());
+
+        // config file only contains comments
+        serviceLoader = ServiceLoader.load(ServiceForAllCommentTest.class, ucl);
+        itr = serviceLoader.iterator();
+        assertFalse(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+
+        // empty config file
+        serviceLoader = ServiceLoader.load(ServiceForEmptyTest.class, ucl);
+        itr = serviceLoader.iterator();
+        assertFalse(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            // expected
+        }
+
+        // config file with illegal char
+        serviceLoader = ServiceLoader
+                .load(ServiceForIllegalNameTest.class, ucl);
+        itr = serviceLoader.iterator();
+        try {
+            itr.hasNext();
+            fail("Should throw ServiceConfigurationError");
+        } catch (ServiceConfigurationError e) {
+            // expected
+        }
+
+        // config file with legal string, but the class does not exist
+        serviceLoader = ServiceLoader.load(ServiceForWrongNameTest.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        try {
+            itr.next();
+            fail("Should throw ServiceConfigurationError");
+        } catch (ServiceConfigurationError e) {
+            // expected
+        }
+
+        // config file for an internal class
+        serviceLoader = ServiceLoader.load(
+                AbstractService.InternalService.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfAbstractServiceInternalService",
+                ((AbstractService.InternalService) itr.next())
+                        .myInternalNameIs());
+        assertFalse(itr.hasNext());
+
+        // config files in the 2 jar files
+        serviceLoader = ServiceLoader.load(ServiceIn2File.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceIn2File1", ((ServiceIn2File) itr
+                .next()).myNameIs());
+        assertFalse(itr.hasNext());
+        // add the second file
+        URL jarFile2 = prepairJar("hyts_services2.jar");
+        URLClassLoader ucl2 = new URLClassLoader(
+                new URL[] { jarFile, jarFile2 });
+        serviceLoader = ServiceLoader.load(ServiceIn2File.class, ucl2);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        name = ((ServiceIn2File) itr.next()).myNameIs();
+        if ("ImplementationOfServiceIn2File1".equals(name)) {
+            assertEquals("ImplementationOfServiceIn2File2",
+                    ((ServiceIn2File) itr.next()).myNameIs());
+        } else if ("ImplementationOfServiceIn2File2".equals(name)) {
+            assertEquals("ImplementationOfServiceIn2File1",
+                    ((ServiceIn2File) itr.next()).myNameIs());
+        } else {
+            fail("Should load ImplementationOfServiceIn2File1 or ImplementationOfServiceIn2File2");
+        }
+        assertFalse(itr.hasNext());
+
+        // same config files in 2 jar files
+        serviceLoader = ServiceLoader.load(ServiceDuplicateIn2File.class, ucl2);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceDuplicateIn2File_1",
+                ((ServiceDuplicateIn2File) itr.next()).myNameIs());
+        assertFalse(itr.hasNext());
+        ucl2 = new URLClassLoader(new URL[] { jarFile2, jarFile });
+        serviceLoader = ServiceLoader.load(ServiceDuplicateIn2File.class, ucl2);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceDuplicateIn2File_2",
+                ((ServiceDuplicateIn2File) itr.next()).myNameIs());
+        assertFalse(itr.hasNext());
+
+        // one config file in one jar, another empty config in another jar.
+        serviceLoader = ServiceLoader.load(ServiceIn2FileWithEmptyConfig.class,
+                ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceIn2FileWithEmptyConfig",
+                ((ServiceIn2FileWithEmptyConfig) itr.next()).myNameIs());
+        assertFalse(itr.hasNext());
+        ucl2 = new URLClassLoader(new URL[] { jarFile, jarFile2 });
+        serviceLoader = ServiceLoader.load(ServiceIn2FileWithEmptyConfig.class,
+                ucl2);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceIn2FileWithEmptyConfig",
+                ((ServiceIn2FileWithEmptyConfig) itr.next()).myNameIs());
+        assertFalse(itr.hasNext());
+
+        // config file with duplicate items
+        serviceLoader = ServiceLoader.load(ServiceWithDuplicateSons.class, ucl);
+        itr = serviceLoader.iterator();
+        assertTrue(itr.hasNext());
+        assertEquals("ImplementationOfServiceWithDuplicateSons",
+                ((ServiceWithDuplicateSons) itr.next()).myNameIs());
+        assertFalse(itr.hasNext());
+
+        // can not load by system classloader
+        serviceLoader = ServiceLoader.load(Service.class, ClassLoader
+                .getSystemClassLoader());
+        assertFalse(serviceLoader.iterator().hasNext());
+
+        // can not load by Thread.currentThread().getContextClassLoader()
+        serviceLoader = ServiceLoader.load(Service.class, Thread
+                .currentThread().getContextClassLoader());
+        assertFalse(serviceLoader.iterator().hasNext());
+
+        serviceLoader = ServiceLoader.load(Service.class, Service.class
+                .getClassLoader());
+        assertFalse(serviceLoader.iterator().hasNext());
+
+        // String is a final class, no sub-class for it
+        serviceLoader = ServiceLoader.load(String.class, ucl);
+        assertFalse(serviceLoader.iterator().hasNext());
+    }
+
+    /**
+     * @tests {@link java.util.ServiceLoader#load(java.lang.Class)}.
+     */
+    @SuppressWarnings( { "nls", "unchecked" })
+    public void test_loadLjava_lang_Class() {
+        ServiceLoader serviceLoader = ServiceLoader.load(Service.class);
+        assertFalse(serviceLoader.iterator().hasNext());
+        // String is a final class, no sub-class for it
+        serviceLoader = ServiceLoader.load(String.class);
+        assertFalse(serviceLoader.iterator().hasNext());
+    }
+
+    /**
+     * @param fileName
+     * @return the URL of the jar file
+     * @throws MalformedURLException
+     */
+    @SuppressWarnings("nls")
+    private static URL prepairJar(String fileName) throws MalformedURLException {
+        File resources = Support_Resources.createTempFolder();
+        String resPath = resources.toString();
+        if (resPath.charAt(0) == '/' || resPath.charAt(0) == '\\') {
+            resPath = resPath.substring(1);
+        }
+        Support_Resources.copyFile(resources, "ServiceLoader", fileName);
+        URL resourceURL = new URL("file:/" + resPath + "/ServiceLoader/"
+                + fileName);
+        return resourceURL;
+    }
+
+    /**
+     * @tests {@link java.util.ServiceLoader#loadInstalled(java.lang.Class)}.
+     */
+    public void test_loadInstalledLjava_lang_Class() {
+        ServiceLoader<Service> serviceLoader = ServiceLoader
+                .loadInstalled(Service.class);
+        assertFalse(serviceLoader.iterator().hasNext());
+
+        serviceLoader = ServiceLoader.loadInstalled(null);
+        Iterator<Service> itr = serviceLoader.iterator();
+        nullIteratorTester(itr);
+    }
+
+    /**
+     * @tests {@link java.util.ServiceLoader#toString()}.
+     */
+    @SuppressWarnings( { "unchecked", "nls" })
+    public void test_toString() {
+        URLClassLoader ucl = new URLClassLoader(new URL[] { jarFile });
+        ServiceLoader serviceLoader = ServiceLoader.load(Service.class, ucl);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.load(String.class, ucl);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.load(Service.class);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.load(String.class);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.loadInstalled(Service.class);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.loadInstalled(String.class);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.load(null, ucl);
+        assertNotNull(serviceLoader);
+        try {
+            serviceLoader.toString();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        serviceLoader = ServiceLoader.load(null, null);
+        assertNotNull(serviceLoader);
+        try {
+            serviceLoader.toString();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        serviceLoader = ServiceLoader.load(Service.class, null);
+        assertTrue(serviceLoader.toString().length() > 0);
+
+        serviceLoader = ServiceLoader.load(null);
+        assertNotNull(serviceLoader);
+        try {
+            serviceLoader.toString();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+
+        serviceLoader = ServiceLoader.loadInstalled(null);
+        assertNotNull(serviceLoader);
+        try {
+            serviceLoader.toString();
+            fail("Should throw NullPointerException");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    @SuppressWarnings("nls")
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        jarFile = prepairJar("hyts_services.jar");
+    }
+
+    /**
+     * @see junit.framework.TestCase#tearDown()
+     */
+    @Override
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        new File(jarFile.getFile()).delete();
+    }
+
+}

Propchange: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/tests/api/java/util/ServiceLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,38 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public abstract class AbstractService {
+    /**
+     * @return name of the class
+     */
+    public abstract String myNameIs();
+
+    /**
+     * test of internal interface
+     */
+    public interface InternalService {
+        /**
+         * @return name
+         */
+        public String myInternalNameIs();
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/AbstractService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface Service {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/Service.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceDuplicateIn2File {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceDuplicateIn2File.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,31 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public final class ServiceFinalClass {
+    /**
+     * @return name of the class
+     */
+    @SuppressWarnings("nls")
+    public String myNameIs() {
+        return "ServiceFinalClass";
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceFinalClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceForAllCommentTest {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForAllCommentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceForEmptyTest {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForEmptyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceForIllegalNameTest {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForIllegalNameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceForWrongNameTest {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceForWrongNameTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceIn2File {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2File.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceIn2FileWithEmptyConfig {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceIn2FileWithEmptyConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,31 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public class ServiceMoreThanOne {
+    /**
+     * @return name of the class
+     */
+    @SuppressWarnings("nls")
+    public String myNameIs() {
+        return "ServiceMoreThanOne";
+    }
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceMoreThanOne.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java?rev=590584&view=auto
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java (added)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java Wed Oct 31 01:02:06 2007
@@ -0,0 +1,28 @@
+/*
+ *  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 tests.resources.ServiceLoader;
+
+/**
+ * A class just for test cases of java.util.ServiceLoader.
+ */
+public interface ServiceWithDuplicateSons {
+    /**
+     * @return name of the class
+     */
+    public String myNameIs();
+}

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/ServiceWithDuplicateSons.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services.jar?rev=590584&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services2.jar
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services2.jar?rev=590584&view=auto
==============================================================================
Binary file - no diff available.

Propchange: harmony/enhanced/classlib/branches/java6/support/src/test/java/tests/resources/ServiceLoader/hyts_services2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream