View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.eclipse.aether.impl.guice;
20  
21  import java.util.Collections;
22  import java.util.Set;
23  
24  import com.google.inject.AbstractModule;
25  import com.google.inject.Guice;
26  import com.google.inject.Provides;
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 static org.junit.Assert.*;
40  
41  public class AetherModuleTest {
42  
43      @Test
44      public void testModuleCompleteness() {
45          assertNotNull(Guice.createInjector(new SystemModule()).getInstance(RepositorySystem.class));
46      }
47  
48      static class SystemModule extends AbstractModule {
49  
50          @Override
51          protected void configure() {
52              install(new AetherModule());
53              bind(ArtifactDescriptorReader.class).to(StubArtifactDescriptorReader.class);
54              bind(VersionRangeResolver.class).to(StubVersionRangeResolver.class);
55              bind(VersionResolver.class).to(StubVersionResolver.class);
56          }
57  
58          @Provides
59          public Set<MetadataGeneratorFactory> metadataGeneratorFactories() {
60              return Collections.emptySet();
61          }
62  
63          @Provides
64          public Set<RepositoryConnectorFactory> repositoryConnectorFactories() {
65              return Collections.emptySet();
66          }
67  
68          @Provides
69          public Set<TransporterFactory> transporterFactories() {
70              return Collections.emptySet();
71          }
72      }
73  }