You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2010/03/18 09:30:04 UTC

svn commit: r924667 - in /felix/trunk/bundlerepository: ./ src/main/java/org/apache/felix/bundlerepository/impl/ src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/kx...

Author: gnodet
Date: Thu Mar 18 08:30:03 2010
New Revision: 924667

URL: http://svn.apache.org/viewvc?rev=924667&view=rev
Log:
FELIX-2211: Simplify the repository parser based on KXml2

Added:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java
      - copied, changed from r924191, felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java
Removed:
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ClassUtility.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/KXml2MetadataHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/MappingProcessingInstructionHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/MetadataHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/ReplaceUtility.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/XmlCommonHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/XmlMetadataHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/kxmlsax/KXml2SAXHandler.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/metadataparser/kxmlsax/KXml2SAXParser.java
Modified:
    felix/trunk/bundlerepository/pom.xml
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.java
    felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java
    felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.java

Modified: felix/trunk/bundlerepository/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/pom.xml?rev=924667&r1=924666&r2=924667&view=diff
==============================================================================
--- felix/trunk/bundlerepository/pom.xml (original)
+++ felix/trunk/bundlerepository/pom.xml Thu Mar 18 08:30:03 2010
@@ -47,6 +47,12 @@
       <artifactId>kxml2</artifactId>
       <version>2.2.2</version>
       <optional>true</optional>
+      <exclusions>
+        <exclusion>
+          <groupId>xmlpull</groupId>
+          <artifactId>xmlpull</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
     <dependency>
         <groupId>org.osgi</groupId>
@@ -81,7 +87,11 @@
         <configuration>
           <instructions>
             <Export-Package>org.apache.felix.bundlerepository;version="2.0"</Export-Package>
-            <Private-Package>org.kxml2.*,org.xmlpull.*;-split-package:=merge-first,org.apache.felix.bundlerepository.impl.*</Private-Package>
+            <Private-Package>
+                org.kxml2.io,
+                org.xmlpull.v1,
+                org.apache.felix.bundlerepository.impl.*
+            </Private-Package>
             <Import-Package>!javax.xml.parsers,!org.xml.sax,org.osgi.service.log;resolution:=optional,org.osgi.service.obr;resolution:=optional,javax.xml.stream;resolution:=optional,*</Import-Package>
             <DynamicImport-Package>org.apache.felix.shell</DynamicImport-Package>
             <Bundle-Activator>${pom.artifactId}.impl.Activator</Bundle-Activator>

Copied: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java (from r924191, felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java)
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java?p2=felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java&p1=felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java&r1=924191&r2=924667&rev=924667&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java (original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/PullParser.java Thu Mar 18 08:30:03 2010
@@ -18,131 +18,83 @@
  */
 package org.apache.felix.bundlerepository.impl;
 
+import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
+import java.io.InputStreamReader;
+
+import org.kxml2.io.KXmlParser;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
 
 /**
- * Repository XML parser based on StaX 
+ * Repository XML parser based on StaX
  */
-public class StaxParser implements RepositoryImpl.RepositoryParser
+public class PullParser implements RepositoryImpl.RepositoryParser
 {
-    private static final String REPOSITORY = "repository";
-    private static final String NAME = "name";
-    private static final String LASTMODIFIED = "lastmodified";
-    private static final String REFERRAL = "referral";
-    private static final String RESOURCE = "resource";
-    private static final String DEPTH = "depth";
-    private static final String URL = "url";
-    private static final String CATEGORY = "category";
-    private static final String ID = "id";
-    private static final String CAPABILITY = "capability";
-    private static final String REQUIRE = "require";
-    private static final String P = "p";
-    private static final String N = "n";
-    private static final String T = "t";
-    private static final String V = "v";
-    private static final String FILTER = "filter";
-    private static final String EXTEND = "extend";
-    private static final String MULTIPLE = "multiple";
-    private static final String OPTIONAL = "optional";
-
-    static XMLInputFactory factory;
 
-    public StaxParser()
+    public PullParser()
     {
-        synchronized (StaxParser.class)
-        {
-            if (factory == null)
-            {
-                factory = XMLInputFactory.newInstance();
-                setProperty(factory, XMLInputFactory.IS_NAMESPACE_AWARE, false);
-                setProperty(factory, XMLInputFactory.IS_VALIDATING, false);
-                setProperty(factory, XMLInputFactory.IS_COALESCING, false);
-            }
-        }
     }
 
-    protected static boolean setProperty(XMLInputFactory factory, String name, boolean value)
+    public void parse(RepositoryImpl repository, InputStream is) throws Exception
     {
-        try
+        KXmlParser reader = new KXmlParser();
+        reader.setInput(new BufferedReader(new InputStreamReader(is)));
+        int event = reader.nextTag();
+        if (event != XmlPullParser.START_TAG || !REPOSITORY.equals(reader.getName()))
         {
-            factory.setProperty(name, Boolean.valueOf(value));
-            return true;
+            throw new Exception("Expected element 'repository' at the root of the document");
         }
-        catch (Throwable t)
+        for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
+            String name = reader.getAttributeName(i);
+            String value = reader.getAttributeValue(i);
+            if (NAME.equals(name))
+            {
+                repository.setName(value);
+            }
+            else if (LASTMODIFIED.equals(name))
+            {
+                repository.setLastmodified(value);
+            }
         }
-        return false;
-    }
-
-    public void parse(RepositoryImpl repository, InputStream is) throws Exception
-    {
-        XMLStreamReader reader = factory.createXMLStreamReader(is);
-        try
+        while ((event = reader.nextTag()) == XmlPullParser.START_TAG)
         {
-            int event = reader.nextTag();
-            if (event != XMLStreamConstants.START_ELEMENT || !REPOSITORY.equals(reader.getLocalName()))
+            String element = reader.getName();
+            if (REFERRAL.equals(element))
             {
-                throw new Exception("Expected element 'repository' at the root of the document");
+                Referral referral = parseReferral(reader);
+                repository.addReferral(referral);
             }
-            for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
+            else if (RESOURCE.equals(element))
             {
-                String name = reader.getAttributeLocalName(i);
-                String value = reader.getAttributeValue(i);
-                if (NAME.equals(name))
-                {
-                    repository.setName(value);
-                }
-                else if (LASTMODIFIED.equals(name))
-                {
-                    repository.setLastmodified(value);
-                }
+                ResourceImpl resource = parseResource(reader);
+                repository.addResource(resource);
             }
-            while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT)
+            else
             {
-                String element = reader.getLocalName();
-                if (REFERRAL.equals(element))
-                {
-                    Referral referral = parseReferral(reader);
-                    repository.addReferral(referral);
-                }
-                else if (RESOURCE.equals(element))
-                {
-                    ResourceImpl resource = parseResource(reader);
-                    repository.addResource(resource);
-                }
-                else
-                {
-                    ignoreTag(reader);
-                }
+                ignoreTag(reader);
             }
-            // Sanity check
-            sanityCheckEndElement(reader, event, REPOSITORY);
-        }
-        finally
-        {
-            reader.close();
         }
+        // Sanity check
+        sanityCheckEndElement(reader, event, REPOSITORY);
     }
 
-    private void sanityCheckEndElement(XMLStreamReader reader, int event, String element)
+    private void sanityCheckEndElement(KXmlParser reader, int event, String element)
     {
-        if (event != XMLStreamConstants.END_ELEMENT || !element.equals(reader.getLocalName()))
+        if (event != XmlPullParser.END_TAG || !element.equals(reader.getName()))
         {
             throw new IllegalStateException("Unexpected state while finishing element " + element);
         }
     }
 
-    private Referral parseReferral(XMLStreamReader reader) throws Exception
+    private Referral parseReferral(KXmlParser reader) throws Exception
     {
         Referral referral = new Referral();
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
-            String name = reader.getAttributeLocalName(i);
+            String name = reader.getAttributeName(i);
             String value = reader.getAttributeValue(i);
             if (DEPTH.equals(name))
             {
@@ -157,19 +109,19 @@ public class StaxParser implements Repos
         return referral;
     }
 
-    private ResourceImpl parseResource(XMLStreamReader reader) throws Exception
+    private ResourceImpl parseResource(KXmlParser reader) throws Exception
     {
         ResourceImpl resource = new ResourceImpl();
         try
         {
             for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
             {
-                resource.put(reader.getAttributeLocalName(i), reader.getAttributeValue(i));
+                resource.put(reader.getAttributeName(i), reader.getAttributeValue(i));
             }
             int event;
-            while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT)
+            while ((event = reader.nextTag()) == XmlPullParser.START_TAG)
             {
-                String element = reader.getLocalName();
+                String element = reader.getName();
                 if (CATEGORY.equals(element))
                 {
                     CategoryImpl category = parseCategory(reader);
@@ -189,13 +141,13 @@ public class StaxParser implements Repos
                 {
                     StringBuffer sb = null;
                     String type = reader.getAttributeValue(null, "type");
-                    while ((event = reader.next()) != XMLStreamConstants.END_ELEMENT)
+                    while ((event = reader.next()) != XmlPullParser.END_TAG)
                     {
                         switch (event)
                         {
-                            case XMLStreamConstants.START_ELEMENT:
+                            case XmlPullParser.START_TAG:
                                 throw new Exception("Unexpected element inside <require/> element");
-                            case XMLStreamConstants.CHARACTERS:
+                            case XmlPullParser.TEXT:
                                 if (sb == null)
                                 {
                                     sb = new StringBuffer();
@@ -211,7 +163,7 @@ public class StaxParser implements Repos
                 }
             }
             // Sanity check
-            if (event != XMLStreamConstants.END_ELEMENT || !RESOURCE.equals(reader.getLocalName()))
+            if (event != XmlPullParser.END_TAG || !RESOURCE.equals(reader.getName()))
             {
                 throw new Exception("Unexpected state");
             }
@@ -219,23 +171,16 @@ public class StaxParser implements Repos
         }
         catch (Exception e)
         {
-            Location loc = reader.getLocation();
-            if (loc != null) {
-                throw new Exception("Error while parsing resource " + resource.getId() + " at line " + loc.getLineNumber() + " and column " + loc.getColumnNumber(), e);
-            }
-            else
-            {
-                throw new Exception("Error while parsing resource " + resource.getId(), e);
-            }
+            throw new Exception("Error while parsing resource " + resource.getId() + " at line " + reader.getLineNumber() + " and column " + reader.getColumnNumber(), e);
         }
     }
 
-    private CategoryImpl parseCategory(XMLStreamReader reader) throws XMLStreamException
+    private CategoryImpl parseCategory(KXmlParser reader) throws IOException, XmlPullParserException
     {
         CategoryImpl category = new CategoryImpl();
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
-            if (ID.equals(reader.getAttributeLocalName(i)))
+            if (ID.equals(reader.getAttributeName(i)))
             {
                 category.setId(reader.getAttributeValue(i));
             }
@@ -244,12 +189,12 @@ public class StaxParser implements Repos
         return category;
     }
 
-    private CapabilityImpl parseCapability(XMLStreamReader reader) throws Exception
+    private CapabilityImpl parseCapability(KXmlParser reader) throws Exception
     {
         CapabilityImpl capability = new CapabilityImpl();
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
-            String name = reader.getAttributeLocalName(i);
+            String name = reader.getAttributeName(i);
             String value = reader.getAttributeValue(i);
             if (NAME.equals(name))
             {
@@ -257,9 +202,9 @@ public class StaxParser implements Repos
             }
         }
         int event;
-        while ((event = reader.nextTag()) == XMLStreamConstants.START_ELEMENT)
+        while ((event = reader.nextTag()) == XmlPullParser.START_TAG)
         {
-            String element = reader.getLocalName();
+            String element = reader.getName();
             if (P.equals(element))
             {
                 PropertyImpl prop = parseProperty(reader);
@@ -275,12 +220,12 @@ public class StaxParser implements Repos
         return capability;
     }
 
-    private PropertyImpl parseProperty(XMLStreamReader reader) throws Exception
+    private PropertyImpl parseProperty(KXmlParser reader) throws Exception
     {
         String n = null, t = null, v = null;
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
-            String name = reader.getAttributeLocalName(i);
+            String name = reader.getAttributeName(i);
             String value = reader.getAttributeValue(i);
             if (N.equals(name))
             {
@@ -301,12 +246,12 @@ public class StaxParser implements Repos
         return prop;
     }
 
-    private RequirementImpl parseRequire(XMLStreamReader reader) throws Exception
+    private RequirementImpl parseRequire(KXmlParser reader) throws Exception
     {
         RequirementImpl requirement = new RequirementImpl();
         for (int i = 0, nb = reader.getAttributeCount(); i < nb; i++)
         {
-            String name = reader.getAttributeLocalName(i);
+            String name = reader.getAttributeName(i);
             String value = reader.getAttributeValue(i);
             if (NAME.equals(name))
             {
@@ -331,13 +276,13 @@ public class StaxParser implements Repos
         }
         int event;
         StringBuffer sb = null;
-        while ((event = reader.next()) != XMLStreamConstants.END_ELEMENT)
+        while ((event = reader.next()) != XmlPullParser.END_TAG)
         {
             switch (event)
             {
-                case XMLStreamConstants.START_ELEMENT:
+                case XmlPullParser.START_TAG:
                     throw new Exception("Unexpected element inside <require/> element");
-                case XMLStreamConstants.CHARACTERS:
+                case XmlPullParser.TEXT:
                     if (sb == null)
                     {
                         sb = new StringBuffer();
@@ -355,18 +300,17 @@ public class StaxParser implements Repos
         return requirement;
     }
 
-    private void ignoreTag(XMLStreamReader reader) throws XMLStreamException
-    {
+    private void ignoreTag(KXmlParser reader) throws IOException, XmlPullParserException {
         int level = 1;
         int event = 0;
         while (level > 0)
         {
             event = reader.next();
-            if (event == XMLStreamConstants.START_ELEMENT)
+            if (event == XmlPullParser.START_TAG)
             {
                 level++;
             }
-            else if (event == XMLStreamConstants.END_ELEMENT)
+            else if (event == XmlPullParser.END_TAG)
             {
                 level--;
             }

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.java?rev=924667&r1=924666&r2=924667&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.java (original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/RepositoryImpl.java Thu Mar 18 08:30:03 2010
@@ -39,8 +39,6 @@ import java.util.zip.ZipInputStream;
 import org.apache.felix.bundlerepository.Capability;
 import org.apache.felix.bundlerepository.Requirement;
 import org.apache.felix.bundlerepository.Resource;
-import org.apache.felix.bundlerepository.impl.metadataparser.XmlCommonHandler;
-import org.apache.felix.bundlerepository.impl.metadataparser.kxmlsax.KXml2SAXParser;
 import org.apache.felix.bundlerepository.Repository;
 
 public class RepositoryImpl implements Repository
@@ -287,7 +285,7 @@ public class RepositoryImpl implements R
         }
         if (parser == null)
         {
-            parser = new KXml2Parser();
+            parser = new PullParser();
 
         }
         parser.parse(this, is);
@@ -295,45 +293,27 @@ public class RepositoryImpl implements R
 
     public interface RepositoryParser
     {
+        static final String REPOSITORY = "repository";
+        static final String NAME = "name";
+        static final String LASTMODIFIED = "lastmodified";
+        static final String REFERRAL = "referral";
+        static final String RESOURCE = "resource";
+        static final String DEPTH = "depth";
+        static final String URL = "url";
+        static final String CATEGORY = "category";
+        static final String ID = "id";
+        static final String CAPABILITY = "capability";
+        static final String REQUIRE = "require";
+        static final String P = "p";
+        static final String N = "n";
+        static final String T = "t";
+        static final String V = "v";
+        static final String FILTER = "filter";
+        static final String EXTEND = "extend";
+        static final String MULTIPLE = "multiple";
+        static final String OPTIONAL = "optional";
+
         void parse(RepositoryImpl repository, InputStream is) throws Exception;
     }
 
-    public static class KXml2Parser implements RepositoryParser
-    {
-        public void parse(final RepositoryImpl repository, final InputStream is) throws Exception
-        {
-            BufferedReader br;// Create the parser Kxml
-            XmlCommonHandler handler = new XmlCommonHandler(repository.m_logger);
-            Object factory = new Object()
-            {
-                public RepositoryImpl newInstance()
-                {
-                    return repository;
-                }
-            };
-
-            // Get default setter method for Repository.
-            Method repoSetter = RepositoryImpl.class.getDeclaredMethod(
-                "put", new Class[] { Object.class, Object.class });
-
-            // Get default setter method for Resource.
-            Method resSetter = ResourceImpl.class.getDeclaredMethod(
-                "put", new Class[] { Object.class, Object.class });
-
-            // Map XML tags to types.
-            handler.addType("repository", factory, Repository.class, repoSetter);
-            handler.addType("referral", Referral.class, null, null);
-            handler.addType("resource", ResourceImpl.class, Resource.class, resSetter);
-            handler.addType("category", CategoryImpl.class, null, null);
-            handler.addType("require", RequirementImpl.class, Requirement.class, null);
-            handler.addType("capability", CapabilityImpl.class, Capability.class, null);
-            handler.addType("p", PropertyImpl.class, null, null);
-            handler.setDefaultType(String.class, null, null);
-
-            br = new BufferedReader(new InputStreamReader(is));
-            KXml2SAXParser parser;
-            parser = new KXml2SAXParser(br);
-            parser.parseXML(handler);
-        }
-    }
 }
\ No newline at end of file

Modified: felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java?rev=924667&r1=924666&r2=924667&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java (original)
+++ felix/trunk/bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/StaxParser.java Thu Mar 18 08:30:03 2010
@@ -30,25 +30,6 @@ import javax.xml.stream.XMLStreamReader;
  */
 public class StaxParser implements RepositoryImpl.RepositoryParser
 {
-    private static final String REPOSITORY = "repository";
-    private static final String NAME = "name";
-    private static final String LASTMODIFIED = "lastmodified";
-    private static final String REFERRAL = "referral";
-    private static final String RESOURCE = "resource";
-    private static final String DEPTH = "depth";
-    private static final String URL = "url";
-    private static final String CATEGORY = "category";
-    private static final String ID = "id";
-    private static final String CAPABILITY = "capability";
-    private static final String REQUIRE = "require";
-    private static final String P = "p";
-    private static final String N = "n";
-    private static final String T = "t";
-    private static final String V = "v";
-    private static final String FILTER = "filter";
-    private static final String EXTEND = "extend";
-    private static final String MULTIPLE = "multiple";
-    private static final String OPTIONAL = "optional";
 
     static XMLInputFactory factory;
 

Modified: felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.java?rev=924667&r1=924666&r2=924667&view=diff
==============================================================================
--- felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.java (original)
+++ felix/trunk/bundlerepository/src/test/java/org/apache/felix/bundlerepository/impl/StaxParserTest.java Thu Mar 18 08:30:03 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.felix.bundlerepository.impl;
 
+import java.io.File;
 import java.net.URL;
 import java.util.Hashtable;
 
@@ -52,11 +53,27 @@ public class StaxParserTest extends Test
         assertTrue(resolver.resolve());
     }
 
+    public void testPullParser() throws Exception
+    {
+        URL url = getClass().getResource("/repo_for_resolvertest.xml");
+        RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class);
+        RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url);
+
+        Resolver resolver = repoAdmin.resolver();
+
+        Resource[] discoverResources = repoAdmin.discoverResources("(symbolicname=org.apache.felix.test*)");
+        assertNotNull(discoverResources);
+        assertEquals(1, discoverResources.length);
+
+        resolver.add(discoverResources[0]);
+        assertTrue(resolver.resolve());
+    }
+
     public void testPerfs() throws Exception
     {
-//        for (int i = 0; i < 10; i++) {
+        for (int i = 0; i < 10; i++) {
 //            testPerfs(new File(System.getProperty("user.home"), ".m2/repository/repository.xml").toURI().toURL(), 0, 100);
-//        }
+        }
     }
 
     protected void testPerfs(URL url, int nbWarm, int nbTest) throws Exception
@@ -98,17 +115,17 @@ public class StaxParserTest extends Test
 
         for (int i = 0; i < nbWarm; i++)
         {
-            RepositoryAdminImpl repoAdmin = createRepositoryAdmin(RepositoryImpl.KXml2Parser.class);
+            RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class);
             RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url);
         }
         t0 = System.currentTimeMillis();
         for (int i = 0; i < nbTest; i++)
         {
-            RepositoryAdminImpl repoAdmin = createRepositoryAdmin(RepositoryImpl.KXml2Parser.class);
+            RepositoryAdminImpl repoAdmin = createRepositoryAdmin(PullParser.class);
             RepositoryImpl repo = (RepositoryImpl) repoAdmin.addRepository(url);
         }
         t1 = System.currentTimeMillis();
-        System.err.println("KXmlParser: " + (t1 - t0) + " ms");
+        System.err.println("PullParser: " + (t1 - t0) + " ms");
     }
 
     public static void main(String[] args) throws Exception