You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/05/19 22:25:40 UTC
airavata git commit: removing RegistrySettings classe and its usages
Repository: airavata
Updated Branches:
refs/heads/master 7229a4abd -> 973bf93a9
removing RegistrySettings classe and its usages
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/973bf93a
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/973bf93a
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/973bf93a
Branch: refs/heads/master
Commit: 973bf93a9076f883cc7a0eb9bc506e568f8b48ac
Parents: 7229a4a
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Tue May 19 16:25:26 2015 -0400
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Tue May 19 16:25:26 2015 -0400
----------------------------------------------------------------------
.../airavata/gfac/client/util/Initialize.java | 73 +++++------
.../orchestrator/client/util/Initialize.java | 73 +++++------
.../orchestrator/core/util/Initialize.java | 61 +++++----
modules/registry/airavata-jpa-registry/pom.xml | 4 +-
.../registry/jpa/resources/UserResource.java | 18 +--
.../registry/jpa/AbstractResourceTest.java | 8 +-
.../registry/jpa/GatewayResourceTest.java | 9 +-
.../registry/jpa/RegistryUseCaseTest.java | 10 +-
.../registry/jpa/util/Initialize.java | 33 ++---
.../registry/cpi/utils/RegistrySettings.java | 127 -------------------
.../main/resources/airavata-client.properties | 8 +-
.../src/main/resources/test-framework.json | 14 +-
pom.xml | 4 +-
13 files changed, 167 insertions(+), 275 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
index e76a56c..e4525d0 100644
--- a/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
+++ b/modules/gfac/airavata-gfac-service/src/test/java/org/apache/airavata/gfac/client/util/Initialize.java
@@ -17,14 +17,16 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
+
package org.apache.airavata.gfac.client.util;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
import org.apache.airavata.persistance.registry.jpa.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,27 +91,23 @@ public class Initialize {
return false;
}
- public void initializeDB() {
+ public void initializeDB() throws SQLException{
String jdbcUrl = null;
- String jdbcDriver = null;
String jdbcUser = null;
String jdbcPassword = null;
try{
- jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
- jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
- jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
- jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+ AiravataUtils.setExecutionAsServer();
+ jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
+ jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
+ jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (RegistryException e) {
- logger.error("Unable to read properties" , e);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
}
-
-
startDerbyInServerMode();
if(!isServerStarted(server, 20)){
throw new RuntimeException("Derby server cound not started within five seconds...");
}
-// startDerbyInEmbeddedMode();
Connection conn = null;
try {
@@ -138,27 +136,36 @@ public class Initialize {
}
try{
- GatewayResource gatewayResource = (GatewayResource)ResourceUtils.createGateway(RegistrySettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
gatewayResource.setDomain("test-domain");
gatewayResource.setEmailAddress("test-email");
gatewayResource.save();
-
- UserResource userResource = ResourceUtils.createUser(RegistrySettings.getSetting("default.registry.user"),RegistrySettings.getSetting("default.registry.password"));
+
+ UserResource userResource = new UserResource();
+ userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
+ userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
userResource.save();
WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
workerResource.setUser(userResource.getUserName());
workerResource.save();
-
- ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
- resource.setId("default");
- resource.setName("default");
- resource.setWorker(workerResource);
- resource.save();
-
- } catch (RegistryException e) {
+
+ ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
+ projectResource.setGateway(gatewayResource);
+ projectResource.setId("default");
+ projectResource.setName("default");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+
+ } catch (ApplicationSettingsException e) {
logger.error("Unable to read properties", e);
+ throw new SQLException(e.getMessage(), e);
+ } catch (RegistryException e) {
+ logger.error("Unable to save data to registry", e);
+ throw new SQLException(e.getMessage(), e);
}
}
@@ -313,22 +320,12 @@ public class Initialize {
}
- private void startDerbyInEmbeddedMode(){
- try {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
- } catch (ClassNotFoundException e) {
- logger.error(e.getMessage(), e);
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public void stopDerbyServer() {
+ public void stopDerbyServer() throws SQLException{
try {
server.shutdown();
} catch (Exception e) {
logger.error(e.getMessage(), e);
+ throw new SQLException("Error while stopping derby server", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
index 884a2d0..2be31e6 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/java/org/apache/airavata/orchestrator/client/util/Initialize.java
@@ -17,14 +17,16 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
+
package org.apache.airavata.orchestrator.client.util;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
import org.apache.airavata.persistance.registry.jpa.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,27 +91,23 @@ public class Initialize {
return false;
}
- public void initializeDB() {
+ public void initializeDB() throws SQLException{
String jdbcUrl = null;
- String jdbcDriver = null;
String jdbcUser = null;
String jdbcPassword = null;
try{
- jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
- jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
- jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
- jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+ AiravataUtils.setExecutionAsServer();
+ jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
+ jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
+ jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (RegistryException e) {
- logger.error("Unable to read properties" , e);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
}
-
-
startDerbyInServerMode();
if(!isServerStarted(server, 20)){
throw new RuntimeException("Derby server cound not started within five seconds...");
}
-// startDerbyInEmbeddedMode();
Connection conn = null;
try {
@@ -138,27 +136,36 @@ public class Initialize {
}
try{
- GatewayResource gatewayResource = (GatewayResource)ResourceUtils.createGateway(RegistrySettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
gatewayResource.setDomain("test-domain");
gatewayResource.setEmailAddress("test-email");
gatewayResource.save();
-
- UserResource userResource = ResourceUtils.createUser(RegistrySettings.getSetting("default.registry.user"),RegistrySettings.getSetting("default.registry.password"));
+
+ UserResource userResource = new UserResource();
+ userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
+ userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
userResource.save();
WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
workerResource.setUser(userResource.getUserName());
workerResource.save();
-
- ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
- resource.setId("default");
- resource.setName("default");
- resource.setWorker(workerResource);
- resource.save();
-
+
+ ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
+ projectResource.setGateway(gatewayResource);
+ projectResource.setId("default");
+ projectResource.setName("default");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
+ throw new SQLException(e.getMessage(), e);
} catch (RegistryException e) {
- logger.error("Error while saving data to registry", e);
+ logger.error("Unable to save data to registry", e);
+ throw new SQLException(e.getMessage(), e);
}
}
@@ -313,22 +320,12 @@ public class Initialize {
}
- private void startDerbyInEmbeddedMode(){
- try {
- Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
- DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
- } catch (ClassNotFoundException e) {
- logger.error(e.getMessage(), e);
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
-
- public void stopDerbyServer() {
+ public void stopDerbyServer() throws SQLException{
try {
server.shutdown();
} catch (Exception e) {
logger.error(e.getMessage(), e);
+ throw new SQLException("Error while stopping derby server", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
index df26cb4..2dc59a0 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/util/Initialize.java
@@ -17,14 +17,16 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
+
package org.apache.airavata.orchestrator.core.util;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
-import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
import org.apache.airavata.persistance.registry.jpa.resources.*;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,27 +91,23 @@ public class Initialize {
return false;
}
- public void initializeDB() {
+ public void initializeDB() throws SQLException{
String jdbcUrl = null;
- String jdbcDriver = null;
String jdbcUser = null;
String jdbcPassword = null;
try{
- jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
- jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
- jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
- jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+ AiravataUtils.setExecutionAsServer();
+ jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
+ jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
+ jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (RegistryException e) {
- logger.error("Unable to read properties" , e);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
}
-
-
startDerbyInServerMode();
if(!isServerStarted(server, 20)){
throw new RuntimeException("Derby server cound not started within five seconds...");
}
-// startDerbyInEmbeddedMode();
Connection conn = null;
try {
@@ -138,27 +136,36 @@ public class Initialize {
}
try{
- GatewayResource gatewayResource = (GatewayResource)ResourceUtils.createGateway(RegistrySettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
+ GatewayResource gatewayResource = new GatewayResource();
+ gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
gatewayResource.setDomain("test-domain");
gatewayResource.setEmailAddress("test-email");
gatewayResource.save();
-
- UserResource userResource = ResourceUtils.createUser(RegistrySettings.getSetting("default.registry.user"),RegistrySettings.getSetting("default.registry.password"));
+
+ UserResource userResource = new UserResource();
+ userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
+ userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
userResource.save();
WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
workerResource.setUser(userResource.getUserName());
workerResource.save();
-
- ProjectResource resource = (ProjectResource)gatewayResource.create(ResourceType.PROJECT);
- resource.setId("default");
- resource.setName("default");
- resource.setWorker(workerResource);
- resource.save();
-
- } catch (RegistryException e) {
+
+ ProjectResource projectResource = (ProjectResource)workerResource.create(ResourceType.PROJECT);
+ projectResource.setGateway(gatewayResource);
+ projectResource.setId("default");
+ projectResource.setName("default");
+ projectResource.setWorker(workerResource);
+ projectResource.save();
+
+
+ } catch (ApplicationSettingsException e) {
logger.error("Unable to read properties", e);
+ throw new SQLException(e.getMessage(), e);
+ } catch (RegistryException e) {
+ logger.error("Unable to save data to registry", e);
+ throw new SQLException(e.getMessage(), e);
}
}
@@ -318,7 +325,7 @@ public class Initialize {
server.shutdown();
} catch (Exception e) {
logger.error(e.getMessage(), e);
- throw new SQLException(e.getMessage(), e);
+ throw new SQLException("Error while stopping derby server", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/pom.xml
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/pom.xml b/modules/registry/airavata-jpa-registry/pom.xml
index cb78f38..344a25e 100644
--- a/modules/registry/airavata-jpa-registry/pom.xml
+++ b/modules/registry/airavata-jpa-registry/pom.xml
@@ -98,9 +98,9 @@
<version>${derby.version}</version>
<scope>test</scope>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>airavata-client-configuration</artifactId>
+ <artifactId>airavata-server-configuration</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
index fb056b9..db1c29f 100644
--- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
+++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/UserResource.java
@@ -20,20 +20,20 @@
*/
package org.apache.airavata.persistance.registry.jpa.resources;
-import java.security.NoSuchAlgorithmException;
-import java.util.List;
-
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.SecurityUtil;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.Resource;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
import org.apache.airavata.persistance.registry.jpa.ResourceUtils;
import org.apache.airavata.persistance.registry.jpa.model.Users;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
+import org.apache.airavata.registry.cpi.RegistryException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.airavata.registry.cpi.RegistryException;
import javax.persistence.EntityManager;
+import java.security.NoSuchAlgorithmException;
+import java.util.List;
public class UserResource extends AbstractResource {
private final static Logger logger = LoggerFactory.getLogger(UserResource.class);
@@ -120,10 +120,10 @@ public class UserResource extends AbstractResource {
if (password != null && !password.equals("")) {
try {
user.setPassword(SecurityUtil.digestString(password,
- RegistrySettings.getSetting("default.registry.password.hash.method")));
+ ServerSettings.getSetting("default.registry.password.hash.method")));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (RegistryException e) {
+ } catch (ApplicationSettingsException e) {
throw new RuntimeException("Error reading hash algorithm from configurations", e);
}
}
@@ -131,10 +131,10 @@ public class UserResource extends AbstractResource {
if (password != null && !password.equals("")) {
try {
existingUser.setPassword(SecurityUtil.digestString(password,
- RegistrySettings.getSetting("default.registry.password.hash.method")));
+ ServerSettings.getSetting("default.registry.password.hash.method")));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Error hashing default admin password. Invalid hash algorithm.", e);
- } catch (RegistryException e) {
+ } catch (ApplicationSettingsException e) {
throw new RuntimeException("Error reading hash algorithm from configurations", e);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
index 1c4ff8b..35a3258 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/AbstractResourceTest.java
@@ -21,12 +21,12 @@
package org.apache.airavata.persistance.registry.jpa;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
import org.apache.airavata.persistance.registry.jpa.util.Initialize;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -50,9 +50,9 @@ public abstract class AbstractResourceTest {
}
@Before
public void setUp() throws Exception {
- gatewayResource = (GatewayResource)ResourceUtils.getGateway("default");
- workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), "admin");
- userResource = (UserResource)ResourceUtils.getUser(RegistrySettings.getSetting("default.registry.user"));
+ gatewayResource = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
+ workerResource = (WorkerResource)ResourceUtils.getWorker(gatewayResource.getGatewayName(), ServerSettings.getDefaultUser());
+ userResource = (UserResource)ResourceUtils.getUser(ServerSettings.getDefaultUser());
projectResource = workerResource.getProject("default");
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
index 33bb01d..022b197 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/GatewayResourceTest.java
@@ -23,6 +23,7 @@ package org.apache.airavata.persistance.registry.jpa;
import static org.junit.Assert.*;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.resources.*;
import org.junit.After;
import org.junit.Test;
@@ -48,7 +49,7 @@ public class GatewayResourceTest extends AbstractResourceTest {
workerResource = super.getWorkerResource();
userResource = super.getUserResource();
if (gatewayResource == null) {
- gatewayResource = (GatewayResource) ResourceUtils.getGateway("default");
+ gatewayResource = (GatewayResource) ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway());
}
projectResource = (ProjectResource) gatewayResource.create(ResourceType.PROJECT);
projectResource.setId("testProject");
@@ -73,7 +74,7 @@ public class GatewayResourceTest extends AbstractResourceTest {
gatewayResource.setDomain("owner1");
gatewayResource.save();
- boolean gatewayExist = ResourceUtils.isGatewayExist("default");
+ boolean gatewayExist = ResourceUtils.isGatewayExist(ServerSettings.getDefaultUserGateway());
assertTrue("The gateway exisits", gatewayExist);
}
@@ -88,13 +89,13 @@ public class GatewayResourceTest extends AbstractResourceTest {
@Test
public void testIsExists() throws Exception {
- assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, "admin"));
+ assertTrue(gatewayResource.isExists(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
assertTrue(gatewayResource.isExists(ResourceType.EXPERIMENT, "testExpID"));
}
@Test
public void testGet() throws Exception {
- assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, "admin"));
+ assertNotNull(gatewayResource.get(ResourceType.GATEWAY_WORKER, ServerSettings.getDefaultUser()));
assertNotNull(gatewayResource.get(ResourceType.EXPERIMENT, "testExpID"));
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
index 1a78b1e..125efc6 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/RegistryUseCaseTest.java
@@ -21,6 +21,8 @@
package org.apache.airavata.persistance.registry.jpa;
import junit.framework.Assert;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.workspace.Project;
@@ -63,7 +65,7 @@ public class RegistryUseCaseTest {
try {
String TAG = System.currentTimeMillis() + "";
- String gatewayId = "default";
+ String gatewayId = ServerSettings.getDefaultUserGateway();
//testing the creation of a project
Project project = new Project();
@@ -157,6 +159,8 @@ public class RegistryUseCaseTest {
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
}
}
@@ -165,7 +169,7 @@ public class RegistryUseCaseTest {
try {
String TAG = System.currentTimeMillis() + "";
- String gatewayId = "default";
+ String gatewayId = ServerSettings.getDefaultUserGateway();
//creating project
Project project = new Project();
@@ -283,6 +287,8 @@ public class RegistryUseCaseTest {
} catch (RegistryException e) {
e.printStackTrace();
Assert.fail();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
----------------------------------------------------------------------
diff --git a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
index 3dcc0c2..e362d6f 100644
--- a/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
+++ b/modules/registry/airavata-jpa-registry/src/test/java/org/apache/airavata/persistance/registry/jpa/util/Initialize.java
@@ -21,6 +21,9 @@
package org.apache.airavata.persistance.registry.jpa.util;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.persistance.registry.jpa.ResourceType;
import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource;
import org.apache.airavata.persistance.registry.jpa.resources.ProjectResource;
@@ -28,7 +31,6 @@ import org.apache.airavata.persistance.registry.jpa.resources.UserResource;
import org.apache.airavata.persistance.registry.jpa.resources.Utils;
import org.apache.airavata.persistance.registry.jpa.resources.WorkerResource;
import org.apache.airavata.registry.cpi.RegistryException;
-import org.apache.airavata.registry.cpi.utils.RegistrySettings;
import org.apache.derby.drda.NetworkServerControl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,25 +97,21 @@ public class Initialize {
public void initializeDB() throws SQLException{
String jdbcUrl = null;
- String jdbcDriver = null;
String jdbcUser = null;
String jdbcPassword = null;
try{
- jdbcDriver = RegistrySettings.getSetting("registry.jdbc.driver");
- jdbcUrl = RegistrySettings.getSetting("registry.jdbc.url");
- jdbcUser = RegistrySettings.getSetting("registry.jdbc.user");
- jdbcPassword = RegistrySettings.getSetting("registry.jdbc.password");
+ AiravataUtils.setExecutionAsServer();
+ jdbcUrl = ServerSettings.getSetting("registry.jdbc.url");
+ jdbcUser = ServerSettings.getSetting("registry.jdbc.user");
+ jdbcPassword = ServerSettings.getSetting("registry.jdbc.password");
jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
- } catch (RegistryException e) {
- logger.error("Unable to read properties" , e);
+ } catch (ApplicationSettingsException e) {
+ logger.error("Unable to read properties", e);
}
-
-
startDerbyInServerMode();
if(!isServerStarted(server, 20)){
throw new RuntimeException("Derby server cound not started within five seconds...");
}
-// startDerbyInEmbeddedMode();
Connection conn = null;
try {
@@ -143,15 +141,15 @@ public class Initialize {
try{
GatewayResource gatewayResource = new GatewayResource();
- gatewayResource.setGatewayId(RegistrySettings.getSetting("default.registry.gateway"));
- gatewayResource.setGatewayName(RegistrySettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayId(ServerSettings.getSetting("default.registry.gateway"));
+ gatewayResource.setGatewayName(ServerSettings.getSetting("default.registry.gateway"));
gatewayResource.setDomain("test-domain");
gatewayResource.setEmailAddress("test-email");
gatewayResource.save();
UserResource userResource = new UserResource();
- userResource.setUserName(RegistrySettings.getSetting("default.registry.user"));
- userResource.setPassword(RegistrySettings.getSetting("default.registry.password"));
+ userResource.setUserName(ServerSettings.getSetting("default.registry.user"));
+ userResource.setPassword(ServerSettings.getSetting("default.registry.password"));
userResource.save();
WorkerResource workerResource = (WorkerResource) gatewayResource.create(ResourceType.GATEWAY_WORKER);
@@ -166,9 +164,12 @@ public class Initialize {
projectResource.save();
- } catch (RegistryException e) {
+ } catch (ApplicationSettingsException e) {
logger.error("Unable to read properties", e);
throw new SQLException(e.getMessage(), e);
+ } catch (RegistryException e) {
+ logger.error("Unable to save data to registry", e);
+ throw new SQLException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/RegistrySettings.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/RegistrySettings.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/RegistrySettings.java
deleted file mode 100644
index 6c7bff0..0000000
--- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/utils/RegistrySettings.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.registry.cpi.utils;
-
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.registry.cpi.RegistryException;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Pattern;
-
-public class RegistrySettings {
- private static final String REPOSITORY_PROPERTIES = "registry.properties";
- private static Properties properties = new Properties();
- private static Exception propertyLoadException;
- private static final String REGISTRY_ACCESSOR_CLASS = "class.registry.accessor";
- private static final String SAVE_APPLICATION_JOB_STATUS_HISTORY="enable.application.job.status.history";
-
- static{
- URL url = RegistrySettings.class.getClassLoader()
- .getResource(REPOSITORY_PROPERTIES);
- if (url == null) {
- if (AiravataUtils.isServer()){
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.SERVER_PROPERTIES);
- if(url == null){
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.CLIENT_PROPERTIES);
- }
- }else if (AiravataUtils.isClient()){
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.CLIENT_PROPERTIES);
- if(url == null){
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.SERVER_PROPERTIES);
- }
- }else{
- //unknown execution mode... If so, first assume its client, if not server...
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.CLIENT_PROPERTIES);
- if (url==null){
- url=RegistrySettings.class.getClassLoader().getResource(ApplicationSettings.SERVER_PROPERTIES);
- }
- }
- }
- try {
- properties.load(url.openStream());
- } catch (Exception e) {
- propertyLoadException=e;
- }
- System.out.println(url);
- }
-
- private static void validateSuccessfulPropertyFileLoad() throws RegistryException{
- if (propertyLoadException!=null){
- throw new RegistryException(propertyLoadException);
- }
- }
-
- public static String getSetting(String key) throws RegistryException{
- String rawValue=null;
- if (System.getProperties().containsKey(key)){
- rawValue=System.getProperties().getProperty(key);
- }else{
- validateSuccessfulPropertyFileLoad();
- if (properties.containsKey(key)){
- rawValue=properties.getProperty(key);
- }else{
- return null;
- }
- }
- return deriveAbsoluteValueImpl(rawValue);
-// throw new UnspecifiedRegistrySettingsException(key);
- }
-
- private static String deriveAbsoluteValueImpl(String property){
- if (property!=null){
- Map<Integer, String> containedParameters = StringUtil.getContainedParameters(property);
- List<String> parametersAlreadyProcessed=new ArrayList<String>();
- for (String parameter : containedParameters.values()) {
- if (!parametersAlreadyProcessed.contains(parameter)) {
- String parameterName = parameter.substring(2,parameter.length() - 1);
- String parameterValue = getSetting(parameterName,parameter);
- property = property.replaceAll(Pattern.quote(parameter), parameterValue);
- parametersAlreadyProcessed.add(parameter);
- }
- }
- }
- return property;
- }
- public static String getSetting(String key, String defaultValue){
- try {
- return getSetting(key);
- } catch (RegistryException e) {
- //we'll ignore this error since a default value is provided
- }
- return defaultValue;
- }
-
- public static String getRegistryAccessorClass() throws RegistryException{
-
- return getSetting(REGISTRY_ACCESSOR_CLASS);
- }
-
- public static boolean isApplicationJobStatusHistoryEnabled(){
- return "true".equalsIgnoreCase(getSetting(SAVE_APPLICATION_JOB_STATUS_HISTORY, "false"));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties b/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
index 8e79d9b..90024c1 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/resources/airavata-client.properties
@@ -30,7 +30,7 @@
###########################################################################
# Airavata Thrift Server configurations
###########################################################################
-thrift.server.host=localhost
+thrift.server.host=gw153.iu.xsede.org
thrift.server.port=8930
###########################################################################
@@ -39,9 +39,9 @@ thrift.server.port=8930
credential.store.keystore.url=/Users/chathuri/dev/airavata/credential-store/oa4mp/airavata_sym.jks
credential.store.keystore.alias=airavata
credential.store.keystore.password=airavata
-credential.store.jdbc.url=jdbc:mysql://localhost:3306/experiment_catalog
-credential.store.jdbc.user=airavata
-credential.store.jdbc.password=airavata
+credential.store.jdbc.url=jdbc:mysql://gw85.iu.xsede.org:3306/airavata_gw153
+credential.store.jdbc.user=SciGaP15Deploy
+credential.store.jdbc.password=SciGaP15Deploy
credential.store.jdbc.driver=com.mysql.jdbc.Driver
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.json
----------------------------------------------------------------------
diff --git a/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.json b/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.json
index 4a987bf..3a3556a 100644
--- a/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.json
+++ b/modules/test-suite/multi-tenanted-airavata/src/main/resources/test-framework.json
@@ -7,7 +7,7 @@
"sshPubKeyLoc": "/Users/chathuri/Desktop/ssh_gw111/id_rsa.pub",
"sshPrivateKeyLoc": "/Users/chathuri/Desktop/ssh_gw111/id_rsa",
"sshPassword": "ultrascan",
- "sshUsername": "ogce",
+ "sshUsername": "us3",
"tokenFileLoc": "/tmp/",
"resultFileLoc": "/tmp/test_framework_results/",
"skippedGateways": "default,php_reference_gateway,umass",
@@ -35,6 +35,16 @@
},
{
+ "name": "comet.sdsc.edu",
+ "loginUser": "us3"
+
+ },
+ {
+ "name": "lonestar.tacc.utexas.edu",
+ "loginUser": "us3"
+
+ },
+ {
"name": "bigred2.uits.iu.edu",
"loginUser": "cgateway"
@@ -52,7 +62,7 @@
{
"name": "Ultrascan",
"inputs": {
- "input": "file://chathuri@149.160.168.148:/Users/chathuri/dev/airavata/source/php/inputs/hpcinput.tar",
+ "input": "file://chathuri@149.160.168.97:/Users/chathuri/dev/airavata/source/php/inputs/hpcinput.tar",
"mgroupcount": "-mgroupcount=1",
"walltime": "-walltime=60"
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/973bf93a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 7655b49..81ad8c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -532,6 +532,7 @@
<module>modules/configuration</module>
<module>airavata-api</module>
<module>modules/commons</module>
+ <module>modules/messaging</module>
<module>modules/gfac</module>
<module>modules/workflow-model</module>
<module>modules/registry</module>
@@ -543,8 +544,7 @@
<module>modules/server</module>
<module>modules/test-suite</module>
<module>modules/distribution</module>
- <module>modules/messaging</module>
- <module>modules/integration-tests</module>
+ <!--<module>modules/integration-tests</module>-->
<module>modules/workflow</module>
<module>modules/xbaya-gui</module>
</modules>