*/
import com.opensymphony.xwork2.Preparable;
+import org.apache.archiva.admin.model.RepositoryAdminException;
+import org.apache.archiva.admin.model.managed.ManagedRepository;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
import org.apache.archiva.indexer.search.RepositorySearch;
import org.apache.archiva.indexer.search.RepositorySearchException;
import org.apache.archiva.indexer.search.SearchFields;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
extends AbstractRepositoryBasedAction
implements Preparable
{
+
+ @Inject
+ protected ManagedRepositoryAdmin managedRepositoryAdmin;
+
/**
* Query string.
*/
private String q;
- // FIXME olamy WTF here??
- private ArchivaConfiguration archivaConfiguration;
-
/**
* The Search Results.
*/
this.completeQueryString = completeQueryString;
}
- public ArchivaConfiguration getArchivaConfiguration()
- {
- return archivaConfiguration;
- }
-
- public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
- {
- this.archivaConfiguration = archivaConfiguration;
- }
-
- public Map<String, ManagedRepositoryConfiguration> getManagedRepositories()
+ public Map<String, ManagedRepository> getManagedRepositories() throws RepositoryAdminException
{
- return getArchivaConfiguration().getConfiguration().getManagedRepositoriesAsMap();
+ return managedRepositoryAdmin.getManagedRepositoriesAsMap();
}
- public void setManagedRepositories( Map<String, ManagedRepositoryConfiguration> managedRepositories )
+ // wtf : does nothing ??
+ public void setManagedRepositories( Map<String, ManagedRepository> managedRepositories )
{
}
{
this.infoMessage = infoMessage;
}
+
+ public ManagedRepositoryAdmin getManagedRepositoryAdmin()
+ {
+ return managedRepositoryAdmin;
+ }
+
+ public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
+ {
+ this.managedRepositoryAdmin = managedRepositoryAdmin;
+ }
}
*/
import com.opensymphony.xwork2.Action;
+import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
+import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
import org.apache.archiva.indexer.search.RepositorySearch;
import org.apache.archiva.indexer.search.SearchFields;
import org.apache.archiva.indexer.search.SearchResultHit;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.memory.TestRepositorySessionFactory;
-import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.security.UserRepositories;
+import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.easymock.MockControl;
import java.util.ArrayList;
private MockControl searchControl;
+ private MockControl repoAdminControl;
+
+ private ManagedRepositoryAdmin managedRepositoryAdmin;
+
private RepositorySearch search;
private static final String TEST_CHECKSUM = "afbcdeaadbcffceabbba1";
searchControl.setDefaultMatcher( MockControl.ALWAYS_MATCHER );
search = (RepositorySearch) searchControl.getMock();
- action.setArchivaConfiguration( archivaConfig );
+ repoAdminControl = MockControl.createControl( ManagedRepositoryAdmin.class );
+ managedRepositoryAdmin = (ManagedRepositoryAdmin) repoAdminControl.getMock();
+
+ //( (DefaultManagedRepositoryAdmin) action.getManagedRepositoryAdmin() ).setArchivaConfiguration( archivaConfig );
+
+ action.setManagedRepositoryAdmin( managedRepositoryAdmin );
action.setUserRepositories( userRepos );
action.setNexusSearch( search );
}