@@ -0,0 +1,2634 @@
+/*-%0A * Copyright (c) 2014 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.fedoraproject.xmvn.tools.install.impl;%0A%0Aimport org.fedoraproject.xmvn.config.InstallerSettings;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNull;%0Aimport static org.junit.Assert.assertSame;%0A%0A/**%0A *%0A * @author Michael Simacek%0A */%0Apublic class PackageRegistryTest%0A        extends AbstractFileTest%0A%7B%0A    private InstallerSettings settings;%0A    private PackageRegistry registry;%0A%0A    @Before%0A    public void setUp()%0A    %7B%0A        settings = new InstallerSettings();%0A        settings.setMetadataDir( %22usr/share/maven-metadata%22 );%0A        registry = new PackageRegistry( settings, %22test-package%22 );%0A    %7D%0A%0A    @Test%0A    public void testDefaultPackage()%0A    %7B%0A        JavaPackage pkg1 = registry.getPackageById( null );%0A        JavaPackage pkg2 = registry.getPackageById( null );%0A        assertSame( pkg1, pkg2 );%0A        JavaPackage pkg3 = registry.getPackageById( %22%22 );%0A        assertSame( pkg2, pkg3 );%0A        assertEquals( 1, registry.getPackages().size() );%0A    %7D%0A%0A    @Test%0A    public void testMetadata()%0A            throws Exception%0A    %7B%0A        JavaPackage pkg = registry.getPackageById( null );%0A        performInstallation( pkg );%0A        assertDescriptorEquals( pkg, %22%25attr(0644,root,root) /usr/share/maven-metadata/test-package.xml%22 );%0A    %7D%0A%0A    @Test%0A    public void testNonDefault()%0A            throws Exception%0A    %7B%0A        JavaPackage pkg = registry.getPackageById( %22subpackage%22 );%0A        performInstallation( pkg );%0A        assertDescriptorEquals( pkg, %22%25attr(0644,root,root) /usr/share/maven-metadata/subpackage.xml%22 );%0A    %7D%0A%0A    @Test%0A    public void testMultiple()%0A            throws Exception%0A    %7B%0A        JavaPackage pkg1 = registry.getPackageById( null );%0A        JavaPackage pkg2 = registry.getPackageById( %22subpackage%22 );%0A        assertEquals( 2, registry.getPackages().size() );%0A        assertNull( registry.getPackageById( %22__noinstall%22 ) );%0A        assertEquals( 2, registry.getPackages().size() );%0A    %7D%0A%7D%0A

Implement PackageRegistryTest