@Override public String name() { return settings().getName(); }
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.getId(), repositoryTarget.getId() ); 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.getId(), targetResource.getId()); Assert.assertEquals(repositoryTarget.getContentClass(), targetResource.getContentClass()); Assert.assertEquals(repositoryTarget.getName(), targetResource.getName());
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; }