-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from diagridio/placement-container
Adding placement container to integration
- Loading branch information
Showing
5 changed files
with
70 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.diagrid.dapr; | ||
|
||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
public class DaprPlacementContainer extends GenericContainer<DaprPlacementContainer>{ | ||
|
||
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("daprio/placement"); | ||
private int PLACEMENT_PORT = 50006; | ||
|
||
public DaprPlacementContainer(DockerImageName dockerImageName) { | ||
super(dockerImageName); | ||
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME); | ||
|
||
|
||
withExposedPorts(PLACEMENT_PORT); | ||
} | ||
|
||
public DaprPlacementContainer(String image) { | ||
this(DockerImageName.parse(image)); | ||
} | ||
|
||
@Override | ||
protected void configure() { | ||
super.configure(); | ||
withCommand("./placement", "-port",Integer.toString(PLACEMENT_PORT)); | ||
} | ||
|
||
public static DockerImageName getDefaultImageName() { | ||
return DEFAULT_IMAGE_NAME; | ||
} | ||
|
||
public DaprPlacementContainer withPort(Integer port) { | ||
this.PLACEMENT_PORT = port; | ||
return this; | ||
} | ||
|
||
public int getPort() { | ||
return PLACEMENT_PORT; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/java/io/diagrid/dapr/DaprPlacementContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.diagrid.dapr; | ||
|
||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
import org.junit.Assert; | ||
|
||
public class DaprPlacementContainerTest { | ||
|
||
|
||
@ClassRule() | ||
public static DaprPlacementContainer placement = new DaprPlacementContainer("daprio/placement"); | ||
|
||
|
||
|
||
@Test | ||
public void testDaprPlacementContainerDefaults(){ | ||
Assert.assertEquals("The default port is set", 50006, | ||
placement.getPort()); | ||
|
||
} | ||
|
||
|
||
|
||
} |