/** * Method addPattern * * @param string */ public void addPattern(String string) { if ( !(string instanceof String) ) { throw new ClassCastException( "RepositoryTargetResource.addPatterns(string) parameter must be instanceof " + String.class.getName() ); } getPatterns().add( string ); } //-- void addPattern(String)
/** * Method removePattern * * @param string */ public void removePattern(String string) { if ( !(string instanceof String) ) { throw new ClassCastException( "RepositoryTargetResource.removePatterns(string) parameter must be instanceof " + String.class.getName() ); } getPatterns().remove( string ); } //-- void removePattern(String)
@Override public List<String> patterns() { return settings().getPatterns(); }
public RepositoryTargetResource createTarget( RepositoryTargetResource target ) throws IOException { Response response = this.sendMessage( Method.POST, target ); String responseText = response.getEntity().getText(); Assert.assertTrue( "Could not create Repository Target: " + response.getStatus() + "\nResponse Text:\n" + responseText + "\n" + xstream.toXML( target ), response.getStatus().isSuccess() ); // get the Resource object RepositoryTargetResource responseResource = this.getResourceFromResponse( responseText ); // validate // make sure the id != null Assert.assertTrue( StringUtils.isNotEmpty( responseResource.getId() ) ); Assert.assertEquals( target.getContentClass(), responseResource.getContentClass() ); Assert.assertEquals( target.getName(), responseResource.getName() ); Assert.assertEquals( target.getPatterns(), responseResource.getPatterns() ); this.verifyTargetsConfig( responseResource ); return responseResource; }
Assert.assertEquals( targetResource.getContentClass(), repositoryTarget.getContentClass() ); Assert.assertEquals( targetResource.getName(), repositoryTarget.getName() ); Assert.assertEquals( targetResource.getPatterns(), repositoryTarget.getPatterns() );
protected Target getRestToNexusResource(RepositoryTargetResource resource) throws ConfigurationException, PatternSyntaxException { ContentClass cc = getRepositoryTypeRegistry().getContentClasses().get(resource.getContentClass()); if (cc == null) { throw new ConfigurationException("Content class with ID=\"" + resource.getContentClass() + "\" does not exists!"); } Target target = new Target(resource.getId(), resource.getName(), cc, resource.getPatterns()); return target; }
protected Target getRestToNexusResource( RepositoryTargetResource resource ) throws ConfigurationException, PatternSyntaxException { ContentClass cc = getRepositoryTypeRegistry().getContentClasses().get( resource.getContentClass() ); if ( cc == null ) { throw new ConfigurationException( "Content class with ID=\"" + resource.getContentClass() + "\" does not exists!" ); } Target target = new Target( resource.getId(), resource.getName(), cc, resource.getPatterns() ); return target; }
Assert.assertEquals(repositoryTarget.getName(), targetResource.getName()); Assert.assertEquals(new HashSet<String>(targetResource.getPatterns()), new HashSet<String>( repositoryTarget.getPatterns()));
public RepositoryTargetResource saveTarget(RepositoryTargetResource target, boolean update) throws IOException { Response response = null; String entityText; try { response = this.sendMessage(update ? Method.PUT : Method.POST, target); entityText = response.getEntity().getText(); assertThat(response, isSuccessful()); } finally { RequestFacade.releaseResponse(response); } // get the Resource object RepositoryTargetResource responseResource = this.getResourceFromResponse(entityText); // validate // make sure the id != null Assert.assertTrue(StringUtils.isNotEmpty(responseResource.getId())); if (update) { Assert.assertEquals(responseResource.getId(), target.getId()); } Assert.assertEquals(responseResource.getContentClass(), target.getContentClass()); Assert.assertEquals(responseResource.getName(), target.getName()); Assert.assertEquals(target.getPatterns(), responseResource.getPatterns()); this.verifyTargetsConfig(responseResource); return responseResource; }