File tree Expand file tree Collapse file tree 9 files changed +39
-28
lines changed
main/java/org/scm4j/deployer/api
test/java/org/scm4j/deployer/api Expand file tree Collapse file tree 9 files changed +39
-28
lines changed Original file line number Diff line number Diff line change 88public class Action implements IAction {
99
1010 @ Getter
11- final private Class <? extends IComponentDeployer > installerClass ;
11+ private final Class <? extends IComponentDeployer > installerClass ;
1212 @ Getter private Map <String , Object > params ;
1313 private final Component comp ;
1414
Original file line number Diff line number Diff line change 99public class Component implements IComponent {
1010
1111 @ Getter
12- final private Artifact artifactCoords ;
12+ private final Artifact artifactCoords ;
1313 @ Getter
1414 private IDeploymentProcedure deploymentProcedure ;
1515 private final ProductStructure ps ;
@@ -36,4 +36,19 @@ public String toString() {
3636 "artifactCoords=" + artifactCoords +
3737 '}' ;
3838 }
39+
40+ @ Override
41+ public boolean equals (Object o ) {
42+ if (this == o ) return true ;
43+ if (o == null || getClass () != o .getClass ()) return false ;
44+
45+ Component component = (Component ) o ;
46+
47+ return artifactCoords .equals (component .artifactCoords );
48+ }
49+
50+ @ Override
51+ public int hashCode () {
52+ return artifactCoords .hashCode ();
53+ }
3954}
Original file line number Diff line number Diff line change 33import lombok .Data ;
44
55import java .io .File ;
6- import java .net .URL ;
76import java .util .Map ;
87
98@ Data
109public class DeploymentContext implements IDeploymentContext {
1110
12- private String mainArtifact ;
11+ private final String mainArtifact ;
1312 private Map <String , File > artifacts ;
14- private URL deploymentURL ;
13+ private String deploymentPath ;
1514
1615 public DeploymentContext (String mainArtifact ) {
1716 this .mainArtifact = mainArtifact ;
Original file line number Diff line number Diff line change 77@ Data
88public class DeploymentProcedure implements IDeploymentProcedure {
99
10- final private List <IComponentDeployer > componentDeployers ;
10+ private final List <IComponentDeployer > componentDeployers ;
1111
1212}
Original file line number Diff line number Diff line change 11package org .scm4j .deployer .api ;
22
3- import java .net .URL ;
4-
53public interface IDeployedProduct extends IProduct {
64
7- URL getDeploymentUrl ();
5+ String getDeploymentPath ();
86 String getProductVersion ();
97
108}
Original file line number Diff line number Diff line change 11package org .scm4j .deployer .api ;
22
33import java .io .File ;
4- import java .net .URL ;
54import java .util .Map ;
65
76public interface IDeploymentContext {
87
98 String getMainArtifact ();
109 Map <String , File > getArtifacts ();
11- URL getDeploymentURL ();
10+
11+ String getDeploymentPath ();
1212
1313}
Original file line number Diff line number Diff line change 11package org .scm4j .deployer .api ;
22
3- import java .net .URL ;
43import java .util .List ;
54
65public interface IProductStructure {
7- URL getDefaultDeploymentURL ();
6+ String getDefaultDeploymentPath ();
87 List <IComponent > getComponents ();
98}
Original file line number Diff line number Diff line change 22
33import lombok .Getter ;
44
5- import java .net .MalformedURLException ;
6- import java .net .URL ;
75import java .util .ArrayList ;
6+ import java .util .Collections ;
87import java .util .List ;
98
109public class ProductStructure implements IProductStructure {
1110
1211 @ Getter
13- private URL defaultDeploymentURL ;
12+ private String defaultDeploymentPath ;
1413 @ Getter
1514 private List <IComponent > components ;
1615
17- private ProductStructure () {
16+ private ProductStructure (String defaultDeploymentPath ) {
17+ this .defaultDeploymentPath = defaultDeploymentPath ;
1818 }
1919
20- public static ProductStructure create (String defaultDeploymentURL ) {
21- URL url ;
22- try {
23- url = new URL (defaultDeploymentURL );
24- } catch (MalformedURLException e ) {
25- throw new RuntimeException ("Invalid URL: " + defaultDeploymentURL );
26- }
27- ProductStructure ps = new ProductStructure ();
28- ps .defaultDeploymentURL = url ;
20+ public static ProductStructure create (String defaultDeploymentPath ) {
21+ ProductStructure ps = new ProductStructure (defaultDeploymentPath );
2922 ps .components = new ArrayList <>();
3023 return ps ;
3124 }
3225
3326 public static ProductStructure createEmptyStructure () {
34- return new ProductStructure ();
27+ ProductStructure ps = new ProductStructure ("" );
28+ ps .components = Collections .emptyList ();
29+ return ps ;
3530 }
3631
3732 public Component addComponent (String component ) {
Original file line number Diff line number Diff line change 22
33import org .junit .Test ;
44
5+ import java .util .Collections ;
6+
57import static org .junit .Assert .assertEquals ;
68import static org .junit .Assert .assertNotNull ;
79
@@ -40,9 +42,12 @@ public void init(IDeploymentContext depCtx) {
4042 .parent ()
4143 .addComponent ("345:345:345" )
4244 .parent ();
43- assertEquals (ps .getDefaultDeploymentURL (). toString (), "file:/C:/smth" );
45+ assertEquals (ps .getDefaultDeploymentPath (), "file:/C:/smth" );
4446 assertEquals (ps .getComponents ().get (0 ).getArtifactCoords ().toString (), "123:123:jar:123" );
4547 assertEquals (ps .getComponents ().get (1 ).getArtifactCoords ().toString (), "345:345:jar:345" );
4648 assertNotNull (ps .getComponents ().get (0 ).getDeploymentProcedure ().getComponentDeployers ().get (0 ));
49+ ps = ProductStructure .createEmptyStructure ();
50+ assertEquals (ps .getDefaultDeploymentPath (), "" );
51+ assertEquals (ps .getComponents (), Collections .emptyList ());
4752 }
4853}
You can’t perform that action at this time.
0 commit comments