From 9d345b6c945cbffa3ed35f3e0420ae9c661dcf6d Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Mon, 3 Nov 2008 22:23:23 +0000 Subject: [PATCH] [MRM-206] -added search + test cases in web services git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@710189 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/indexer/util/SearchUtil.java | 62 +++ .../archiva/web/action/SearchAction.java | 25 +- .../webapp/WEB-INF/applicationContext.xml | 24 +- .../archiva-xmlrpc/archiva-xmlrpc-api/pom.xml | 4 + .../archiva/web/xmlrpc/api/SearchService.java | 30 ++ .../web/xmlrpc/api/beans/Artifact.java | 124 ++++++ .../archiva-xmlrpc-client/pom.xml | 6 +- .../ServiceMethodsPermissionsMapping.java | 16 +- .../xmlrpc/security/XmlRpcAuthenticator.java | 52 ++- .../security/XmlRpcUserRepositories.java | 48 +++ .../security/XmlRpcAuthenticatorTest.java | 8 +- .../archiva-xmlrpc-services/pom.xml | 30 ++ .../xmlrpc/services/SearchServiceImpl.java | 205 ++++++++++ .../services/SearchServiceImplTest.java | 387 ++++++++++++++++++ .../archiva-test/1.0/archiva-test-1.0.pom | 18 + 15 files changed, 996 insertions(+), 43 deletions(-) create mode 100644 archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/util/SearchUtil.java create mode 100644 archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java create mode 100644 archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java create mode 100644 archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java create mode 100644 archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/util/SearchUtil.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/util/SearchUtil.java new file mode 100644 index 000000000..3a57ec8c8 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/util/SearchUtil.java @@ -0,0 +1,62 @@ +package org.apache.archiva.indexer.util; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import org.apache.commons.lang.StringUtils; + +/** + * SearchUtil - utility class for search. + * + * @version + */ +public class SearchUtil +{ + public static final String BYTECODE_KEYWORD = "bytecode:"; + + /** + * Determines whether the queryString has the bytecode keyword. + * + * @param queryString + * @return + */ + public static boolean isBytecodeSearch( String queryString ) + { + if ( queryString.startsWith( BYTECODE_KEYWORD ) ) + { + return true; + } + + return false; + } + + /** + * Removes the bytecode keyword from the query string. + * + * @param queryString + * @return + */ + public static String removeBytecodeKeyword( String queryString ) + { + String qString = StringUtils.uncapitalize( queryString ); + qString = StringUtils.remove( queryString, BYTECODE_KEYWORD ); + + return qString; + } +} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java index c7b21e596..939dbc51a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.archiva.indexer.util.SearchUtil; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; @@ -106,8 +107,6 @@ public class SearchAction private static final String COMPLETE_QUERY_STRING_SEPARATOR = ";"; - private static final String BYTECODE_KEYWORD = "bytecode:"; - private List managedRepositoryList; private String groupId; @@ -232,9 +231,9 @@ public class SearchAction return GlobalResults.ACCESS_TO_NO_REPOS; } - if( isBytecodeSearch( q ) ) + if( SearchUtil.isBytecodeSearch( q ) ) { - results = crossRepoSearch.searchForBytecode( getPrincipal(), selectedRepos, removeKeyword( q ), limits ); + results = crossRepoSearch.searchForBytecode( getPrincipal(), selectedRepos, SearchUtil.removeBytecodeKeyword( q ), limits ); } else { @@ -439,24 +438,6 @@ public class SearchAction this.completeQueryString = completeQueryString; } - private boolean isBytecodeSearch( String queryString ) - { - if ( queryString.startsWith( BYTECODE_KEYWORD ) ) - { - return true; - } - - return false; - } - - private String removeKeyword( String queryString ) - { - String qString = StringUtils.uncapitalize( queryString ); - qString = StringUtils.remove( queryString, BYTECODE_KEYWORD ); - - return qString; - } - public ArchivaConfiguration getArchivaConfiguration() { return archivaConfiguration; diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml index a45d39c0b..ae629d574 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml @@ -32,7 +32,25 @@ + + + + + + + + + + + + + + + @@ -46,12 +64,12 @@ + - - - + + diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml index ac145568f..8dc30b5d3 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/pom.xml @@ -32,6 +32,10 @@ archiva-xmlrpc-api Archiva Web :: XML-RPC API + + org.apache.archiva + archiva-indexer + com.atlassian.xmlrpc atlassian-xmlrpc-binder-annotations diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java index cbc47547f..d820be458 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/SearchService.java @@ -19,10 +19,40 @@ package org.apache.archiva.web.xmlrpc.api; * under the License. */ +import java.util.Date; +import java.util.List; + +import org.apache.archiva.web.xmlrpc.api.beans.Artifact; import com.atlassian.xmlrpc.ServiceObject; @ServiceObject("Search") public interface SearchService { + /* + * quick/general text search which returns a list of artifacts + * query for an artifact based on a checksum + * query for all available versions of an artifact, sorted in version significance order + * query for all available versions of an artifact since a given date + * query for an artifact's direct dependencies + * query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included) + * query for all artifacts that depend on a given artifact + */ + public List quickSearch( String queryString ) + throws Exception; + + public List getArtifactByChecksum( String checksum) throws Exception; + + public List getArtifactVersions( String groupId, String artifactId ) throws Exception; + + public List getArtifactVersionsByDate( String groupId, String artifactId, String version, Date whenGathered ) + throws Exception; + + public List getDirectDependencies( String repositoryId, String groupId, String artifactId, String version ) + throws Exception; + + public List getDependencyTree( String groupId, String artifactId, String version ) throws Exception; + + public List getDependees( String groupId, String artifactId, String version ) + throws Exception; } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java new file mode 100644 index 000000000..bc553e3cd --- /dev/null +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/beans/Artifact.java @@ -0,0 +1,124 @@ +package org.apache.archiva.web.xmlrpc.api.beans; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.io.Serializable; +import java.util.Date; + +import com.atlassian.xmlrpc.ServiceBean; +import com.atlassian.xmlrpc.ServiceBeanField; + +@ServiceBean +public class Artifact + implements Serializable +{ + private String repositoryId; + + private String groupId; + + private String artifactId; + + private String version; + + private String type; + + private Date whenGathered; + + public Artifact() + { + + } + + public Artifact( String repositoryId, String groupId, String artifactId, String version, + String type, Date whenGathered ) + { + this.repositoryId = repositoryId; + this.groupId = groupId; + this.artifactId = artifactId; + this.version = version; + this.type = type; + this.whenGathered = whenGathered; + } + + public String getGroupId() + { + return groupId; + } + + public String getArtifactId() + { + return artifactId; + } + + public String getVersion() + { + return version; + } + + public String getType() + { + return type; + } + + public Date getWhenGathered() + { + return whenGathered; + } + + @ServiceBeanField( "groupId" ) + public void setGroupId( String groupId ) + { + this.groupId = groupId; + } + + @ServiceBeanField( "artifactId" ) + public void setArtifactId( String artifactId ) + { + this.artifactId = artifactId; + } + + @ServiceBeanField( "version" ) + public void setVersion( String version ) + { + this.version = version; + } + + @ServiceBeanField( "type" ) + public void setType( String type ) + { + this.type = type; + } + + @ServiceBeanField( "whenGathered" ) + public void setWhenGathered( Date whenGathered ) + { + this.whenGathered = whenGathered; + } + + public String getRepositoryId() + { + return repositoryId; + } + + public void setRepositoryId( String repositoryId ) + { + this.repositoryId = repositoryId; + } +} diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml index 1e73dc933..8410e2267 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-client/pom.xml @@ -54,9 +54,9 @@ URL: ex. http://127.0.0.1:8080/archiva/xmlrpc USERNAME & PASSWORD: Archiva credentials --> - URL - USERNAME - PASSWORD + http://127.0.0.1:8080/archiva/xmlrpc + admin + admin1 diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java index 333b4218e..133820a8e 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/ServiceMethodsPermissionsMapping.java @@ -1,6 +1,5 @@ package org.apache.archiva.web.xmlrpc.security; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -56,7 +55,18 @@ public class ServiceMethodsPermissionsMapping public static final List SERVICE_METHODS_FOR_OPERATION_ACCESS_REPORT = new ArrayList(); - public static final List SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS = new ArrayList(); + public static final List SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS = new ArrayList() + { + { + add( "SearchService.quickSearch" ); + add( "SearchService.getArtifactByChecksum" ); + add( "SearchService.getArtifactVersions" ); + add( "SearchService.queryArtifactVersionsByDate" ); + add(" SearchService.getDirectDependencies" ); + add(" SearchService.getDirectDependencyTree" ); + add(" SearchService.getDependees" ); + } + }; public static final List SERVICE_METHODS_FOR_OPERATION_ADD_REPOSITORY = new ArrayList(); @@ -64,6 +74,6 @@ public class ServiceMethodsPermissionsMapping public static final List SERVICE_METHODS_FOR_OPERATION_EDIT_REPOSITORY = new ArrayList(); - public static final List SERVICE_METHODS_FOR_OPERATION_REPOSITORY_UPLOAD = new ArrayList(); + public static final List SERVICE_METHODS_FOR_OPERATION_REPOSITORY_UPLOAD = new ArrayList(); } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java index 40ee2fd6f..de7419e58 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcAuthenticator.java @@ -19,7 +19,11 @@ package org.apache.archiva.web.xmlrpc.security; * under the License. */ +import java.util.List; + import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.apache.maven.archiva.security.ArchivaSecurityException; +import org.apache.maven.archiva.security.UserRepositories; import org.apache.xmlrpc.XmlRpcException; import org.apache.xmlrpc.XmlRpcRequest; import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl; @@ -44,23 +48,32 @@ public class XmlRpcAuthenticator implements AuthenticationHandler { private final SecuritySystem securitySystem; - - public XmlRpcAuthenticator( SecuritySystem securitySystem ) + + private UserRepositories userRepositories; + + private String username; + + public XmlRpcAuthenticator( SecuritySystem securitySystem, UserRepositories userRepositories ) { this.securitySystem = securitySystem; + this.userRepositories = userRepositories; } - + public boolean isAuthorized( XmlRpcRequest pRequest ) throws XmlRpcException { + System.out.println( "authenticator is called for request '" + pRequest.getMethodName() + "'" ); + if ( pRequest.getConfig() instanceof XmlRpcHttpRequestConfigImpl ) { XmlRpcHttpRequestConfigImpl config = (XmlRpcHttpRequestConfigImpl) pRequest.getConfig(); + username = config.getBasicUserName(); SecuritySession session = - authenticate( new PasswordBasedAuthenticationDataSource( config.getBasicUserName(), + authenticate( new PasswordBasedAuthenticationDataSource( username, config.getBasicPassword() ) ); + String method = pRequest.getMethodName(); - AuthorizationResult result = authorize( session, method ); + AuthorizationResult result = authorize( session, method, username ); return result.isAuthorized(); } @@ -89,13 +102,12 @@ public class XmlRpcAuthenticator } } - private AuthorizationResult authorize( SecuritySession session, String methodName ) + private AuthorizationResult authorize( SecuritySession session, String methodName, String username ) throws XmlRpcException { try - { + { // sample attempt at simplifying authorization checking of requested service method - // TODO test with a sample client to see if this would work! if ( ServiceMethodsPermissionsMapping.SERVICE_METHODS_FOR_OPERATION_MANAGE_CONFIGURATION.contains( methodName ) ) { return securitySystem.authorize( session, ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION ); @@ -104,6 +116,25 @@ public class XmlRpcAuthenticator { return securitySystem.authorize( session, ArchivaRoleConstants.OPERATION_RUN_INDEXER ); } + else if ( ServiceMethodsPermissionsMapping.SERVICE_METHODS_FOR_OPERATION_REPOSITORY_ACCESS.contains( methodName ) ) + { + try + { + List observableRepos = userRepositories.getObservableRepositoryIds( username ); + if( observableRepos != null && observableRepos.size() > 1 ) + { + return new AuthorizationResult( true, username, null ); + } + else + { + return new AuthorizationResult( false, username, null ); + } + } + catch ( ArchivaSecurityException e ) + { + throw new XmlRpcException( 401, e.getMessage() ); + } + } else { return securitySystem.authorize( session, ArchivaRoleConstants.GLOBAL_REPOSITORY_MANAGER_ROLE ); @@ -114,4 +145,9 @@ public class XmlRpcAuthenticator throw new XmlRpcException( 401, e.getMessage(), e ); } } + + public String getActiveUser() + { + return username; + } } diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java new file mode 100644 index 000000000..996458e95 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/main/java/org/apache/archiva/web/xmlrpc/security/XmlRpcUserRepositories.java @@ -0,0 +1,48 @@ +package org.apache.archiva.web.xmlrpc.security; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.List; + +import org.apache.maven.archiva.security.ArchivaSecurityException; +import org.apache.maven.archiva.security.PrincipalNotFoundException; +import org.apache.maven.archiva.security.UserRepositories; +import org.apache.xmlrpc.server.AbstractReflectiveHandlerMapping.AuthenticationHandler; + +public class XmlRpcUserRepositories +{ + private UserRepositories userRepositories; + + private AuthenticationHandler authnHandler; + + public XmlRpcUserRepositories( UserRepositories userRepositories, AuthenticationHandler authnHandler ) + { + this.userRepositories = userRepositories; + this.authnHandler = authnHandler; + } + + public List getObservableRepositories() + throws PrincipalNotFoundException, ArchivaSecurityException + { + XmlRpcAuthenticator xmlRpcAuthn = (XmlRpcAuthenticator) authnHandler; + + return userRepositories.getObservableRepositoryIds( xmlRpcAuthn.getActiveUser() ); + } +} diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java index 721aa828d..e3640d249 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-security/src/test/java/org/apache/archiva/xmlrpc/security/XmlRpcAuthenticatorTest.java @@ -89,7 +89,7 @@ public class XmlRpcAuthenticatorTest xmlRpcRequestControl = MockControl.createControl( XmlRpcRequest.class ); xmlRpcRequest = ( XmlRpcRequest ) xmlRpcRequestControl.getMock(); - authenticator = new XmlRpcAuthenticator( securitySystem ); + authenticator = new XmlRpcAuthenticator( securitySystem, null ); } private User createUser( String principal, String fullname, String password ) @@ -131,7 +131,7 @@ public class XmlRpcAuthenticatorTest configControl.expectAndReturn( config.getBasicPassword(), PASSWORD ); xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(), - "AdministrationService.getAllManagedRepositories" ); + "AdministrationService.getAllManagedRepositories", 2 ); xmlRpcRequestControl.replay(); configControl.replay(); @@ -171,7 +171,7 @@ public class XmlRpcAuthenticatorTest configControl.expectAndReturn( config.getBasicPassword(), PASSWORD ); xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(), - "AdministrationService.getAllManagedRepositories" ); + "AdministrationService.getAllManagedRepositories", 2 ); xmlRpcRequestControl.replay(); configControl.replay(); @@ -205,7 +205,7 @@ public class XmlRpcAuthenticatorTest configControl.expectAndReturn( config.getBasicPassword(), PASSWORD ); xmlRpcRequestControl.expectAndReturn( xmlRpcRequest.getMethodName(), - "AdministrationService.getAllManagedRepositories" ); + "AdministrationService.getAllManagedRepositories", 2 ); xmlRpcRequestControl.replay(); configControl.replay(); diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml index 8d68c8df3..edb8e9a00 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/pom.xml @@ -32,6 +32,36 @@ archiva-xmlrpc-services Archiva Web :: XML-RPC Services + + org.apache.xmlrpc + xmlrpc-server + + + commons-logging + commons-logging + + + + + org.apache.archiva + archiva-xmlrpc-api + + + org.apache.archiva + archiva-xmlrpc-security + + + org.apache.archiva + archiva-model + + + org.apache.archiva + archiva-security + + + org.apache.archiva + archiva-indexer + org.apache.archiva archiva-xmlrpc-api diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java new file mode 100644 index 000000000..407412466 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImpl.java @@ -0,0 +1,205 @@ +package org.apache.archiva.web.xmlrpc.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.archiva.indexer.util.SearchUtil; +import org.apache.archiva.web.xmlrpc.api.SearchService; +import org.apache.archiva.web.xmlrpc.api.beans.Artifact; +import org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories; +import org.apache.maven.archiva.database.ArchivaDAO; +import org.apache.maven.archiva.database.ArtifactDAO; +import org.apache.maven.archiva.database.browsing.BrowsingResults; +import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; +import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint; +import org.apache.maven.archiva.indexer.search.CrossRepositorySearch; +import org.apache.maven.archiva.indexer.search.SearchResultHit; +import org.apache.maven.archiva.indexer.search.SearchResultLimits; +import org.apache.maven.archiva.indexer.search.SearchResults; +import org.apache.maven.archiva.model.ArchivaArtifact; + +/** + * SearchServiceImpl + * + * @version $Id: SearchServiceImpl.java + */ +public class SearchServiceImpl + implements SearchService +{ + + private CrossRepositorySearch crossRepoSearch; + + private XmlRpcUserRepositories xmlRpcUserRepositories; + + private ArchivaDAO archivaDAO; + + private RepositoryBrowsing repoBrowsing; + + public SearchServiceImpl( XmlRpcUserRepositories xmlRpcUserRepositories, CrossRepositorySearch crossRepoSearch, + ArchivaDAO archivaDAO, RepositoryBrowsing repoBrowsing ) + { + this.xmlRpcUserRepositories = xmlRpcUserRepositories; + this.crossRepoSearch = crossRepoSearch; + this.archivaDAO = archivaDAO; + this.repoBrowsing = repoBrowsing; + } + + /* + * quick/general text search which returns a list of artifacts + * query for an artifact based on a checksum + * query for all available versions of an artifact, sorted in version significance order + * query for all available versions of an artifact since a given date + * query for an artifact's direct dependencies + * query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included) + * query for all artifacts that depend on a given artifact + */ + + public List quickSearch( String queryString ) + throws Exception + { + // 1. check whether bytecode search or ordinary search + // 2. get observable repos + // 3. convert results to a list of Artifact objects + + List artifacts = new ArrayList(); + List observableRepos = xmlRpcUserRepositories.getObservableRepositories(); + SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES ); + SearchResults results = null; + + if( SearchUtil.isBytecodeSearch( queryString ) ) + { + results = crossRepoSearch.searchForBytecode( "", observableRepos, SearchUtil.removeBytecodeKeyword( queryString ), limits ); + } + else + { + results = crossRepoSearch.searchForTerm( "", observableRepos, queryString, limits ); + } + + List hits = results.getHits(); + for( SearchResultHit hit : hits ) + { + ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO(); + ArchivaArtifact pomArtifact = artifactDAO.getArtifact( + hit.getGroupId(), hit.getArtifactId(), hit.getVersion(), "", "pom" ); + + if( pomArtifact != null ) + { + Artifact artifact = new Artifact( pomArtifact.getModel().getRepositoryId(), pomArtifact.getGroupId(), pomArtifact.getArtifactId(), pomArtifact.getVersion(), + pomArtifact.getType(), pomArtifact.getModel().getWhenGathered() ); + artifacts.add( artifact ); + } + else + { + continue; + } + } + + return artifacts; + } + + public List getArtifactByChecksum( String checksum ) + throws Exception + { + // 1. get ArtifactDAO from ArchivaDAO + // 2. create ArtifactsByChecksumConstraint( "queryTerm" ) + // 3. query artifacts using constraint + // 4. convert results to list of Artifact objects + + List results = new ArrayList(); + ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO(); + + ArtifactsByChecksumConstraint constraint = new ArtifactsByChecksumConstraint( checksum ); + List artifacts = artifactDAO.queryArtifacts( constraint ); + + for( ArchivaArtifact archivaArtifact : artifacts ) + { + Artifact artifact = new Artifact( archivaArtifact.getModel().getRepositoryId(), archivaArtifact.getModel().getGroupId(), + archivaArtifact.getModel().getArtifactId(), archivaArtifact.getModel().getVersion(), archivaArtifact.getType(), + archivaArtifact.getModel().getWhenGathered() ); + results.add( artifact ); + } + + return results; + } + + public List getArtifactVersions( String groupId, String artifactId ) + throws Exception + { + List artifacts = new ArrayList(); + List observableRepos = xmlRpcUserRepositories.getObservableRepositories(); + + BrowsingResults results = repoBrowsing.selectArtifactId( "", observableRepos, groupId, artifactId ); + ArtifactDAO artifactDAO = archivaDAO.getArtifactDAO(); + + for( String version : results.getVersions() ) + { + ArchivaArtifact pomArtifact = artifactDAO.getArtifact( groupId, artifactId, version, "", "pom" ); + Artifact artifact = new Artifact( "", groupId, artifactId, version, pomArtifact.getType(), + pomArtifact.getModel().getWhenGathered() ); + + artifacts.add( artifact ); + } + + // 1. get observable repositories + // 2. use RepositoryBrowsing method to query uniqueVersions? + return artifacts; + } + + public List getArtifactVersionsByDate( String groupId, String artifactId, String version, Date since ) + throws Exception + { + List artifacts = new ArrayList(); + + // 1. get observable repositories + // 2. use RepositoryBrowsing method to query uniqueVersions? (but with date) + + return artifacts; + } + + public List getDirectDependencies( String repositoryId, String groupId, String artifactId, String version ) + throws Exception + { + List artifacts = new ArrayList(); + + return artifacts; + } + + public List getDependencyTree( String groupId, String artifactId, String version ) + throws Exception + { + List a = new ArrayList(); + + return a; + } + + //get artifacts that depend on a given artifact + public List getDependees( String groupId, String artifactId, String version ) + throws Exception + { + List artifacts = new ArrayList(); + + // repo browsing usedBy? + + return artifacts; + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java new file mode 100644 index 000000000..a03f2ace7 --- /dev/null +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/SearchServiceImplTest.java @@ -0,0 +1,387 @@ +package org.apache.archiva.web.xmlrpc.services; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.archiva.web.xmlrpc.api.SearchService; +import org.apache.archiva.web.xmlrpc.api.beans.Artifact; +import org.apache.archiva.web.xmlrpc.security.XmlRpcAuthenticator; +import org.apache.archiva.web.xmlrpc.security.XmlRpcUserRepositories; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.FileTypes; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.database.ArchivaDAO; +import org.apache.maven.archiva.database.ArtifactDAO; +import org.apache.maven.archiva.database.browsing.BrowsingResults; +import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; +import org.apache.maven.archiva.database.constraints.ArtifactsByChecksumConstraint; +import org.apache.maven.archiva.indexer.filecontent.FileContentRecord; +import org.apache.maven.archiva.indexer.lucene.LuceneRepositoryContentRecord; +import org.apache.maven.archiva.indexer.search.CrossRepositorySearch; +import org.apache.maven.archiva.indexer.search.SearchResultLimits; +import org.apache.maven.archiva.indexer.search.SearchResults; +import org.apache.maven.archiva.model.ArchivaArtifact; +import org.apache.maven.archiva.model.ArchivaArtifactModel; +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.apache.maven.archiva.repository.RepositoryContentFactory; +import org.apache.maven.archiva.repository.content.ManagedDefaultRepositoryContent; +import org.apache.maven.archiva.repository.content.PathParser; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.apache.xmlrpc.XmlRpcRequest; +import org.apache.xmlrpc.common.XmlRpcHttpRequestConfigImpl; +import org.codehaus.plexus.redback.role.RoleManager; +import org.codehaus.plexus.redback.system.SecuritySystem; +import org.codehaus.plexus.redback.users.User; +import org.codehaus.plexus.redback.users.UserManager; +import org.codehaus.plexus.redback.users.UserNotFoundException; +import org.codehaus.plexus.spring.PlexusInSpringTestCase; +import org.easymock.ArgumentsMatcher; +import org.easymock.MockControl; +import org.easymock.classextension.MockClassControl; + +import sun.security.action.GetLongAction; + +/** + * SearchServiceImplTest + * + * @version $Id: SearchServiceImplTest.java + */ +public class SearchServiceImplTest + extends PlexusInSpringTestCase +{ + private SearchService searchService; + + private MockControl userReposControl; + + private XmlRpcUserRepositories userRepos; + + private MockControl crossRepoSearchControl; + + private CrossRepositorySearch crossRepoSearch; + + private MockControl archivaDAOControl; + + private ArchivaDAO archivaDAO; + + private MockControl artifactDAOControl; + + private ArtifactDAO artifactDAO; + + private MockControl repoBrowsingControl; + + private RepositoryBrowsing repoBrowsing; + + public void setUp() + throws Exception + { + userReposControl = MockClassControl.createControl( XmlRpcUserRepositories.class ); + userRepos = ( XmlRpcUserRepositories ) userReposControl.getMock(); + + crossRepoSearchControl = MockControl.createControl( CrossRepositorySearch.class ); + crossRepoSearch = ( CrossRepositorySearch ) crossRepoSearchControl.getMock(); + + archivaDAOControl = MockControl.createControl( ArchivaDAO.class ); + archivaDAO = ( ArchivaDAO ) archivaDAOControl.getMock(); + + repoBrowsingControl = MockControl.createControl( RepositoryBrowsing.class ); + repoBrowsing = ( RepositoryBrowsing ) repoBrowsingControl.getMock(); + + searchService = new SearchServiceImpl( userRepos, crossRepoSearch, archivaDAO, repoBrowsing ); + + artifactDAOControl = MockControl.createControl( ArtifactDAO.class ); + artifactDAO = ( ArtifactDAO ) artifactDAOControl.getMock(); + } + + /* + * quick/general text search which returns a list of artifacts + * query for an artifact based on a checksum + * query for all available versions of an artifact, sorted in version significance order + * query for all available versions of an artifact since a given date + * query for an artifact's direct dependencies + * query for an artifact's dependency tree (as with mvn dependency:tree - no duplicates should be included) + * query for all artifacts that depend on a given artifact + */ + + /* quick search */ + + public void testQuickSearchArtifactBytecodeSearch() + throws Exception + { + // 1. check whether bytecode search or ordinary search + // 2. get observable repos + // 3. convert results to a list of Artifact objects + + List observableRepoIds = new ArrayList(); + observableRepoIds.add( "repo1.mirror" ); + observableRepoIds.add( "public.releases" ); + + userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds ); + + Date whenGathered = new Date(); + SearchResults results = new SearchResults(); + ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "jar" ); + artifact.getModel().setWhenGathered( whenGathered ); + + FileContentRecord record = new FileContentRecord(); + record.setRepositoryId( "repo1.mirror" ); + record.setArtifact( artifact ); + record.setContents( "org.apache.archiva:archiva-test:1.0:jar org.apache.archiva.test.MyClassName" ); + record.setFilename( "archiva-test-1.0.jar" ); + + results.addHit( record ); + + SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES ); + + crossRepoSearchControl.expectAndDefaultReturn( + crossRepoSearch.searchForBytecode( "", observableRepoIds, "MyClassName", limits ), results ); + + archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO ); + artifactDAOControl.expectAndReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "pom" ), artifact ); + + userReposControl.replay(); + crossRepoSearchControl.replay(); + archivaDAOControl.replay(); + artifactDAOControl.replay(); + + List artifacts = searchService.quickSearch( "bytecode:MyClassName" ); + + userReposControl.verify(); + crossRepoSearchControl.verify(); + archivaDAOControl.verify(); + artifactDAOControl.verify(); + + assertNotNull( artifacts ); + assertEquals( 1, artifacts.size() ); + } + + public void testQuickSearchArtifactRegularSearch() + throws Exception + { + List observableRepoIds = new ArrayList(); + observableRepoIds.add( "repo1.mirror" ); + observableRepoIds.add( "public.releases" ); + + userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds ); + + Date whenGathered = new Date(); + SearchResults results = new SearchResults(); + ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "jar" ); + artifact.getModel().setWhenGathered( whenGathered ); + + FileContentRecord record = new FileContentRecord(); + record.setRepositoryId( "repo1.mirror" ); + record.setArtifact( artifact ); + record.setContents( "org.apache.archiva:archiva-test:1.0:jar" ); + record.setFilename( "archiva-test-1.0.jar" ); + + results.addHit( record ); + + SearchResultLimits limits = new SearchResultLimits( SearchResultLimits.ALL_PAGES ); + + crossRepoSearchControl.expectAndDefaultReturn( + crossRepoSearch.searchForTerm( "", observableRepoIds, "archiva", limits ), results ); + + archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO ); + artifactDAOControl.expectAndReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "pom" ), artifact ); + + userReposControl.replay(); + crossRepoSearchControl.replay(); + archivaDAOControl.replay(); + artifactDAOControl.replay(); + + List artifacts = searchService.quickSearch( "archiva" ); + + userReposControl.verify(); + crossRepoSearchControl.verify(); + archivaDAOControl.verify(); + artifactDAOControl.verify(); + + assertNotNull( artifacts ); + assertEquals( 1, artifacts.size() ); + } + +/* query artifact by checksum */ + + public void testGetArtifactByChecksum() + throws Exception + { + Date whenGathered = new Date(); + + ArtifactsByChecksumConstraint constraint = new ArtifactsByChecksumConstraint( "a1b2c3aksjhdasfkdasasd" ); + List artifacts = new ArrayList(); + ArchivaArtifact artifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", "1.0", "", "jar" ); + artifact.getModel().setWhenGathered( whenGathered ); + artifacts.add( artifact ); + + archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO ); + artifactDAO.queryArtifacts( constraint ); + artifactDAOControl.setMatcher( MockControl.ALWAYS_MATCHER ); + artifactDAOControl.setReturnValue( artifacts ); + + archivaDAOControl.replay(); + artifactDAOControl.replay(); + + List results = searchService.getArtifactByChecksum( "a1b2c3aksjhdasfkdasasd" ); + + archivaDAOControl.verify(); + artifactDAOControl.verify(); + + assertNotNull( results ); + assertEquals( 1, results.size() ); + } + +/* query artifact versions */ + + public void testGetArtifactVersionsArtifactExists() + throws Exception + { + Date whenGathered = new Date(); + + List observableRepoIds = new ArrayList(); + observableRepoIds.add( "repo1.mirror" ); + observableRepoIds.add( "public.releases" ); + + List versions = new ArrayList(); + versions.add( "1.0" ); + versions.add( "1.1-beta-1" ); + versions.add( "1.1-beta-2" ); + versions.add( "1.1" ); + versions.add( "1.2" ); + versions.add( "1.2.1-SNAPSHOT" ); + + BrowsingResults results = new BrowsingResults( "org.apache.archiva", "archiva-test" ); + results.setSelectedRepositoryIds( observableRepoIds ); + results.setVersions( versions ); + + List archivaArtifacts = new ArrayList(); + ArchivaArtifact archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 0 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 1 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 2 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 3 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 4 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + archivaArtifact = new ArchivaArtifact( "org.apache.archiva", "archiva-test", versions.get( 5 ), "", "pom" ); + archivaArtifact.getModel().setWhenGathered( whenGathered ); + archivaArtifacts.add( archivaArtifact ); + + userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds ); + repoBrowsingControl.expectAndReturn( repoBrowsing.selectArtifactId( "", observableRepoIds, "org.apache.archiva", "archiva-test" ), results ); + archivaDAOControl.expectAndReturn( archivaDAO.getArtifactDAO(), artifactDAO ); + + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 0 ), "", "pom" ), archivaArtifacts.get( 0 ) ); + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 1 ), "", "pom" ), archivaArtifacts.get( 1 ) ); + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 2 ), "", "pom" ), archivaArtifacts.get( 2 ) ); + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 3 ), "", "pom" ), archivaArtifacts.get( 3 ) ); + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 4 ), "", "pom" ), archivaArtifacts.get( 4 ) ); + artifactDAOControl.expectAndDefaultReturn( artifactDAO.getArtifact( "org.apache.archiva", "archiva-test", versions.get( 5 ), "", "pom" ), archivaArtifacts.get( 5 ) ); + + userReposControl.replay(); + repoBrowsingControl.replay(); + archivaDAOControl.replay(); + artifactDAOControl.replay(); + + List artifacts = searchService.getArtifactVersions( "org.apache.archiva", "archiva-test" ); + + userReposControl.verify(); + repoBrowsingControl.verify(); + archivaDAOControl.verify(); + artifactDAOControl.verify(); + + assertNotNull( artifacts ); + assertEquals( 6, artifacts.size() ); + } + +/* query artifact versions since a given date */ + + public void testGetArtifactVersionsByDateArtifactExists() + throws Exception + { + + } + + public void testGetArtifactVersionsByDateArtifactDoesNotExist() + throws Exception + { + + } + +/* query artifact dependencies */ + + public void testGetDependenciesArtifactExists() + throws Exception + { + + } + + public void testGetDependenciesArtifactDoesNotExist() + throws Exception + { + + } + +/* get dependency tree */ + + public void testGetDependencyTreeArtifactExists() + throws Exception + { + + } + + public void testGetDependencyTreeArtifactDoesNotExist() + throws Exception + { + + } + +/* get dependees */ + + public void testGetDependeneesArtifactExists() + throws Exception + { + + } + + public void testGetDependeneesArtifactDoesNotExist() + throws Exception + { + + } +} \ No newline at end of file diff --git a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom index e69de29bb..f80e1dec1 100644 --- a/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom +++ b/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/resources/default-repo/org/apache/archiva/archiva-test/1.0/archiva-test-1.0.pom @@ -0,0 +1,18 @@ + + 4.0.0 + org.apache.archiva + archiva-test + jar + 1.0 + Maven Quick Start Archetype + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + +