コード例 #1
0
 @Test
 public void providesAnAntBuilderFactory() {
   assertThat(registry.getFactory(AntBuilder.class), instanceOf(DefaultAntBuilderFactory.class));
   assertThat(
       registry.getFactory(AntBuilder.class),
       sameInstance((Object) registry.getFactory(AntBuilder.class)));
 }
コード例 #2
0
 @Test
 public void providesATemporaryFileProvider() {
   assertThat(
       registry.get(TemporaryFileProvider.class), instanceOf(DefaultTemporaryFileProvider.class));
   assertThat(
       registry.get(TemporaryFileProvider.class),
       sameInstance(registry.get(TemporaryFileProvider.class)));
 }
コード例 #3
0
  @Test
  public void providesADependencyHandler() {
    expectDependencyResolutionServicesCreated();

    assertThat(registry.get(DependencyHandler.class), sameInstance(dependencyHandler));
    assertThat(
        registry.get(DependencyHandler.class), sameInstance(registry.get(DependencyHandler.class)));
  }
コード例 #4
0
  @Test
  public void providesAnArtifactHandler() {
    expectDependencyResolutionServicesCreated();

    assertThat(registry.get(ArtifactHandler.class), instanceOf(DefaultArtifactHandler.class));
    assertThat(
        registry.get(ArtifactHandler.class), sameInstance(registry.get(ArtifactHandler.class)));
  }
コード例 #5
0
  @Test
  public void providesAConfigurationContainer() {
    expectDependencyResolutionServicesCreated();

    assertThat(registry.get(ConfigurationContainer.class), sameInstance(configurationContainer));
    assertThat(
        registry.get(ConfigurationContainer.class),
        sameInstance(registry.get(ConfigurationContainer.class)));
  }
コード例 #6
0
  @Test
  public void providesAScriptHandlerAndScriptClassLoaderProvider() {
    expectScriptClassLoaderProviderCreated();

    assertThat(registry.get(ScriptHandler.class), instanceOf(DefaultScriptHandler.class));
    assertThat(registry.get(ScriptHandler.class), sameInstance(registry.get(ScriptHandler.class)));
    assertThat(
        registry.get(ScriptClassLoaderProvider.class),
        sameInstance((Object) registry.get(ScriptHandler.class)));
  }
コード例 #7
0
  @Test
  public void providesAnArtifactPublicationServicesFactory() {
    expectDependencyResolutionServicesCreated();

    assertThat(
        registry.getFactory(ArtifactPublicationServices.class),
        sameInstance(publishServicesFactory));
    assertThat(
        registry.getFactory(ArtifactPublicationServices.class),
        sameInstance(registry.getFactory(ArtifactPublicationServices.class)));
  }
コード例 #8
0
  @Test
  public void providesAFileOperationsInstance() {
    context.checking(
        new Expectations() {
          {
            one(project).getTasks();
          }
        });

    assertThat(registry.get(FileOperations.class), instanceOf(DefaultFileOperations.class));
    assertThat(
        registry.get(FileOperations.class), sameInstance(registry.get(FileOperations.class)));
  }
コード例 #9
0
  @Test
  public void providesAPluginContainer() {
    expectScriptClassLoaderProviderCreated();
    context.checking(
        new Expectations() {
          {
            one(pluginRegistry).createChild(with(notNullValue(ClassLoader.class)));
          }
        });

    assertThat(
        registry.get(PluginContainer.class), instanceOf(DefaultProjectsPluginContainer.class));
    assertThat(
        registry.get(PluginContainer.class), sameInstance(registry.get(PluginContainer.class)));
  }
コード例 #10
0
  @Test
  public void providesALoggingManager() {
    final Factory<LoggingManagerInternal> loggingManagerFactory = context.mock(Factory.class);
    final LoggingManager loggingManager = context.mock(LoggingManagerInternal.class);

    context.checking(
        new Expectations() {
          {
            allowing(parent).getFactory(LoggingManagerInternal.class);
            will(returnValue(loggingManagerFactory));
            one(loggingManagerFactory).create();
            will(returnValue(loggingManager));
          }
        });

    assertThat(registry.get(LoggingManager.class), sameInstance(loggingManager));
    assertThat(
        registry.get(LoggingManager.class), sameInstance(registry.get(LoggingManager.class)));
  }
コード例 #11
0
 @Test
 public void providesAFileResolver() {
   assertThat(registry.get(FileResolver.class), instanceOf(BaseDirConverter.class));
   assertThat(registry.get(FileResolver.class), sameInstance(registry.get(FileResolver.class)));
 }
コード例 #12
0
 @Test
 public void providesATaskContainerFactory() {
   assertThat(
       registry.getFactory(TaskContainerInternal.class),
       instanceOf(DefaultTaskContainerFactory.class));
 }
コード例 #13
0
 @Test
 public void providesAConvention() {
   assertThat(registry.get(Convention.class), instanceOf(DefaultConvention.class));
   assertThat(registry.get(Convention.class), sameInstance(registry.get(Convention.class)));
 }
コード例 #14
0
 @Test
 public void createsARegistryForATask() {
   ServiceRegistryFactory taskRegistry = registry.createFor(context.mock(TaskInternal.class));
   assertThat(taskRegistry, instanceOf(TaskInternalServiceRegistry.class));
 }