[MRM-1513] Remove DatabaseScanningConfiguration fields

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1166734 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-08 15:13:58 +00:00
parent 3ad7edbe29
commit cd10c1cde8
3 changed files with 2 additions and 103 deletions

View File

@ -494,18 +494,7 @@ public class DefaultArchivaConfiguration
section.removeSubset( "repositoryScanning.invalidContentConsumers" );
}
}
if ( configuration.getDatabaseScanning() != null )
{
if ( configuration.getDatabaseScanning().getCleanupConsumers().isEmpty() && section != null )
{
section.removeSubset( "databaseScanning.cleanupConsumers" );
}
if ( configuration.getDatabaseScanning().getUnprocessedConsumers().isEmpty() && section != null )
{
section.removeSubset( "databaseScanning.unprocessedConsumers" );
}
}
new ConfigurationRegistryWriter().write( configuration, section );
section.save();
@ -522,11 +511,7 @@ public class DefaultArchivaConfiguration
c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) );
}
DatabaseScanningConfiguration scanning = configuration.getDatabaseScanning();
if ( scanning != null )
{
scanning.setCronExpression( escapeCronExpression( scanning.getCronExpression() ) );
}
}
private Registry createDefaultConfigurationFile()
@ -735,12 +720,7 @@ public class DefaultArchivaConfiguration
c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) );
}
DatabaseScanningConfiguration databaseScanning = config.getDatabaseScanning();
if ( databaseScanning != null )
{
String cron = databaseScanning.getCronExpression();
databaseScanning.setCronExpression( unescapeCronExpression( cron ) );
}
return config;
}

View File

@ -136,17 +136,6 @@
The repository scanning configuration.
</description>
</field>
<field>
<name>databaseScanning</name>
<version>1.0.0+</version>
<association>
<type>DatabaseScanningConfiguration</type>
<multiplicity>1</multiplicity>
</association>
<description>
The database scanning configuration.
</description>
</field>
<field>
<name>webapp</name>
<version>1.0.0+</version>
@ -1076,50 +1065,6 @@
</field>
</fields>
</class>
<class>
<name>DatabaseScanningConfiguration</name>
<version>1.0.0+</version>
<description>
The scanning configuration for unprocessed ArchivaArtifact database objects.
</description>
<fields>
<field>
<name>cronExpression</name>
<version>1.0.0+</version>
<type>String</type>
<description>When to run the database scanning mechanism. Default is every two hours on the hour.
</description>
<defaultValue>0 0 0/2 * * ?</defaultValue>
</field>
<field>
<name>unprocessedConsumers</name>
<version>1.0.0+</version>
<required>true</required>
<association>
<type>String</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of consumers for the unprocessed ArchivaArtifact database objects.
</description>
</field>
<field>
<name>cleanupConsumers</name>
<version>1.0.0+</version>
<required>true</required>
<deprecated>true</deprecated>
<association>
<type>String</type>
<multiplicity>*</multiplicity>
</association>
<description>
The list of consumers for previously processed ArchivaArtifact database
objects that no longer exist on the filesystem, and might need to
undergo a cleanup.
</description>
</field>
</fields>
</class>
<!--
__ _______ ____ _ ____ ____

View File

@ -174,11 +174,6 @@ public class ArchivaConfigurationTest
assertNotNull( "check 'artifacts' file type", patterns );
assertEquals( "check 'artifacts' patterns", 13, patterns.size() );
DatabaseScanningConfiguration dbScanning = configuration.getDatabaseScanning();
assertNotNull( "check database scanning", dbScanning );
assertEquals( "check unprocessed consumers", 6, dbScanning.getUnprocessedConsumers().size() );
assertEquals( "check cleanup consumers", 3, dbScanning.getCleanupConsumers().size() );
WebappConfiguration webapp = configuration.getWebapp();
assertNotNull( "check webapp", webapp );
@ -731,7 +726,6 @@ public class ArchivaConfigurationTest
assertEquals( "check cron expression", "0 0,30 * * * ?", repository.getRefreshCronExpression().trim() );
configuration.getDatabaseScanning().setCronExpression( "0 0,15 0 * * ?" );
// add a test listener to confirm it doesn't see the escaped format. We don't need to test the number of calls,
// etc. as it's done in other tests
@ -741,10 +735,6 @@ public class ArchivaConfigurationTest
{
assertEquals( ConfigurationEvent.SAVED, event.getType() );
Configuration configuration = archivaConfiguration.getConfiguration();
assertEquals( "check cron expression", "0 0,15 0 * * ?",
configuration.getDatabaseScanning().getCronExpression() );
}
} );
@ -752,9 +742,6 @@ public class ArchivaConfigurationTest
configuration = archivaConfiguration.getConfiguration();
assertEquals( "check cron expression", "0 0,15 0 * * ?",
configuration.getDatabaseScanning().getCronExpression() );
// test for the escape character '\' showing up on repositories.jsp
repository.setRefreshCronExpression( "0 0,20 0 * * ?" );
@ -833,16 +820,6 @@ public class ArchivaConfigurationTest
scanning.removeInvalidContentConsumer( consumer );
assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
DatabaseScanningConfiguration databaseScanning = configuration.getDatabaseScanning();
consumer = (String) databaseScanning.getCleanupConsumers().get( 0 );
assertNotNull( consumer );
databaseScanning.removeCleanupConsumer( consumer );
assertTrue( databaseScanning.getCleanupConsumers().isEmpty() );
consumer = (String) databaseScanning.getUnprocessedConsumers().get( 0 );
assertNotNull( consumer );
databaseScanning.removeUnprocessedConsumer( consumer );
assertTrue( databaseScanning.getUnprocessedConsumers().isEmpty() );
archivaConfiguration.save( configuration );
archivaConfiguration = (ArchivaConfiguration) lookup( ArchivaConfiguration.class, "test-read-saved" );
@ -856,9 +833,6 @@ public class ArchivaConfigurationTest
scanning = configuration.getRepositoryScanning();
assertTrue( scanning.getKnownContentConsumers().isEmpty() );
assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
databaseScanning = configuration.getDatabaseScanning();
assertTrue( databaseScanning.getCleanupConsumers().isEmpty() );
assertTrue( databaseScanning.getUnprocessedConsumers().isEmpty() );
}
/**