airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [01/50] [abbrv] airavata git commit: Minor changes to UserProfileSample and TenantProfileSample
Date Wed, 05 Apr 2017 19:10:25 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 30ab06f3e -> 4eb4bc37b


Minor changes to UserProfileSample and TenantProfileSample


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2ec0e8f1
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2ec0e8f1
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2ec0e8f1

Branch: refs/heads/develop
Commit: 2ec0e8f155f7417cd206132dd9045a1cb509a821
Parents: f8e7f13
Author: Gourav Shenoy <shenoy.200@gmail.com>
Authored: Fri Mar 31 01:41:46 2017 -0400
Committer: Gourav Shenoy <shenoy.200@gmail.com>
Committed: Fri Mar 31 01:41:46 2017 -0400

----------------------------------------------------------------------
 .../client/samples/TenantProfileSample.java     | 58 ++++++++++++++++++++
 .../client/samples/UserProfileSample.java       |  2 +-
 .../handlers/TenantProfileServiceHandler.java   |  2 +-
 3 files changed, 60 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/2ec0e8f1/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/TenantProfileSample.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/TenantProfileSample.java
b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/TenantProfileSample.java
new file mode 100644
index 0000000..d200587
--- /dev/null
+++ b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/TenantProfileSample.java
@@ -0,0 +1,58 @@
+package org.apache.airavata.service.profile.client.samples;
+
+import org.apache.airavata.model.workspace.Gateway;
+import org.apache.airavata.model.workspace.GatewayApprovalStatus;
+import org.apache.airavata.service.profile.client.ProfileServiceClientFactory;
+import org.apache.airavata.service.profile.client.util.ProfileServiceClientUtil;
+import org.apache.airavata.service.profile.tenant.cpi.TenantProfileService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Created by goshenoy on 3/30/17.
+ */
+public class TenantProfileSample {
+    private static final Logger logger = LoggerFactory.getLogger(TenantProfileSample.class);
+    private static TenantProfileService.Client tenantProfileClient;
+    private static String testGatewayId = null;
+
+    public static void main(String[] args) throws Exception {
+        try {
+            String profileServiceServerHost = ProfileServiceClientUtil.getProfileServiceServerHost();
+            int profileServiceServerPort = ProfileServiceClientUtil.getProfileServiceServerPort();
+
+            tenantProfileClient = ProfileServiceClientFactory.createTenantProfileServiceClient(profileServiceServerHost,
profileServiceServerPort);
+
+            // test addGateway
+            testGatewayId = tenantProfileClient.addGateway(getGateway(null));
+
+
+
+        } catch (Exception ex) {
+            logger.error("TenantProfile client-sample Exception: " + ex, ex);
+        }
+    }
+
+    private static Gateway getGateway(String gatewayId) {
+        // get random value for userId
+        int gatewayIdValue = ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE);
+
+        if (gatewayId != null) {
+            gatewayIdValue = Integer.parseInt(gatewayId.replaceAll("test-gateway-", ""));
+        }
+
+        Gateway gateway = new Gateway();
+        gateway.setGatewayId("test-gateway-" + gatewayIdValue);
+        gateway.setGatewayApprovalStatus(GatewayApprovalStatus.APPROVED);
+        gateway.setGatewayName("test-gateway-name");
+        gateway.setDomain("test-gateway-domain");
+        gateway.setEmailAddress("test-gateway-" + gatewayIdValue + "@domain.com");
+        gateway.setGatewayURL("test-gateway-" + gatewayIdValue + ".domain.com");
+        gateway.setGatewayAdminFirstName("test-gateway-admin-fname");
+        gateway.setGatewayAdminLastName("test-gateway-admin-lname");
+        gateway.setGatewayAdminEmail("test-gateway-admin@email.domain.com");
+        return gateway;
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ec0e8f1/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java
b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java
index 5634d38..5b6b5b1 100644
--- a/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java
+++ b/airavata-services/profile-service/profile-service-client-sdks/java-client-samples/src/main/java/org/apache/airavata/service/profile/client/samples/UserProfileSample.java
@@ -74,7 +74,7 @@ public class UserProfileSample {
             System.out.println("UserProfile: " + userProfile);
 
             // test delete-user-profile
-            boolean deleteSuccess = userProfileClient.deleteUserProfile(testUserId);
+            boolean deleteSuccess = userProfileClient.deleteUserProfile(testUserId, testGatewayId);
             assert (deleteSuccess) : "Delete user failed for userId: " + testUserId;
             System.out.println("Successfully deleted user with userId: " + testUserId);
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/2ec0e8f1/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
----------------------------------------------------------------------
diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
index 576b1ab..e40fb21 100644
--- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
+++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
@@ -66,7 +66,7 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface
{
     @Override
     public String addGateway(Gateway gateway) throws TenantProfileServiceException {
         try {
-            tenantProfileRepository.create(gateway);
+            gateway = tenantProfileRepository.create(gateway);
             if (gateway != null) {
                 logger.debug("Added Airavata Gateway with Id: " + gateway.getGatewayId());
                 // replicate tenant at end-places


Mime
View raw message