View Javadoc

1   package org.apache.maven.archiva.database.updater;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.commons.collections.CollectionUtils;
23  import org.codehaus.plexus.spring.PlexusInSpringTestCase;
24  
25  import java.util.List;
26  
27  /**
28   * DatabaseConsumersTest 
29   *
30   * @version $Id: DatabaseConsumersTest.java 755266 2009-03-17 14:28:40Z brett $
31   */
32  public class DatabaseConsumersTest
33      extends PlexusInSpringTestCase
34  {
35      private DatabaseConsumers lookupDbConsumers()
36          throws Exception
37      {
38          DatabaseConsumers dbconsumers = (DatabaseConsumers) lookup( DatabaseConsumers.class );
39          assertNotNull( "DatabaseConsumers should not be null.", dbconsumers );
40          return dbconsumers;
41      }
42  
43      public void testGetAvailableCleanupConsumers()
44          throws Exception
45      {
46          DatabaseConsumers dbconsumers = lookupDbConsumers();
47          List<DatabaseCleanupConsumer> available = dbconsumers.getAvailableCleanupConsumers();
48          assertNotNull( "Available Cleanup Consumers should never be null.", available );
49  
50          assertTrue( "Available Cleanup Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
51      }
52  
53      public void testGetAvailableUnprocessedConsumers()
54          throws Exception
55      {
56          DatabaseConsumers dbconsumers = lookupDbConsumers();
57          List<DatabaseUnprocessedArtifactConsumer> available = dbconsumers.getAvailableUnprocessedConsumers();
58          assertNotNull( "Available Unprocessed Consumers should never be null.", available );
59  
60          assertTrue( "Available Unprocessed Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
61      }
62  
63      public void testGetSelectedCleanupConsumers()
64          throws Exception
65      {
66          DatabaseConsumers dbconsumers = lookupDbConsumers();
67          List<ArchivaArtifactConsumer> available = dbconsumers.getSelectedCleanupConsumers();
68          assertNotNull( "Selected Cleanup Consumers should never be null.", available );
69  
70          assertTrue( "Selected Cleanup Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
71      }
72  
73      public void testGetSelectedUnprocessedConsumers()
74          throws Exception
75      {
76          DatabaseConsumers dbconsumers = lookupDbConsumers();
77          List<ArchivaArtifactConsumer> available = dbconsumers.getSelectedUnprocessedConsumers();
78          assertNotNull( "Selected Unprocessed Consumers should never be null.", available );
79  
80          assertTrue( "Selected Unprocessed Consumers should have entries.", CollectionUtils.isNotEmpty( available ) );
81      }
82  
83  }