You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2019/08/27 06:15:48 UTC
[airavata-custos] 28/30: added samples for end to end testing and
junit test cases
This is an automated email from the ASF dual-hosted git repository.
smarru pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit a08c0b1f7ec431469612d08065822a1631f8b799
Author: Aarushi <aa...@gmail.com>
AuthorDate: Wed Aug 21 23:31:47 2019 -0400
added samples for end to end testing and junit test cases
---
...ava => AuthenticationServiceClientFactory.java} | 2 +-
.../manager/KeyCloakSecurityManager.java | 3 +-
.../src/main/resources/keystores/airavata.jks | Bin
.../src/main/resources/keystores/airavata_sym.jks | Bin
.../main/resources/keystores/client_truststore.jks | Bin
.../user/handler/UserProfileServiceHandler.java | 10 +-
.../test/java/TestUserProfileServiceHandler.java | 36 ++--
.../custos-authentication-service-samples/pom.xml | 15 ++
.../sample/CustosAuthenticationServiceSample.java | 108 +++++++++++
.../custos-profile-service-samples/pom.xml | 15 ++
.../service/samples/TenantProfileSample.java | 80 ++++++++
.../profile/service/samples/UserProfileSample.java | 211 +++++++++++++++++++++
.../samples/utils/ProfileServiceClientUtil.java | 63 ++++++
.../resources/profile-client-sample.properties | 29 +++
ide-integration/custos-services/pom.xml | 15 ++
.../server/start}/CustosAPIServerStarted.java | 4 +-
.../src/main/resources/custos-server.properties | 2 +-
.../database_scripts/init/01-databases.sql | 43 +++--
.../user-profile-catalog-derby.sql | 30 ---
.../user-profile-catalog-mysql.sql | 30 ---
.../src/main/resources/docker-compose.yml | 0
.../main/resources/keycloak/Default-export.json | 0
.../main/resources/keycloak/Default-export.json.bk | 0
.../src/main/resources/keycloak/standalone.xml | 0
.../src/main/resources/keystores/airavata.jks | Bin
.../src/main/resources/keystores/airavata_sym.jks | Bin
.../main/resources/keystores/client_truststore.jks | Bin
ide-integration/pom.xml | 18 ++
28 files changed, 614 insertions(+), 100 deletions(-)
diff --git a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java
similarity index 95%
rename from custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
rename to custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java
index 4fc0444..734e55e 100644
--- a/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClient.java
+++ b/custos-client/src/main/java/org/apache/custos/client/authentication/service/AuthenticationServiceClientFactory.java
@@ -8,7 +8,7 @@ import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;
-public class AuthenticationServiceClient {
+public class AuthenticationServiceClientFactory {
public static CustosAuthenticationService.Client createAuthenticationServiceClient(String serverHost, int serverPort) throws CustosAuthenticationServiceException {
try {
diff --git a/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java b/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
index e7f8b30..13c925e 100644
--- a/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
+++ b/custos-connectors/src/main/java/org.apache.custos.security/manager/KeyCloakSecurityManager.java
@@ -95,6 +95,7 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
String accessToken = authzToken.getAccessToken();
String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
try {
+ initializeSecurityInfra();
if (ServerSettings.isAuthzCacheEnabled()) {
//obtain an instance of AuthzCacheManager implementation.
AuthzCacheManager authzCacheManager = AuthzCacheManagerFactory.getAuthzCacheManager();
@@ -138,6 +139,7 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
@Override
public AuthzToken getUserManagementServiceAccountAuthzToken(AuthzToken authzToken, String gatewayId) throws CustosSecurityException {
try {
+ initializeSecurityInfra();
tenantProfileClient = getTenantProfileServiceClient();
Gateway gateway = tenantProfileClient.getGatewayUsingGatewayId(authzToken, gatewayId);
String tokenURL = getTokenEndpoint(gatewayId);
@@ -164,7 +166,6 @@ public class KeyCloakSecurityManager implements CustosSecurityManager {
}
private UserInfo getUserInfo(String gatewayId, String token) throws Exception {
- //TODO: Confirm the difference between gatewayId and IdentityServerTenant, using gatewayId as of now
String openIdConnectUrl = getOpenIDConfigurationUrl(gatewayId);
JSONObject openIdConnectConfig = new JSONObject(getFromUrl(openIdConnectUrl, null));
String userInfoEndPoint = openIdConnectConfig.getString("userinfo_endpoint");
diff --git a/ide-integration/src/main/resources/keystores/airavata.jks b/custos-connectors/src/main/resources/keystores/airavata.jks
similarity index 100%
copy from ide-integration/src/main/resources/keystores/airavata.jks
copy to custos-connectors/src/main/resources/keystores/airavata.jks
diff --git a/ide-integration/src/main/resources/keystores/airavata_sym.jks b/custos-connectors/src/main/resources/keystores/airavata_sym.jks
similarity index 100%
copy from ide-integration/src/main/resources/keystores/airavata_sym.jks
copy to custos-connectors/src/main/resources/keystores/airavata_sym.jks
diff --git a/ide-integration/src/main/resources/keystores/client_truststore.jks b/custos-connectors/src/main/resources/keystores/client_truststore.jks
similarity index 100%
copy from ide-integration/src/main/resources/keystores/client_truststore.jks
copy to custos-connectors/src/main/resources/keystores/client_truststore.jks
diff --git a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
index e29b39d..e3c9d07 100644
--- a/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
+++ b/custos-profile-service/user-profile-service/src/main/java/org/apache/custos/profile/user/handler/UserProfileServiceHandler.java
@@ -103,7 +103,6 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
try{
// Lowercase user id and internal id
userProfile.setUserId(userProfile.getUserId().toLowerCase());
- userProfile.setCustosInternalUserId(userProfile.getUserId() + "@" + userProfile.getGatewayId());
userProfile = userProfileRepository.updateUserProfile(userProfile, getIAMUserProfileUpdater(authzToken, userProfile));
if (null != userProfile) {
logger.info("Added UserProfile with userId: " + userProfile.getUserId());
@@ -232,4 +231,13 @@ public class UserProfileServiceHandler implements UserProfileService.Iface {
throw ex;
}
}
+
+ private void updateCustosInternalId(UserProfile userProfile){
+ //TODO: check if other ids need to be changed
+ String internalId = userProfile.getUserId() + "@" + userProfile.getGatewayId();
+ userProfile.setCustosInternalUserId(internalId);
+ if(userProfile.isSetNsfDemographics()){
+ userProfile.setNsfDemographics(userProfile.getNsfDemographics().setCustosInternalUserId(internalId));
+ }
+ }
}
diff --git a/custos-profile-service/user-profile-service/src/test/java/TestUserProfileServiceHandler.java b/custos-profile-service/user-profile-service/src/test/java/TestUserProfileServiceHandler.java
index b88cee2..75bf90e 100644
--- a/custos-profile-service/user-profile-service/src/test/java/TestUserProfileServiceHandler.java
+++ b/custos-profile-service/user-profile-service/src/test/java/TestUserProfileServiceHandler.java
@@ -9,7 +9,6 @@ import org.apache.custos.profile.user.cpi.exception.UserProfileServiceException;
import org.apache.custos.profile.user.handler.UserProfileServiceHandler;
import org.apache.custos.security.manager.CustosSecurityManager;
import org.apache.custos.security.manager.SecurityManagerFactory;
-import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -40,10 +39,6 @@ public class TestUserProfileServiceHandler {
authzToken.setClaimsMap(map);
authzToken.setAccessToken("access token");
}
- @After
- public void cleanUp() {
-
- }
@Test
public void testInitializeUserProfileWhenUserProfileDoesNotExist(@Mocked CustosSecurityManager mockedSecurityManager) throws UserProfileServiceException, CustosSecurityException {
UserInfo userInfo = new UserInfo();
@@ -64,21 +59,36 @@ public class TestUserProfileServiceHandler {
}
@Test
public void testInitializeUserProfileWhenUserProfileExists(@Mocked CustosSecurityManager mockedSecurityManager) throws UserProfileServiceException, CustosSecurityException{
+ //create a user
UserInfo userInfo = new UserInfo();
userInfo.setUsername("test-username");
- userInfo.setEmailAddress("some-other-test@test.com");
- userInfo.setFirstName("someother-test-first-name");
- userInfo.setLastName("someother-test-last-name");
- String old_email_address = "test@test.com";
+ userInfo.setEmailAddress("test@test.com");
+ userInfo.setFirstName("test-first-name");
+ userInfo.setLastName("test-last-name");
+ //create a user with same username
+ UserInfo userInfoCopy = new UserInfo();
+ userInfoCopy.setUsername("test-username");
+ userInfoCopy.setEmailAddress("some-other-test@test.com");
+ userInfoCopy.setFirstName("someother-test-first-name");
+ userInfoCopy.setLastName("someother-test-last-name");
+ AuthzToken authzTokenCopy = new AuthzToken();
+ HashMap<String,String> map = new HashMap<>();
+ map.put(Constants.GATEWAY_ID, GATEWAY_ID);
+ map.put(Constants.USER_NAME, userInfoCopy.getUsername());
+ authzTokenCopy.setClaimsMap(map);
+ authzTokenCopy.setAccessToken("access token");
+
new MockUp<SecurityManagerFactory>() {
@Mock
public CustosSecurityManager getSecurityManager(){return mockedSecurityManager;};
};
- new Expectations() {{ mockedSecurityManager.getUserInfoFromAuthzToken(authzToken); result = userInfo;}};
+ new Expectations() {{
+ mockedSecurityManager.getUserInfoFromAuthzToken(authzToken); result = userInfo;
+ mockedSecurityManager.getUserInfoFromAuthzToken(authzTokenCopy); result = userInfoCopy;}};
- UserProfile createdUserProfile = userProfileServiceHandler.initializeUserProfile(authzToken);
- assertNotNull(createdUserProfile);
- assertEquals(old_email_address,createdUserProfile.getEmails().get(0));
+ userProfileServiceHandler.initializeUserProfile(authzToken);
+ UserProfile createdUserProfile = userProfileServiceHandler.initializeUserProfile(authzTokenCopy);
+ assertNotNull(createdUserProfile);
assertEquals(userInfo.getUsername().toLowerCase(), createdUserProfile.getUserId());
assertEquals(GATEWAY_ID,createdUserProfile.getGatewayId());
}
diff --git a/ide-integration/custos-authentication-service-samples/pom.xml b/ide-integration/custos-authentication-service-samples/pom.xml
new file mode 100644
index 0000000..5a035cd
--- /dev/null
+++ b/ide-integration/custos-authentication-service-samples/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>ide-integration</artifactId>
+ <groupId>org.apache.custos</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>custos-authentication-service-samples</artifactId>
+
+
+</project>
\ No newline at end of file
diff --git a/ide-integration/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java b/ide-integration/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java
new file mode 100644
index 0000000..ac2c122
--- /dev/null
+++ b/ide-integration/custos-authentication-service-samples/src/main/java/org/apache/custos/authentication/service/sample/CustosAuthenticationServiceSample.java
@@ -0,0 +1,108 @@
+package org.apache.custos.authentication.service.sample;
+
+import org.apache.custos.authentication.cpi.CustosAuthenticationService;
+import org.apache.custos.client.authentication.service.AuthenticationServiceClientFactory;
+import org.apache.custos.commons.exceptions.CustosSecurityException;
+import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.commons.utils.Constants;
+import org.apache.custos.security.manager.KeyCloakSecurityManager;
+import org.apache.http.Consts;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.apache.thrift.TException;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+public class CustosAuthenticationServiceSample {
+
+ private static final Logger log = LoggerFactory.getLogger(CustosAuthenticationServiceSample.class);
+ //present in keycloak json configuration
+ public static String USERNAME = "default-admin";
+ public static String GATEWAY_ID = "default";
+
+ public static void main(String[] args) throws Exception{
+
+ try {
+ //change this based on the port on which the server is started
+ String serverHost = "localhost";
+ int serverPort = 9091;
+ CustosAuthenticationService.Client client = AuthenticationServiceClientFactory.createAuthenticationServiceClient(serverHost, serverPort);
+ testUserAuthentication(client);
+ }catch (TException e) {
+ throw new Exception(e);
+ }catch (Exception e){
+ throw new Exception("Error setting up the authentication server", e);
+ }
+ }
+
+ public static void testUserAuthentication(CustosAuthenticationService.Client client) throws TException, CustosSecurityException {
+ boolean authenticated = false;
+ new KeyCloakSecurityManager().initializeSecurityInfra();
+ AuthzToken authzToken = new AuthzToken();
+ HashMap<String, String> map_ = new HashMap<>();
+ map_.put(Constants.GATEWAY_ID, GATEWAY_ID);
+ map_.put(Constants.USER_NAME, USERNAME);
+ authzToken.setClaimsMap(map_);
+ JSONObject json = getAccessToken();
+ if(json.has("access_token")){
+ String access_token = getAccessToken().get("access_token").toString();
+ authzToken.setAccessToken(access_token);
+ authenticated = client.isUserAuthenticated(authzToken);
+ }
+
+ assert (authenticated): "User authenticating failed";
+ if(authenticated){
+ log.info("User successfully authenticated");
+ }
+
+ }
+
+ private static JSONObject getAccessToken() {
+ String password = "123456";
+ String tokenEndPoint = "https://airavata.host:8443/auth/realms/default/protocol/openid-connect/token";
+ String grant_type = "password";
+ String client_id = "admin-cli";
+
+ CloseableHttpClient httpClient = HttpClients.createSystem();
+ HttpPost httpPost = new HttpPost(tokenEndPoint);
+ ;
+ List<NameValuePair> formParams = new ArrayList<>();
+ formParams.add(new BasicNameValuePair("grant_type", "password"));
+ formParams.add(new BasicNameValuePair("client_id", client_id));
+ formParams.add(new BasicNameValuePair("username", USERNAME));
+ formParams.add(new BasicNameValuePair("password", password));
+ UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
+ httpPost.setEntity(entity);
+ try {
+ CloseableHttpResponse response = httpClient.execute(httpPost);
+ try {
+ String responseBody = EntityUtils.toString(response.getEntity());
+ JSONObject tokenInfo = new JSONObject(responseBody);
+ return tokenInfo;
+ } finally {
+ response.close();
+ }
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ httpClient.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+}
diff --git a/ide-integration/custos-profile-service-samples/pom.xml b/ide-integration/custos-profile-service-samples/pom.xml
new file mode 100644
index 0000000..070cda2
--- /dev/null
+++ b/ide-integration/custos-profile-service-samples/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>ide-integration</artifactId>
+ <groupId>org.apache.custos</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>custos-profile-service-samples</artifactId>
+
+
+</project>
\ No newline at end of file
diff --git a/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/TenantProfileSample.java b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/TenantProfileSample.java
new file mode 100644
index 0000000..0e87e9a
--- /dev/null
+++ b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/TenantProfileSample.java
@@ -0,0 +1,80 @@
+/**
+ *
+ * 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.custos.profile.service.samples;
+
+import org.apache.custos.client.profile.service.CustosProfileServiceClientFactory;
+import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.profile.model.workspace.Gateway;
+import org.apache.custos.profile.model.workspace.GatewayApprovalStatus;
+import org.apache.custos.profile.service.samples.utils.ProfileServiceClientUtil;
+import org.apache.custos.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 Gateway testGateway = null;
+ private static AuthzToken authzToken = new AuthzToken("empy_token");
+
+ public static void main(String[] args) throws Exception {
+ try {
+ String profileServiceServerHost = ProfileServiceClientUtil.getProfileServiceServerHost();
+ int profileServiceServerPort = ProfileServiceClientUtil.getProfileServiceServerPort();
+
+ tenantProfileClient = CustosProfileServiceClientFactory.createCustosTenantProfileServiceClient(profileServiceServerHost, profileServiceServerPort);
+
+ // test addGateway
+ testGateway = tenantProfileClient.addGateway(authzToken, getGateway("465"));
+ assert (testGateway != null) : "Gateway creation failed!";
+ System.out.println("Gateway created with gatewayId: " + testGateway);
+
+
+ } 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(1000);
+
+ 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;
+ }
+}
diff --git a/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/UserProfileSample.java b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/UserProfileSample.java
new file mode 100644
index 0000000..41255fc
--- /dev/null
+++ b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/UserProfileSample.java
@@ -0,0 +1,211 @@
+/**
+ *
+ * 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.custos.profile.service.samples;
+
+import org.apache.custos.client.profile.service.CustosProfileServiceClientFactory;
+import org.apache.custos.commons.exceptions.CustosSecurityException;
+import org.apache.custos.commons.model.security.AuthzToken;
+import org.apache.custos.commons.utils.Constants;
+import org.apache.custos.profile.model.user.*;
+import org.apache.custos.profile.service.samples.utils.ProfileServiceClientUtil;
+import org.apache.custos.profile.user.cpi.UserProfileService;
+import org.apache.custos.security.manager.KeyCloakSecurityManager;
+import org.apache.http.Consts;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+import org.json.JSONObject;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+
+/**
+ * Created by goshenoy on 3/23/17.
+ */
+public class UserProfileSample {
+
+ private static final Logger logger = LoggerFactory.getLogger(UserProfileSample.class);
+ private static UserProfileService.Client userProfileClient;
+ private static UserProfile testUser = null;
+ private static String testGatewayId = "default";
+ private static String username = "default-admin";
+ private static AuthzToken authzToken;
+
+
+ /**
+ * Performs the following operations in sequence:
+ * 1. create new user
+ * 2. find user created
+ * 3. update created user's name
+ * 4. find all users in gateway
+ * 5. find created user by name
+ * 6. delete created user
+ * 7. check if user exists
+ * @param args
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ try {
+ String profileServiceServerHost = ProfileServiceClientUtil.getProfileServiceServerHost();
+ int profileServiceServerPort = ProfileServiceClientUtil.getProfileServiceServerPort();
+ authzToken = initializeAuthzToken();
+ userProfileClient = CustosProfileServiceClientFactory.createCustosUserProfileServiceClient(profileServiceServerHost, profileServiceServerPort);
+
+ // test add-user-profile
+ testUser = userProfileClient.addUserProfile(authzToken, getUserProfile(username));
+ assert (testUser != null) : "User creation failed. Null userId returned!";
+ System.out.println("User created with userId: " + testUser);
+
+ // test find-user-profile
+ UserProfile userProfile = userProfileClient.getUserProfileById(authzToken, testUser.getUserId(), testGatewayId);
+ assert (userProfile != null) : "Could not find user with userId: " + testUser + ", and gatewayID: " + testGatewayId;
+ System.out.println("UserProfile: " + userProfile);
+
+ // test update-user-profile : update name
+ userProfile = getUserProfile(testUser.getUserId());
+ String newFName = userProfile.getFirstName().replaceAll("fname", "fname-updated");
+ userProfile.setFirstName(newFName);
+ UserProfile updatedUserProfile = userProfileClient.updateUserProfile(authzToken, userProfile);
+ boolean updateSuccess = updatedUserProfile != null;
+ assert (updateSuccess) : "User update with new firstName: [" + newFName + "], Failed!";
+ System.out.println("User update with new firstName: [" + newFName + "], Successful!");
+
+ // test get-all-userprofiles
+ List<UserProfile> userProfileList = userProfileClient.getAllUserProfilesInGateway(authzToken, testGatewayId, 0, 5);
+ assert (userProfileList != null && !userProfileList.isEmpty()) : "Failed to retrieve users for gateway!";
+ System.out.println("Printing userList retrieved..");
+ for (UserProfile userProfile1 : userProfileList) {
+ System.out.println("\t [UserProfile] userId: " + userProfile1.getUserId());
+ }
+
+ // test delete-user-profile
+ boolean deleteSuccess = userProfileClient.deleteUserProfile(authzToken, testUser.getUserId(), testGatewayId) != null;
+ assert (deleteSuccess) : "Delete user failed for userId: " + testUser.getUserId();
+ System.out.println("Successfully deleted user with userId: " + testUser.getUserId());
+
+ // test-check-user-exist
+ boolean userExists = userProfileClient.doesUserExist(authzToken, testUser.getUserId(), testGatewayId);
+ assert (!userExists) : "User should not exist, but it does.";
+ System.out.println("User was deleted, hence does not exist!");
+ System.out.println("*** DONE ***");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ logger.error("UserProfile client-sample Exception: " + ex, ex);
+ }
+ }
+
+ private static UserProfile getUserProfile(String userId) {
+ // get random value for userId
+ int userIdValue = ThreadLocalRandom.current().nextInt(1000);
+
+ // construct userProfile object
+ UserProfile userProfile = new UserProfile();
+ userProfile.setUserModelVersion("model-" + userIdValue);
+ userProfile.setCustosInternalUserId("test-user-internal-" + userIdValue);
+ userProfile.setUserId(userId);
+ userProfile.setFirstName("test-user-fname");
+ userProfile.setLastName("test-user-lname");
+ userProfile.setGatewayId(testGatewayId);
+ userProfile.addToEmails("test-user-" + userIdValue + "@domain1.com");
+ userProfile.addToEmails("test-user-" + userIdValue + "@domain2.com");
+ userProfile.setCreationTime(System.currentTimeMillis());
+ userProfile.setLastAccessTime(System.currentTimeMillis());
+ userProfile.setValidUntil(System.currentTimeMillis());
+ userProfile.setState(Status.ACTIVE);
+ userProfile.setNsfDemographics(getNSFDemographics(userIdValue));
+ return userProfile;
+ }
+
+ private static NSFDemographics getNSFDemographics(int userIdValue) {
+ // construct nsfdemographics object
+ NSFDemographics nsfDemographics = new NSFDemographics();
+ nsfDemographics.setCustosInternalUserId("test-user-internal-" + userIdValue);
+ nsfDemographics.setGender("male");
+ nsfDemographics.setUsCitizenship(USCitizenship.US_CITIZEN);
+ nsfDemographics.addToEthnicities(ethnicity.NOT_HISPANIC_LATINO);
+ nsfDemographics.addToRaces(race.AMERICAN_INDIAN_OR_ALASKAN_NATIVE);
+ return nsfDemographics;
+ }
+
+ private static AuthzToken initializeAuthzToken() throws Exception{
+ authzToken = new AuthzToken();
+ {
+ HashMap<String, String> map_ = new HashMap<>();
+ map_.put(Constants.GATEWAY_ID, testGatewayId);
+ map_.put(Constants.USER_NAME, username);
+ JSONObject json = getAccessToken();
+ if(json.has("access_token")) {
+ authzToken.setAccessToken(json.get("access_token").toString());
+ }
+ else{
+ throw new Exception("Cannot find access token for the user. Check if the user exists in the IDP");
+ }
+ authzToken.setClaimsMap(map_);
+ return authzToken;
+ }
+ }
+ private static JSONObject getAccessToken() throws CustosSecurityException {
+ new KeyCloakSecurityManager().initializeSecurityInfra();
+ String password = "123456";
+ String tokenEndPoint = "https://airavata.host:8443/auth/realms/default/protocol/openid-connect/token";
+ String grant_type = "password";
+ String client_id = "admin-cli";
+
+ CloseableHttpClient httpClient = HttpClients.createSystem();
+ HttpPost httpPost = new HttpPost(tokenEndPoint);
+ ;
+ List<NameValuePair> formParams = new ArrayList<>();
+ formParams.add(new BasicNameValuePair("grant_type", "password"));
+ formParams.add(new BasicNameValuePair("client_id", client_id));
+ formParams.add(new BasicNameValuePair("username", username));
+ formParams.add(new BasicNameValuePair("password", password));
+ UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
+ httpPost.setEntity(entity);
+ try {
+ CloseableHttpResponse response = httpClient.execute(httpPost);
+ try {
+ String responseBody = EntityUtils.toString(response.getEntity());
+ JSONObject tokenInfo = new JSONObject(responseBody);
+ return tokenInfo;
+ } finally {
+ response.close();
+ }
+
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ try {
+ httpClient.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+}
diff --git a/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/utils/ProfileServiceClientUtil.java b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/utils/ProfileServiceClientUtil.java
new file mode 100644
index 0000000..2ec4c92
--- /dev/null
+++ b/ide-integration/custos-profile-service-samples/src/main/java/org/apache/custos/profile/service/samples/utils/ProfileServiceClientUtil.java
@@ -0,0 +1,63 @@
+/**
+ *
+ * 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.custos.profile.service.samples.utils;
+
+import java.net.URL;
+import java.util.Properties;
+
+public class ProfileServiceClientUtil {
+
+ private static final String PROFILE_SERVICE_SERVER_HOST = "profile.service.server.host";
+ private static final String PROFILE_SERVICE_SERVER_PORT = "profile.service.server.port";
+ private static final String PROFILE_CLIENT_SAMPLE_PROPERTIES = "profile-client-sample.properties";
+
+ private static Properties properties;
+ private static Exception propertyLoadException;
+
+ static {
+ loadProperties();
+ }
+
+ private static void loadProperties() {
+ URL url = ProfileServiceClientUtil.class.getClassLoader().getResource(PROFILE_CLIENT_SAMPLE_PROPERTIES);
+ try {
+ properties = new Properties();
+ properties.load(url.openStream());
+ } catch (Exception ex) {
+ propertyLoadException = ex;
+ }
+ }
+
+ public static String getProfileServiceServerHost() throws Exception {
+ validateSuccessfullPropertyLoad();
+ return properties.getProperty(PROFILE_SERVICE_SERVER_HOST);
+ }
+
+ public static int getProfileServiceServerPort() throws Exception {
+ validateSuccessfullPropertyLoad();
+ return Integer.parseInt(properties.getProperty(PROFILE_SERVICE_SERVER_PORT));
+ }
+
+ private static void validateSuccessfullPropertyLoad() throws Exception {
+ if (propertyLoadException != null) {
+ throw new Exception(propertyLoadException.getMessage(), propertyLoadException);
+ }
+ }
+}
diff --git a/ide-integration/custos-profile-service-samples/src/main/resources/profile-client-sample.properties b/ide-integration/custos-profile-service-samples/src/main/resources/profile-client-sample.properties
new file mode 100644
index 0000000..404d404
--- /dev/null
+++ b/ide-integration/custos-profile-service-samples/src/main/resources/profile-client-sample.properties
@@ -0,0 +1,29 @@
+#
+#
+# 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.
+#
+
+##################################################################################
+#
+# This properties file provides configuration for profile-service sample client
+#
+##################################################################################
+
+profile.service.server.host=localhost
+profile.service.server.port=8081
+
diff --git a/ide-integration/custos-services/pom.xml b/ide-integration/custos-services/pom.xml
new file mode 100644
index 0000000..db15484
--- /dev/null
+++ b/ide-integration/custos-services/pom.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>ide-integration</artifactId>
+ <groupId>org.apache.custos</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>custos-services-start</artifactId>
+
+
+</project>
\ No newline at end of file
diff --git a/ide-integration/src/main/java/CustosAPIServerStarted.java b/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java
similarity index 92%
rename from ide-integration/src/main/java/CustosAPIServerStarted.java
rename to ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java
index 909374e..81dd02b 100644
--- a/ide-integration/src/main/java/CustosAPIServerStarted.java
+++ b/ide-integration/custos-services/src/main/java/org/apache/custos/server/start/CustosAPIServerStarted.java
@@ -1,3 +1,5 @@
+package org.apache.custos.server.start;
+
import org.apache.custos.authentication.server.CustosAuthenticationServer;
import org.apache.custos.profile.server.ProfileServiceServer;
@@ -8,7 +10,5 @@ public class CustosAPIServerStarted {
custosAuthenticationServer.start();
custosProfileServer.start();
-
-
}
}
diff --git a/ide-integration/src/main/resources/custos-server.properties b/ide-integration/custos-services/src/main/resources/custos-server.properties
similarity index 98%
rename from ide-integration/src/main/resources/custos-server.properties
rename to ide-integration/custos-services/src/main/resources/custos-server.properties
index d9d59c3..2e07020 100644
--- a/ide-integration/src/main/resources/custos-server.properties
+++ b/ide-integration/custos-services/src/main/resources/custos-server.properties
@@ -54,7 +54,7 @@ in.memory.cache.size=1000
# Profile Service Configuration
###########################################################################
profile.service.server.host=0.0.0.0
-profile.service.server.port=9092
+profile.service.server.port=8081
profile_service=org.apache.custos.profile.server.ProfileServiceServer
# MariaDB properties
diff --git a/ide-integration/src/main/resources/database_scripts/init/01-databases.sql b/ide-integration/custos-services/src/main/resources/database_scripts/init/01-databases.sql
similarity index 88%
rename from ide-integration/src/main/resources/database_scripts/init/01-databases.sql
rename to ide-integration/custos-services/src/main/resources/database_scripts/init/01-databases.sql
index dabf29c..710065d 100644
--- a/ide-integration/src/main/resources/database_scripts/init/01-databases.sql
+++ b/ide-integration/custos-services/src/main/resources/database_scripts/init/01-databases.sql
@@ -80,27 +80,27 @@ DROP TABLE IF EXISTS `GATEWAY`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `GATEWAY` (
- `CUSTOS_INTERNAL_GATEWAY_ID` varchar(255) NOT NULL,
- `DECLINED_REASON` varchar(255) DEFAULT NULL,
- `GATEWAY_DOMAIN` varchar(255) DEFAULT NULL,
- `EMAIL_ADDRESS` varchar(255) DEFAULT NULL,
- `GATEWAY_ACRONYM` varchar(255) DEFAULT NULL,
- `GATEWAY_ADMIN_EMAIL` varchar(255) DEFAULT NULL,
- `GATEWAY_ADMIN_FIRST_NAME` varchar(255) DEFAULT NULL,
- `GATEWAY_ADMIN_LAST_NAME` varchar(255) DEFAULT NULL,
- `GATEWAY_APPROVAL_STATUS` varchar(255) DEFAULT NULL,
- `GATEWAY_ID` varchar(255) DEFAULT NULL,
- `GATEWAY_NAME` varchar(255) DEFAULT NULL,
- `GATEWAY_PUBLIC_ABSTRACT` varchar(255) DEFAULT NULL,
- `GATEWAY_URL` varchar(255) DEFAULT NULL,
- `IDENTITY_SERVER_PASSWORD_TOKEN` varchar(255) DEFAULT NULL,
- `IDENTITY_SERVER_USERNAME` varchar(255) DEFAULT NULL,
- `OAUTH_CLIENT_ID` varchar(255) DEFAULT NULL,
- `OAUTH_CLIENT_SECRET` varchar(255) DEFAULT NULL,
- `REQUEST_CREATION_TIME` bigint(20) DEFAULT NULL,
- `REQUESTER_USERNAME` varchar(255) DEFAULT NULL,
- `GATEWAY_REVIEW_PROPOSAL_DESCRIPTION` varchar(255) DEFAULT NULL,
- PRIMARY KEY (`CUSTOS_INTERNAL_GATEWAY_ID`)
+ `CUSTOS_INTERNAL_GATEWAY_ID` varchar(255) NOT NULL,
+ `DECLINED_REASON` varchar(255) DEFAULT NULL,
+ `GATEWAY_DOMAIN` varchar(255) DEFAULT NULL,
+ `EMAIL_ADDRESS` varchar(255) DEFAULT NULL,
+ `GATEWAY_ACRONYM` varchar(255) DEFAULT NULL,
+ `GATEWAY_ADMIN_EMAIL` varchar(255) DEFAULT NULL,
+ `GATEWAY_ADMIN_FIRST_NAME` varchar(255) DEFAULT NULL,
+ `GATEWAY_ADMIN_LAST_NAME` varchar(255) DEFAULT NULL,
+ `GATEWAY_APPROVAL_STATUS` varchar(255) DEFAULT NULL,
+ `GATEWAY_ID` varchar(255) DEFAULT NULL,
+ `GATEWAY_NAME` varchar(255) DEFAULT NULL,
+ `GATEWAY_PUBLIC_ABSTRACT` varchar(255) DEFAULT NULL,
+ `GATEWAY_URL` varchar(255) DEFAULT NULL,
+ `IDENTITY_SERVER_PASSWORD_TOKEN` varchar(255) DEFAULT NULL,
+ `IDENTITY_SERVER_USERNAME` varchar(255) DEFAULT NULL,
+ `OAUTH_CLIENT_ID` varchar(255) DEFAULT NULL,
+ `OAUTH_CLIENT_SECRET` varchar(255) DEFAULT NULL,
+ `REQUEST_CREATION_TIME` bigint(20) DEFAULT NULL,
+ `REQUESTER_USERNAME` varchar(255) DEFAULT NULL,
+ `GATEWAY_REVIEW_PROPOSAL_DESCRIPTION` varchar(255) DEFAULT NULL,
+ PRIMARY KEY (`CUSTOS_INTERNAL_GATEWAY_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -110,6 +110,7 @@ CREATE TABLE `GATEWAY` (
LOCK TABLES `GATEWAY` WRITE;
/*!40000 ALTER TABLE `GATEWAY` DISABLE KEYS */;
+INSERT INTO `GATEWAY` VALUES ('default',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'APPROVED','default','default',NULL,NULL,NULL,NULL,'pga','9790c8c4-7d9b-4ccc-a820-ca5aac38d2ad','2019-02-25 18:40:06',NULL, NULL);
/*!40000 ALTER TABLE `GATEWAY` ENABLE KEYS */;
UNLOCK TABLES;
diff --git a/ide-integration/src/main/resources/database_scripts/user-profile-catalog-derby.sql b/ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-derby.sql
similarity index 81%
rename from ide-integration/src/main/resources/database_scripts/user-profile-catalog-derby.sql
rename to ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-derby.sql
index 7600772..08566a2 100644
--- a/ide-integration/src/main/resources/database_scripts/user-profile-catalog-derby.sql
+++ b/ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-derby.sql
@@ -123,36 +123,6 @@ CREATE TABLE NSF_DEMOGRAPHIC_DISABILITY (
FOREIGN KEY (CUSTOS_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(CUSTOS_INTERNAL_USER_ID) ON DELETE CASCADE
);
-CREATE TABLE CUSTOMIZED_DASHBOARD (
- CUSTOS_INTERNAL_USER_ID VARCHAR (255) NOT NULL,
- ENABLED_EXPERIMENT_ID VARCHAR (255),
- ENABLED_NAME VARCHAR (255),
- ENABLED_DESCRIPTION VARCHAR (255),
- ENABLED_PROJECT VARCHAR (255),
- ENABLED_OWNER VARCHAR (255),
- ENABLED_APPLICATION VARCHAR (255),
- ENABLED_COMPUTE_RESOURCE VARCHAR (255),
- ENABLED_JOB_NAME VARCHAR (255),
- ENABLED_JOB_ID VARCHAR (255),
- ENABLED_JOB_STATUS VARCHAR (255),
- ENABLED_JOB_CREATION_TIME VARCHAR (255),
- ENABLED_NOTIFICATIONS_TO VARCHAR (255),
- ENABLED_WORKING_DIR VARCHAR (255),
- ENABLED_JOB_DESCRIPTION VARCHAR (255),
- ENABLED_CREATION_TIME VARCHAR (255),
- ENABLED_LAST_MODIFIED_TIME VARCHAR (255),
- ENABLED_WALL_TIME VARCHAR (255),
- ENABLED_CPU_COUNT VARCHAR (255),
- ENABLED_NODE_COUNT VARCHAR (255),
- ENABLED_QUEUE VARCHAR (255),
- ENABLED_INPUTS VARCHAR (255),
- ENABLED_OUTPUTS VARCHAR (255),
- ENABLED_STORAGE_DIR VARCHAR (255),
- ENABLED_ERRORS VARCHAR (255),
- PRIMARY KEY (CUSTOS_INTERNAL_USER_ID),
- FOREIGN KEY (CUSTOS_INTERNAL_USER_ID) REFERENCES USER_PROFILE(CUSTOS_INTERNAL_USER_ID) ON DELETE CASCADE
-);
-
CREATE TABLE CONFIGURATION
(
CONFIG_KEY VARCHAR(255) NOT NULL,
diff --git a/ide-integration/src/main/resources/database_scripts/user-profile-catalog-mysql.sql b/ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-mysql.sql
similarity index 82%
rename from ide-integration/src/main/resources/database_scripts/user-profile-catalog-mysql.sql
rename to ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-mysql.sql
index 6da1c93..4be0b66 100644
--- a/ide-integration/src/main/resources/database_scripts/user-profile-catalog-mysql.sql
+++ b/ide-integration/custos-services/src/main/resources/database_scripts/user-profile-catalog-mysql.sql
@@ -123,36 +123,6 @@ CREATE TABLE IF NOT EXISTS NSF_DEMOGRAPHIC_DISABILITY (
FOREIGN KEY (CUSTOS_INTERNAL_USER_ID) REFERENCES NSF_DEMOGRAPHIC(CUSTOS_INTERNAL_USER_ID) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-CREATE TABLE IF NOT EXISTS CUSTOMIZED_DASHBOARD (
- CUSTOS_INTERNAL_USER_ID VARCHAR (255) NOT NULL,
- ENABLED_EXPERIMENT_ID VARCHAR (255),
- ENABLED_NAME VARCHAR (255),
- ENABLED_DESCRIPTION VARCHAR (255),
- ENABLED_PROJECT VARCHAR (255),
- ENABLED_OWNER VARCHAR (255),
- ENABLED_APPLICATION VARCHAR (255),
- ENABLED_COMPUTE_RESOURCE VARCHAR (255),
- ENABLED_JOB_NAME VARCHAR (255),
- ENABLED_JOB_ID VARCHAR (255),
- ENABLED_JOB_STATUS VARCHAR (255),
- ENABLED_JOB_CREATION_TIME VARCHAR (255),
- ENABLED_NOTIFICATIONS_TO VARCHAR (255),
- ENABLED_WORKING_DIR VARCHAR (255),
- ENABLED_JOB_DESCRIPTION VARCHAR (255),
- ENABLED_CREATION_TIME VARCHAR (255),
- ENABLED_LAST_MODIFIED_TIME VARCHAR (255),
- ENABLED_WALL_TIME VARCHAR (255),
- ENABLED_CPU_COUNT VARCHAR (255),
- ENABLED_NODE_COUNT VARCHAR (255),
- ENABLED_QUEUE VARCHAR (255),
- ENABLED_INPUTS VARCHAR (255),
- ENABLED_OUTPUTS VARCHAR (255),
- ENABLED_STORAGE_DIR VARCHAR (255),
- ENABLED_ERRORS VARCHAR (255),
- PRIMARY KEY (CUSTOS_INTERNAL_USER_ID),
- FOREIGN KEY (CUSTOS_INTERNAL_USER_ID) REFERENCES USER_PROFILE(CUSTOS_INTERNAL_USER_ID) ON DELETE CASCADE
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-
CREATE TABLE CONFIGURATION
(
CONFIG_KEY VARCHAR(255) NOT NULL,
diff --git a/ide-integration/src/main/resources/docker-compose.yml b/ide-integration/custos-services/src/main/resources/docker-compose.yml
similarity index 100%
rename from ide-integration/src/main/resources/docker-compose.yml
rename to ide-integration/custos-services/src/main/resources/docker-compose.yml
diff --git a/ide-integration/src/main/resources/keycloak/Default-export.json b/ide-integration/custos-services/src/main/resources/keycloak/Default-export.json
similarity index 100%
rename from ide-integration/src/main/resources/keycloak/Default-export.json
rename to ide-integration/custos-services/src/main/resources/keycloak/Default-export.json
diff --git a/ide-integration/src/main/resources/keycloak/Default-export.json.bk b/ide-integration/custos-services/src/main/resources/keycloak/Default-export.json.bk
similarity index 100%
rename from ide-integration/src/main/resources/keycloak/Default-export.json.bk
rename to ide-integration/custos-services/src/main/resources/keycloak/Default-export.json.bk
diff --git a/ide-integration/src/main/resources/keycloak/standalone.xml b/ide-integration/custos-services/src/main/resources/keycloak/standalone.xml
similarity index 100%
rename from ide-integration/src/main/resources/keycloak/standalone.xml
rename to ide-integration/custos-services/src/main/resources/keycloak/standalone.xml
diff --git a/ide-integration/src/main/resources/keystores/airavata.jks b/ide-integration/custos-services/src/main/resources/keystores/airavata.jks
similarity index 100%
rename from ide-integration/src/main/resources/keystores/airavata.jks
rename to ide-integration/custos-services/src/main/resources/keystores/airavata.jks
diff --git a/ide-integration/src/main/resources/keystores/airavata_sym.jks b/ide-integration/custos-services/src/main/resources/keystores/airavata_sym.jks
similarity index 100%
rename from ide-integration/src/main/resources/keystores/airavata_sym.jks
rename to ide-integration/custos-services/src/main/resources/keystores/airavata_sym.jks
diff --git a/ide-integration/src/main/resources/keystores/client_truststore.jks b/ide-integration/custos-services/src/main/resources/keystores/client_truststore.jks
similarity index 100%
rename from ide-integration/src/main/resources/keystores/client_truststore.jks
rename to ide-integration/custos-services/src/main/resources/keystores/client_truststore.jks
diff --git a/ide-integration/pom.xml b/ide-integration/pom.xml
index ee1a01d..a91f3dc 100644
--- a/ide-integration/pom.xml
+++ b/ide-integration/pom.xml
@@ -10,6 +10,12 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>ide-integration</artifactId>
+ <packaging>pom</packaging>
+ <modules>
+ <module>custos-profile-service-samples</module>
+ <module>custos-authentication-service-samples</module>
+ <module>custos-services</module>
+ </modules>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
@@ -31,6 +37,18 @@
<artifactId>custos-authentication</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.custos</groupId>
+ <artifactId>custos-client</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.custos</groupId>
+ <artifactId>custos-client</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>