ProxyConnector proxyConnector2 = new ProxyConnector();
proxyConnector2.setSourceRepoId( "snapshots" );
proxyConnector2.setTargetRepoId( "archiva" );
proxyConnectorAdmin.addProxyConnector( proxyConnector2, getFakeAuditInformation() );
ProxyConnectorRule rule = new ProxyConnectorRule( "org/apache/maven", ProxyConnectorRuleType.BLACK_LIST,
Arrays.asList( proxyConnector1, proxyConnector2 ) );
try
{
proxyConnectorRuleAdmin.addProxyConnectorRule( rule, getFakeAuditInformation() );
assertEquals( size + 1, proxyConnectorRuleAdmin.getProxyConnectorRules().size() );
rule = proxyConnectorRuleAdmin.getProxyConnectorRules().get( 0 );
assertEquals( "org/apache/maven", rule.getPattern() );
assertEquals( 2, rule.getProxyConnectors().size() );
//assertEquals( "snapshots", rule.getProxyConnectors().get( 0 ).getSourceRepoId() );
//assertEquals( "central", rule.getProxyConnectors().get( 0 ).getTargetRepoId() );
assertEquals( ProxyConnectorRuleType.BLACK_LIST, rule.getProxyConnectorRuleType() );
rule.setProxyConnectors( Arrays.asList( proxyConnector1 ) );
proxyConnectorRuleAdmin.updateProxyConnectorRule( rule, getFakeAuditInformation() );
assertEquals( size + 1, proxyConnectorRuleAdmin.getProxyConnectorRules().size() );
rule = proxyConnectorRuleAdmin.getProxyConnectorRules().get( 0 );
assertEquals( "org/apache/maven", rule.getPattern() );
assertEquals( 1, rule.getProxyConnectors().size() );
assertEquals( "snapshots", rule.getProxyConnectors().get( 0 ).getSourceRepoId() );
assertEquals( "central", rule.getProxyConnectors().get( 0 ).getTargetRepoId() );
}
finally
{
proxyConnectorRuleAdmin.deleteProxyConnectorRule( rule, getFakeAuditInformation() );