Skip to content

Commit

Permalink
refactor(artifacts): Use builder to create artifacts (#4198)
Browse files Browse the repository at this point in the history
The all-arg and no-arg constructors for Artifact were deprecated
in spinnaker/kork#429. Replace their usages with a builder.
  • Loading branch information
ezimanyi authored and mergify[bot] committed Dec 4, 2019
1 parent a5896d6 commit 40310d6
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ private void assertDownloadArtifact(@TempDirectory.TempDir Path tempDir, String
Path cache = tempDir.resolve("cache");
Files.createDirectories(cache);

Artifact artifact = new Artifact();
artifact.setReference("com.test:app:1.0");
Artifact artifact = Artifact.builder().reference("com.test:app:1.0").build();

assertThat(new IvyArtifactCredentials(account, () -> cache).download(artifact))
.hasSameContentAs(new ByteArrayInputStream("contents".getBytes(Charsets.UTF_8)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ private void assertResolvable(
MavenArtifactAccount account = new MavenArtifactAccount();
account.setRepositoryUrl(server.baseUrl());

Artifact artifact = new Artifact();
artifact.setReference("com.test:app:" + version);
Artifact artifact = Artifact.builder().reference("com.test:app:" + version).build();

assertThat(new MavenArtifactCredentials(account, new OkHttpClient()).download(artifact))
.hasSameContentAs(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ package com.netflix.spinnaker.clouddriver.google.deploy
credentials.compute >> compute
credentials.project >> PROJECT_NAME
def executor = GroovyMock(GoogleExecutorTraits)
def artifact = new Artifact()
def artifact = Artifact.builder().build()
GroovySpy(GCEUtil, global: true)

when:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class KubernetesVersionedArtifactConverterSpec extends Specification {
def version1 = "v001"
def version2 = "v002"

def artifact1 = new Artifact(version: version1, metadata: [lastAppliedConfiguration: manifest1])
def artifact2 = new Artifact(version: version2, metadata: [lastAppliedConfiguration: manifest2])
def artifact1 = Artifact.builder().version(version1).metadata([lastAppliedConfiguration: manifest1]).build()
def artifact2 = Artifact.builder().version(version2).metadata([lastAppliedConfiguration: manifest2]).build()
def artifacts = [artifact1, artifact2]

def artifactProvider = Mock(KubernetesV2ArtifactProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ spec:
isVersioned() >> true
getVersionedConverter() >> Mock(KubernetesVersionedArtifactConverter) {
getDeployedName(_) >> "$NAME-$VERSION"
toArtifact(_, _, _) >> new Artifact()
toArtifact(_, _, _) >> Artifact.builder().build()
}
}
get(KubernetesKind.SERVICE) >> Mock(KubernetesResourceProperties) {
Expand Down

0 comments on commit 40310d6

Please sign in to comment.