/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package org.apache.ivy.osgi.updatesite;

import java.io.IOException;
import java.text.ParseException;
import java.util.Iterator;

import junit.framework.TestCase;

import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.osgi.repo.RepoDescriptor;
import org.xml.sax.SAXException;

public class UpdateSiteLoaderTest extends TestCase {

    public void testIvyDE() throws IOException, ParseException, SAXException {
        UpdateSiteLoader loader = new UpdateSiteLoader();
        RepoDescriptor site = loader.load("http://www.apache.org/dist/ant/ivyde/updatesite/");
        assertEquals(13, site.getModules().size());
    }

    public void testM2Eclipse() throws IOException, ParseException, SAXException {
        UpdateSiteLoader loader = new UpdateSiteLoader();
        RepoDescriptor site = loader.load("http://m2eclipse.sonatype.org/sites/m2e/");
        assertTrue(site.getModules().size() > 70);
        Iterator itModules = site.getModules().iterator();
        while (itModules.hasNext()) {
            ModuleDescriptor md = (ModuleDescriptor) itModules.next();
            String name = md.getModuleRevisionId().getName();
            assertTrue(name, name.indexOf("org.maven") != -1);
        }
    }

    public void _disabled_testHeliosEclipse() throws IOException, ParseException, SAXException {
        UpdateSiteLoader loader = new UpdateSiteLoader();
        RepoDescriptor site = loader.load("http://download.eclipse.org/releases/helios/");
        assertTrue(site.getModules().size() > 900);
    }

}

@@ -847,24 +847,45 @@
 pdatesite;%0A%0A
+import java.io.File;%0A
 import java.
@@ -991,24 +991,79 @@
 .TestCase;%0A%0A
+import org.apache.ivy.core.cache.CacheResourceOptions;%0A
 import org.a
@@ -1105,32 +1105,81 @@
 duleDescriptor;%0A
+import org.apache.ivy.core.settings.IvySettings;%0A
 import org.apach
@@ -1202,32 +1202,73 @@
 RepoDescriptor;%0A
+import org.apache.ivy.util.CacheCleaner;%0A
 import org.xml.s
@@ -1339,16 +1339,558 @@
 Case %7B%0A%0A
+    private UpdateSiteLoader loader;%0A%0A    private File cache;%0A%0A    protected void setUp() throws Exception %7B%0A        IvySettings ivySettings = new IvySettings();%0A        cache = new File(%22build/cache%22);%0A        cache.mkdirs();%0A        ivySettings.setDefaultCache(cache);%0A        CacheResourceOptions options = new CacheResourceOptions();%0A        loader = new UpdateSiteLoader(ivySettings.getDefaultRepositoryCacheManager(), null, options);%0A    %7D%0A%0A    protected void tearDown() throws Exception %7B%0A        CacheCleaner.deleteDir(cache);%0A    %7D%0A%0A
     publ
@@ -1964,66 +1964,8 @@
 n %7B%0A
-        UpdateSiteLoader loader = new UpdateSiteLoader();%0A
     
@@ -2201,66 +2201,8 @@
 n %7B%0A
-        UpdateSiteLoader loader = new UpdateSiteLoader();%0A
     
@@ -2637,16 +2637,140 @@
        %7D
+%0A%0A        site = loader.load(%22http://m2eclipse.sonatype.org/sites/m2e/%22);%0A        assertTrue(site.getModules().size() %3E 70);
 %0A    %7D%0A%0A
@@ -2870,66 +2870,8 @@
 n %7B%0A
-        UpdateSiteLoader loader = new UpdateSiteLoader();%0A
     

fix the tests regarding the previous commit r1097628