Пример #1
0
 @Before
 public void setUp() {
   pomFilterContainerMock = createPomFilterContainerMock();
   artifactPomContainerMock = context.mock(ArtifactPomContainer.class);
   pomMock = context.mock(MavenPom.class);
   mavenSettingsMock = context.mock(Settings.class);
   loggingManagerMock = context.mock(LoggingManagerInternal.class);
 }
Пример #2
0
  @Test
  public void deployOrInstall() throws IOException, PlexusContainerException {
    getMavenResolver().mavenSettingsSupplier = context.mock(MavenSettingsSupplier.class);

    PublishArtifact classifierArtifact = artifact(new File("classifier.jar"));
    final DefaultMavenDeployment deployment1 =
        new DefaultMavenDeployment(
            artifact(new File("pom1.pom")),
            artifact(new File("artifact1.jar")),
            Collections.<PublishArtifact>emptySet());
    final DefaultMavenDeployment deployment2 =
        new DefaultMavenDeployment(
            artifact(new File("pom2.pom")),
            artifact(new File("artifact2.jar")),
            WrapUtil.toSet(classifierArtifact));
    final Set<DefaultMavenDeployment> testDefaultMavenDeployments =
        WrapUtil.toSet(deployment1, deployment2);
    final AttachedArtifact attachedArtifact = new AttachedArtifact();
    @SuppressWarnings("unchecked")
    final Action<MavenDeployment> action = context.mock(Action.class);

    context.checking(
        new Expectations() {
          {
            allowing((CustomInstallDeployTaskSupport) getInstallDeployTask())
                .clearAttachedArtifactsList();
            allowing((CustomInstallDeployTaskSupport) getInstallDeployTask()).getSettings();
            will(returnValue(mavenSettingsMock));
            allowing((CustomInstallDeployTaskSupport) getInstallDeployTask()).getProject();
            will(returnValue(AntUtil.createProject()));
            allowing((CustomInstallDeployTaskSupport) getInstallDeployTask()).createAttach();
            will(returnValue(attachedArtifact));
            one(artifactPomContainerMock).addArtifact(TEST_ARTIFACT, TEST_JAR_FILE);
            allowing(artifactPomContainerMock).createDeployableFilesInfos();
            will(returnValue(testDefaultMavenDeployments));
            one(action).execute(deployment1);
            one(action).execute(deployment2);
          }
        });

    getMavenResolver().beforeDeployment(action);
    getMavenResolver().publish(TEST_IVY_ARTIFACT, TEST_IVY_FILE, true);
    getMavenResolver().publish(TEST_ARTIFACT, TEST_JAR_FILE, true);
    checkTransaction(testDefaultMavenDeployments, attachedArtifact, classifierArtifact);
    assertSame(mavenSettingsMock, getMavenResolver().getSettings());
  }
Пример #3
0
 @Test
 public void setFilter() {
   final PublishFilter publishFilterMock = context.mock(PublishFilter.class);
   context.checking(
       new Expectations() {
         {
           one(pomFilterContainerMock).setFilter(publishFilterMock);
         }
       });
   getMavenResolver().setFilter(publishFilterMock);
 }
Пример #4
0
 @Test
 public void addFilter() {
   final String testName = "somename";
   final PublishFilter publishFilterMock = context.mock(PublishFilter.class);
   context.checking(
       new Expectations() {
         {
           one(pomFilterContainerMock).addFilter(testName, publishFilterMock);
         }
       });
   getMavenResolver().addFilter(testName, publishFilterMock);
 }
Пример #5
0
 @Test
 public void getFilter() {
   final PublishFilter publishFilterMock = context.mock(PublishFilter.class);
   context.checking(
       new Expectations() {
         {
           allowing(pomFilterContainerMock).getFilter();
           will(returnValue(publishFilterMock));
         }
       });
   assertSame(publishFilterMock, getMavenResolver().getFilter());
 }
Пример #6
0
 @Test
 public void filter() {
   final String testName = "somename";
   final PublishFilter publishFilterMock = context.mock(PublishFilter.class);
   context.checking(
       new Expectations() {
         {
           one(pomFilterContainerMock).filter(testName);
           will(returnValue(publishFilterMock));
         }
       });
   assertSame(publishFilterMock, getMavenResolver().filter(testName));
 }