public void testFrom103_1() throws Exception { TimeZone defaultTZ = TimeZone.getDefault(); // use UTC for this test TimeZone.setDefault(TimeZone.getTimeZone("UTC")); copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/103-1/nexus-103.xml", getNexusConfiguration()); // trick: copying by nexus.xml the tasks.xml too copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/103-1/tasks.xml", new File(new File(getNexusConfiguration()).getParentFile(), "tasks.xml")); Configuration configuration = configurationUpgrader.loadOldConfiguration(new File(getNexusConfiguration())); // set back to the default timezone TimeZone.setDefault(defaultTZ); assertEquals(Configuration.MODEL_VERSION, configuration.getVersion()); // 6 repos 3 groups assertEquals(6 + 3, configuration.getRepositories().size()); assertEquals(2, configuration.getRepositoryGrouping().getPathMappings().size()); resultIsFine("/org/sonatype/nexus/configuration/upgrade/103-1/nexus-103.xml", configuration); securityResultIsFine( "/org/sonatype/nexus/configuration/upgrade/103-1/security-configuration-103.xml"); }
public void testFrom143() throws Exception { copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/nexus-143.xml", getNexusConfiguration()); Configuration configuration = configurationUpgrader.loadOldConfiguration(new File(getNexusConfiguration())); assertEquals(Configuration.MODEL_VERSION, configuration.getVersion()); resultIsFine("/org/sonatype/nexus/configuration/upgrade/nexus-143.xml", configuration); }
public void testNEXUS1710() throws Exception { copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/nexus1710/nexus.xml", getNexusConfiguration()); Configuration configuration = configurationUpgrader.loadOldConfiguration(new File(getNexusConfiguration())); assertEquals(Configuration.MODEL_VERSION, configuration.getVersion()); resultIsFine("/org/sonatype/nexus/configuration/upgrade/nexus1710/nexus.xml", configuration); securityResultIsFine( "/org/sonatype/nexus/configuration/upgrade/nexus1710/security-configuration-1710.xml"); }
public void testFromDECInt() throws Exception { copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/nexus-001-3.xml", getNexusConfiguration()); Configuration configuration = configurationUpgrader.loadOldConfiguration(new File(getNexusConfiguration())); assertEquals(Configuration.MODEL_VERSION, configuration.getVersion()); assertEquals(7 + 2, configuration.getRepositories().size()); assertEquals(2, configuration.getRepositoryGrouping().getPathMappings().size()); resultIsFine("/org/sonatype/nexus/configuration/upgrade/nexus-001-3.xml", configuration); securityResultIsFine( "/org/sonatype/nexus/configuration/upgrade/security-configuration-001-3.xml"); }
public void testFrom103_2() throws Exception { // same as above, but we have no tasks.xml copyFromClasspathToFile( "/org/sonatype/nexus/configuration/upgrade/103-2/nexus-103.xml", getNexusConfiguration()); Configuration configuration = configurationUpgrader.loadOldConfiguration(new File(getNexusConfiguration())); assertEquals(Configuration.MODEL_VERSION, configuration.getVersion()); // 6 repos, 1 shadow, 2 groups assertEquals(6 + 1 + 2, configuration.getRepositories().size()); assertEquals(2, configuration.getRepositoryGrouping().getPathMappings().size()); resultIsFine("/org/sonatype/nexus/configuration/upgrade/103-2/nexus-103.xml", configuration); securityResultIsFine( "/org/sonatype/nexus/configuration/upgrade/103-2/security-configuration-103.xml"); }