{
ProxyConnector proxyConnector = new ProxyConnector();
proxyConnector.setSourceRepoId( "snapshots" );
proxyConnector.setTargetRepoId( "central" );
ProxyConnectorRuleService service = getProxyConnectorRuleService( authorizationHeader );
ProxyConnectorRule rule = null;
try
{
int size = service.getProxyConnectorRules().size();
assertEquals( 0, size );
getProxyConnectorService().addProxyConnector( proxyConnector );
rule = new ProxyConnectorRule( "org/apache/maven", ProxyConnectorRuleType.BLACK_LIST,
Arrays.asList( proxyConnector ) );
service.addProxyConnectorRule( rule );
assertEquals( size + 1, service.getProxyConnectorRules().size() );
rule = service.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() );
assertEquals( ProxyConnectorRuleType.BLACK_LIST, rule.getProxyConnectorRuleType() );
}
finally
{
service.deleteProxyConnectorRule( rule );
getProxyConnectorService().deleteProxyConnector( proxyConnector );
}
}