1 package org.apache.maven.archiva.web.action.admin.repositories;
3 import org.apache.maven.archiva.configuration.ArchivaConfiguration;
4 import org.apache.maven.archiva.database.ArchivaDAO;
5 import org.apache.maven.archiva.database.ArtifactDAO;
6 import org.apache.maven.archiva.database.ProjectModelDAO;
7 import org.apache.maven.archiva.database.RepositoryProblemDAO;
8 import org.apache.maven.archiva.database.SimpleConstraint;
9 import org.apache.maven.archiva.model.RepositoryContentStatistics;
11 import java.io.Serializable;
12 import java.util.ArrayList;
13 import java.util.List;
15 import junit.framework.Assert;
18 * Licensed to the Apache Software Foundation (ASF) under one
19 * or more contributor license agreements. See the NOTICE file
20 * distributed with this work for additional information
21 * regarding copyright ownership. The ASF licenses this file
22 * to you under the Apache License, Version 2.0 (the
23 * "License"); you may not use this file except in compliance
24 * with the License. You may obtain a copy of the License at
26 * http://www.apache.org/licenses/LICENSE-2.0
28 * Unless required by applicable law or agreed to in writing,
29 * software distributed under the License is distributed on an
30 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
31 * KIND, either express or implied. See the License for the
32 * specific language governing permissions and limitations
37 * Stub class for Archiva DAO to avoid having to set up a database for tests.
39 * @todo a mock would be better, but that won't play nicely with Plexus injection.
41 public class ArchivaDAOStub
44 private ArchivaConfiguration configuration;
46 public List query( SimpleConstraint constraint )
48 Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() );
50 List<RepositoryContentStatistics> stats = new ArrayList<RepositoryContentStatistics>();
51 for ( String repo : configuration.getConfiguration().getManagedRepositoriesAsMap().keySet() )
53 RepositoryContentStatistics statistics = new RepositoryContentStatistics();
54 statistics.setRepositoryId( repo );
55 stats.add( statistics );
60 public Object save( Serializable obj )
62 throw new UnsupportedOperationException( "query not implemented for stub" );
65 public ArtifactDAO getArtifactDAO()
67 throw new UnsupportedOperationException( "query not implemented for stub" );
70 public ProjectModelDAO getProjectModelDAO()
72 throw new UnsupportedOperationException( "query not implemented for stub" );
75 public RepositoryProblemDAO getRepositoryProblemDAO()
77 throw new UnsupportedOperationException( "query not implemented for stub" );