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.RepositoryContentStatisticsDAO;
8 import org.apache.maven.archiva.database.RepositoryProblemDAO;
9 import org.apache.maven.archiva.database.SimpleConstraint;
10 import org.apache.maven.archiva.model.RepositoryContentStatistics;
12 import java.io.Serializable;
13 import java.util.ArrayList;
14 import java.util.List;
16 import junit.framework.Assert;
19 * Licensed to the Apache Software Foundation (ASF) under one
20 * or more contributor license agreements. See the NOTICE file
21 * distributed with this work for additional information
22 * regarding copyright ownership. The ASF licenses this file
23 * to you under the Apache License, Version 2.0 (the
24 * "License"); you may not use this file except in compliance
25 * with the License. You may obtain a copy of the License at
27 * http://www.apache.org/licenses/LICENSE-2.0
29 * Unless required by applicable law or agreed to in writing,
30 * software distributed under the License is distributed on an
31 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
32 * KIND, either express or implied. See the License for the
33 * specific language governing permissions and limitations
38 * Stub class for Archiva DAO to avoid having to set up a database for tests.
40 * @todo a mock would be better, but that won't play nicely with Plexus injection.
42 public class ArchivaDAOStub
45 private ArchivaConfiguration configuration;
47 public List query( SimpleConstraint constraint )
49 Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() );
52 List<RepositoryContentStatistics> stats = new ArrayList<RepositoryContentStatistics>();
53 for ( String repo : configuration.getConfiguration().getManagedRepositoriesAsMap().keySet() )
55 RepositoryContentStatistics statistics = new RepositoryContentStatistics();
56 statistics.setRepositoryId( repo );
57 stats.add( statistics );
62 public Object save( Serializable obj )
64 throw new UnsupportedOperationException( "query not implemented for stub" );
67 public ArtifactDAO getArtifactDAO()
69 throw new UnsupportedOperationException( "method not implemented for stub" );
72 public ProjectModelDAO getProjectModelDAO()
74 throw new UnsupportedOperationException( "method not implemented for stub" );
77 public RepositoryProblemDAO getRepositoryProblemDAO()
79 throw new UnsupportedOperationException( "method not implemented for stub" );
82 public RepositoryContentStatisticsDAO getRepositoryContentStatisticsDAO()
84 throw new UnsupportedOperationException( "method not implemented for stub" );