ArtifactInstaller { @Deprecated public void installArtifact(File repositoryFile, Artifact artifact, Optional<ClassLoaderModel> classLoaderModel) throws IOException { installArtifact(repositoryFile, artifact, classLoaderModel, true); } ArtifactInstaller(PackagerLog log); @Deprecated void installArtifact(File repositoryFile, Artifact artifact, Optional<ClassLoaderModel> classLoaderModel); void installArtifact(File repositoryFile, Artifact artifact, Optional<ClassLoaderModel> classLoaderModel,
                              boolean prettyPrinting);  }
@Test public void installArtifactTest() throws IOException { ArtifactCoordinates coordinates = new ArtifactCoordinates(GROUP_ID, ARTIFACT_ID, VERSION, TYPE, CLASSIFIER); artifact = new Artifact(coordinates, artifactFileFolder.newFile(ARTIFACT_FILE_NAME).toURI()); artifactFileFolder.newFile(POM_FILE_NAME); File installedFile = new File(outputFolder.getRoot(), OUTPUT_DIRECTORY + File.separator + GENERATED_PACKAGE_NAME); File pomFile = new File(outputFolder.getRoot(), OUTPUT_DIRECTORY + File.separator + POM_FILE_NAME); assertThat("File should not be installed yet", !installedFile.exists()); installer.installArtifact(outputFolder.getRoot(), artifact, Optional.empty()); assertThat("File was not installed", installedFile.exists()); assertThat("Pom file was not copied", pomFile.exists()); }
@Test public void installNullArtifactTest() throws IOException { exception.expect(IllegalArgumentException.class); installer.installArtifact(outputFolder.getRoot(), null, Optional.empty()); }
@Test public void installArtifactToReadOnlyDestinationTest() throws IOException { exception.expect(IOException.class); File destination = new File(outputFolder.getRoot(), FILE_NAME); destination.setReadOnly(); artifact.setUri(destination.toURI()); installer.installArtifact(outputFolder.getRoot(), artifact, Optional.empty()); }