diff options
author | Martin <marcin.j.chrzanowski@gmail.com> | 2019-11-27 17:22:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-27 17:22:13 +0100 |
commit | 6d27310b2cdbd6f412157eee25cc68df9486db14 (patch) | |
tree | b7ebab7fa715b194509eee9cb6ee4984ba3db840 | |
parent | 97589d8380ca12fa0a75163a6f5bd79a7e1039fa (diff) |
Parametrize RMI host (#43)
7 files changed, 8 insertions, 9 deletions
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 4332d07..921c8eb 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -14,7 +14,7 @@ jobs: with: java-version: 1.8 - name: Build with Gradle - run: ./gradlew test + run: ./gradlew test -Dhostname=localhost - name: Upload test report if: always() uses: actions/upload-artifact@v1 diff --git a/build.gradle b/build.gradle index 237ff87..2195aee 100644 --- a/build.gradle +++ b/build.gradle @@ -49,17 +49,19 @@ application { task runAgent(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'pl.edu.mimuw.cloudatlas.agent.Agent' + systemProperty 'java.rmi.server.hostname', System.getProperty('hostname') } task runClient(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'pl.edu.mimuw.cloudatlas.client.Client' + systemProperty 'agent_hostname', System.getProperty('hostname') } task runFetcher(type: JavaExec) { classpath = sourceSets.main.runtimeClasspath main = 'pl.edu.mimuw.cloudatlas.fetcher.Fetcher' - args("localhost", 1099) + args(System.getProperty('hostname'), 1099) } task runInterpreter(type: JavaExec) { diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index 557ba39..db9c09f 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -34,7 +34,8 @@ public class ClientController { ClientController() { try { - Registry registry = LocateRegistry.getRegistry("localhost"); + String hostname = System.getProperty("agent_hostname"); + Registry registry = LocateRegistry.getRegistry(hostname); this.api = (Api) registry.lookup("Api"); } catch (Exception e) { System.err.println("Client exception:"); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 9cbc2e8..bb48ff5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,3 +1,4 @@ +server.port=0 spring.application.name=CloudAtlas Client spring.thymeleaf.cache=false diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/application.properties b/src/main/resources/pl/edu/mimuw/cloudatlas/client/application.properties deleted file mode 100644 index 5d26214..0000000 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.port=8081 -spring.application.name=CloudAtlas Client diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/fetcher/fetcher.policy b/src/main/resources/pl/edu/mimuw/cloudatlas/fetcher/fetcher.policy deleted file mode 100644 index 5d74bde..0000000 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/fetcher/fetcher.policy +++ /dev/null @@ -1,3 +0,0 @@ -grant { - permission java.security.AllPermission; -};
\ No newline at end of file diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java index 1d7a2c5..33fb56f 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java @@ -45,7 +45,7 @@ public class AgentIntegrationTest { public static void bindApi() throws Exception { registryProcess = Runtime.getRuntime().exec("./scripts/registry"); Thread.sleep(10000); - agentProcess = Runtime.getRuntime().exec("./gradlew runAgent"); + agentProcess = Runtime.getRuntime().exec("./gradlew runAgent -Dhostname=localhost"); Thread.sleep(10000); registry = LocateRegistry.getRegistry("localhost"); |