View Javadoc
1   package org.eclipse.aether.impl.guice;
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 static org.junit.Assert.*;
23  
24  import java.util.Collections;
25  import java.util.Set;
26  
27  import org.eclipse.aether.RepositorySystem;
28  import org.eclipse.aether.impl.ArtifactDescriptorReader;
29  import org.eclipse.aether.impl.MetadataGeneratorFactory;
30  import org.eclipse.aether.impl.StubArtifactDescriptorReader;
31  import org.eclipse.aether.impl.StubVersionRangeResolver;
32  import org.eclipse.aether.impl.StubVersionResolver;
33  import org.eclipse.aether.impl.VersionRangeResolver;
34  import org.eclipse.aether.impl.VersionResolver;
35  import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
36  import org.eclipse.aether.spi.connector.transport.TransporterFactory;
37  import org.junit.Test;
38  
39  import com.google.inject.AbstractModule;
40  import com.google.inject.Guice;
41  import com.google.inject.Provides;
42  
43  public class AetherModuleTest
44  {
45  
46      @Test
47      public void testModuleCompleteness()
48      {
49          assertNotNull( Guice.createInjector( new SystemModule() ).getInstance( RepositorySystem.class ) );
50      }
51  
52      static class SystemModule
53          extends AbstractModule
54      {
55  
56          @Override
57          protected void configure()
58          {
59              install( new AetherModule() );
60              bind( ArtifactDescriptorReader.class ).to( StubArtifactDescriptorReader.class );
61              bind( VersionRangeResolver.class ).to( StubVersionRangeResolver.class );
62              bind( VersionResolver.class ).to( StubVersionResolver.class );
63          }
64  
65          @Provides
66          public Set<MetadataGeneratorFactory> metadataGeneratorFactories()
67          {
68              return Collections.emptySet();
69          }
70  
71          @Provides
72          public Set<RepositoryConnectorFactory> repositoryConnectorFactories()
73          {
74              return Collections.emptySet();
75          }
76  
77          @Provides
78          public Set<TransporterFactory> transporterFactories()
79          {
80              return Collections.emptySet();
81          }
82  
83      }
84  
85  }