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();
c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) );
}
- DatabaseScanningConfiguration scanning = configuration.getDatabaseScanning();
- if ( scanning != null )
- {
- scanning.setCronExpression( escapeCronExpression( scanning.getCronExpression() ) );
- }
+
}
private Registry createDefaultConfigurationFile()
c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) );
}
- DatabaseScanningConfiguration databaseScanning = config.getDatabaseScanning();
- if ( databaseScanning != null )
- {
- String cron = databaseScanning.getCronExpression();
- databaseScanning.setCronExpression( unescapeCronExpression( cron ) );
- }
+
return config;
}
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>
</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>
<!--
__ _______ ____ _ ____ ____
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 );
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
{
assertEquals( ConfigurationEvent.SAVED, event.getType() );
- Configuration configuration = archivaConfiguration.getConfiguration();
-
- assertEquals( "check cron expression", "0 0,15 0 * * ?",
- configuration.getDatabaseScanning().getCronExpression() );
}
} );
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 * * ?" );
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" );
scanning = configuration.getRepositoryScanning();
assertTrue( scanning.getKnownContentConsumers().isEmpty() );
assertTrue( scanning.getInvalidContentConsumers().isEmpty() );
- databaseScanning = configuration.getDatabaseScanning();
- assertTrue( databaseScanning.getCleanupConsumers().isEmpty() );
- assertTrue( databaseScanning.getUnprocessedConsumers().isEmpty() );
}
/**