You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2018/06/07 17:04:22 UTC

[airavata] branch group-based-auth updated: AIRAVATA-2797 Fixing UserResourceProfileTest

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch group-based-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/group-based-auth by this push:
     new ba0fb1a  AIRAVATA-2797 Fixing UserResourceProfileTest
ba0fb1a is described below

commit ba0fb1adfd63b4a0183217171d5488dc274bd53e
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jun 7 13:03:52 2018 -0400

    AIRAVATA-2797 Fixing UserResourceProfileTest
---
 .../core/app/catalog/resources/UserResourceProfileResource.java    | 2 +-
 .../org/apache/airavata/app/catalog/UserResourceProfileTest.java   | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserResourceProfileResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserResourceProfileResource.java
index 8309ae0..6d63d8b 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserResourceProfileResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserResourceProfileResource.java
@@ -439,7 +439,7 @@ public class UserResourceProfileResource extends AppCatAbstractResource {
                 }
                 em.close();
             }
-            return results != null;
+            return results != null && results.size() == 1;
         } catch (ApplicationSettingsException e) {
             logger.error(e.getMessage(), e);
             throw new AppCatalogException(e);
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/UserResourceProfileTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/UserResourceProfileTest.java
index bfbb628..0f9fc62 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/UserResourceProfileTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/app/catalog/UserResourceProfileTest.java
@@ -107,10 +107,8 @@ public class UserResourceProfileTest {
 
         // Check if UserResourceProfile exists (should not exist)
         // This tests the mechanism that PGA will use to figure out if a user doesn't already have a UserResourceProfile
-        UserResourceProfile checkUserResourceProfile = userProfile.getUserResourceProfile(uf.getUserId(), uf.getGatewayID());
-        assertNotNull(checkUserResourceProfile.getUserId());
-        assertNotNull(checkUserResourceProfile.getGatewayID());
-        assertTrue(checkUserResourceProfile.isIsNull());
+        boolean exists = userProfile.isUserResourceProfileExists(uf.getUserId(), uf.getGatewayID());
+        assertFalse(exists);
 
         String gwId = userProfile.addUserResourceProfile(uf);
         UserResourceProfile retrievedProfile = null;
@@ -150,7 +148,6 @@ public class UserResourceProfileTest {
         //retrievedProfile = userProfile.getUserResourceProfile("hello",uf.getGatewayID());
         if (userProfile.isUserResourceProfileExists(uf.getUserId(),uf.getGatewayID())){
             retrievedProfile = userProfile.getUserResourceProfile(uf.getUserId(),uf.getGatewayID());
-            assertFalse(retrievedProfile.isIsNull());
             System.out.println("gateway ID :" + retrievedProfile.getGatewayID());
             System.out.println("user ID : " + retrievedProfile.getUserId());
             System.out.println("compute resource size : " + retrievedProfile.getUserComputeResourcePreferencesSize());

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.