@Subscribe public void onEvent( final RepositoryRegistryEventRemove evt ) { final String repoId = evt.getRepository().getId(); List<CPathMappingItem> pathMappings = getCurrentConfiguration( true ).getPathMappings(); for ( Iterator<CPathMappingItem> iterator = pathMappings.iterator(); iterator.hasNext(); ) { CPathMappingItem item = iterator.next(); if ( item.getGroupId().equals( repoId ) ) { iterator.remove(); } else { item.removeRepository( repoId ); } } }
protected RepositoryPathMapping convert( CPathMappingItem item ) throws IllegalArgumentException { MappingType type = null; if ( CPathMappingItem.BLOCKING_RULE_TYPE.equals( item.getRouteType() ) ) { type = MappingType.BLOCKING; } else if ( CPathMappingItem.INCLUSION_RULE_TYPE.equals( item.getRouteType() ) ) { type = MappingType.INCLUSION; } else if ( CPathMappingItem.EXCLUSION_RULE_TYPE.equals( item.getRouteType() ) ) { type = MappingType.EXCLUSION; } else { logger.warn( "Unknown route type: " + item.getRouteType() ); throw new IllegalArgumentException( "Unknown route type: " + item.getRouteType() ); } return new RepositoryPathMapping( item.getId(), type, item.getGroupId(), item.getRoutePatterns(), item.getRepositories() ); }
public void validateRoutesConfig(RepositoryRouteResource resource) throws IOException { CPathMappingItem cRoute = getTest().getNexusConfigUtil().getRoute(resource.getId()); String msg = "Should be the same route. \n Expected:\n" + new XStream().toXML(resource) + " \n \n Got: \n" + new XStream().toXML(cRoute); Assert.assertEquals(msg, cRoute.getId(), resource.getId()); Assert.assertEquals(msg, cRoute.getGroupId(), resource.getGroupId()); Assert.assertEquals(msg, cRoute.getRoutePatterns(), Collections.singletonList(resource.getPattern())); Assert.assertEquals(msg, cRoute.getRouteType(), resource.getRuleType()); this.validateSameRepoIds(resource.getRepositories(), cRoute.getRepositories()); }
if ( cPathMappingItem.getGroupId() != null ) serializer.startTag( NAMESPACE, "groupId" ).text( cPathMappingItem.getGroupId() ).endTag( NAMESPACE, "groupId" );
if ( StringUtils.isEmpty( item.getGroupId() ) )
if ( StringUtils.isEmpty( item.getGroupId() ) )