mirror of https://github.com/apache/archiva.git
add some snippet for using it in documentation
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1171573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
35ec0651a4
commit
f44fe02ef2
|
@ -42,8 +42,11 @@ import java.io.File;
|
||||||
public abstract class AbstractArchivaRestTest
|
public abstract class AbstractArchivaRestTest
|
||||||
extends AbstractRestServicesTest
|
extends AbstractRestServicesTest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// START SNIPPET: authz-header
|
||||||
public String guestAuthzHeader =
|
public String guestAuthzHeader =
|
||||||
"Basic " + org.apache.cxf.common.util.Base64Utility.encode( ( "guest" + ":" ).getBytes() );
|
"Basic " + org.apache.cxf.common.util.Base64Utility.encode( ( "guest" + ":" ).getBytes() );
|
||||||
|
// END SNIPPET: authz-header
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getSpringConfigLocation()
|
protected String getSpringConfigLocation()
|
||||||
|
@ -149,6 +152,7 @@ public abstract class AbstractArchivaRestTest
|
||||||
|
|
||||||
protected SearchService getSearchService( String authzHeader )
|
protected SearchService getSearchService( String authzHeader )
|
||||||
{
|
{
|
||||||
|
// START SNIPPET: cxf-searchservice-creation
|
||||||
SearchService service =
|
SearchService service =
|
||||||
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
|
JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/archivaServices/",
|
||||||
SearchService.class );
|
SearchService.class );
|
||||||
|
@ -159,6 +163,7 @@ public abstract class AbstractArchivaRestTest
|
||||||
}
|
}
|
||||||
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
|
WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 );
|
||||||
return service;
|
return service;
|
||||||
|
// END SNIPPET: cxf-searchservice-creation
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,10 +77,13 @@ public class SearchServiceTest
|
||||||
|
|
||||||
File targetRepo = createAndIndexRepo( testRepoId );
|
File targetRepo = createAndIndexRepo( testRepoId );
|
||||||
|
|
||||||
|
// START SNIPPET: searchservice-artifact-versions
|
||||||
SearchService searchService = getSearchService( authorizationHeader );
|
SearchService searchService = getSearchService( authorizationHeader );
|
||||||
|
|
||||||
List<Artifact> artifacts = searchService.getArtifactVersions( "commons-logging", "commons-logging", "jar" );
|
List<Artifact> artifacts = searchService.getArtifactVersions( "commons-logging", "commons-logging", "jar" );
|
||||||
|
|
||||||
|
// END SNIPPET: searchservice-artifact-versions
|
||||||
|
|
||||||
assertNotNull( artifacts );
|
assertNotNull( artifacts );
|
||||||
assertTrue( " not 3 results for commons-logging search but " + artifacts.size() + ":" + artifacts,
|
assertTrue( " not 3 results for commons-logging search but " + artifacts.size() + ":" + artifacts,
|
||||||
artifacts.size() == 13 );
|
artifacts.size() == 13 );
|
||||||
|
|
Loading…
Reference in New Issue