You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2016/08/26 15:43:36 UTC

[41/50] [abbrv] airavata git commit: Fixed qos issue

Fixed qos issue


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

Branch: refs/heads/lahiru/AIRAVATA-2057
Commit: 1dab79b6452280929412599eca3281c0f9fab28c
Parents: ef310d3
Author: Shameera Rathnayaka <sh...@gmail.com>
Authored: Wed Aug 24 12:39:04 2016 -0400
Committer: Shameera Rathnayaka <sh...@gmail.com>
Committed: Wed Aug 24 12:39:04 2016 -0400

----------------------------------------------------------------------
 modules/gfac/gfac-core/pom.xml                  | 12 +++---
 .../apache/airavata/gfac/core/GFacUtils.java    |  4 +-
 .../airavata/gfac/core/GFacUtilsTest.java       | 43 ++++++++++++++++++++
 3 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/1dab79b6/modules/gfac/gfac-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/pom.xml b/modules/gfac/gfac-core/pom.xml
index 69253d2..8d358ff 100644
--- a/modules/gfac/gfac-core/pom.xml
+++ b/modules/gfac/gfac-core/pom.xml
@@ -82,12 +82,12 @@
             <artifactId>junit</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>6.1.1</version>
-            <scope>test</scope>
-        </dependency>
+        <!--<dependency>-->
+            <!--<groupId>org.testng</groupId>-->
+            <!--<artifactId>testng</artifactId>-->
+            <!--<version>6.1.1</version>-->
+            <!--<scope>test</scope>-->
+        <!--</dependency>-->
         <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>jcl-over-slf4j</artifactId>

http://git-wip-us.apache.org/repos/asf/airavata/blob/1dab79b6/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
index f7d53dc..0ed836f 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/GFacUtils.java
@@ -659,13 +659,13 @@ public class GFacUtils {
         return inputValues;
     }
 
-    private static String getQoS(String qualityOfService, String preferredBatchQueue) {
+    static String getQoS(String qualityOfService, String preferredBatchQueue) {
         if(preferredBatchQueue == null  || preferredBatchQueue.isEmpty()
                 ||  qualityOfService == null  || qualityOfService.isEmpty()) return null;
         final String qos = "qos";
         Pattern pattern = Pattern.compile(preferredBatchQueue + "=(?<" + qos + ">[^,]*)");
         Matcher matcher = pattern.matcher(qualityOfService);
-        if (matcher.matches()) {
+        if (matcher.find()) {
             return matcher.group(qos);
         }
         return null;

http://git-wip-us.apache.org/repos/asf/airavata/blob/1dab79b6/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/core/GFacUtilsTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/core/GFacUtilsTest.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/core/GFacUtilsTest.java
new file mode 100644
index 0000000..ecea66f
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/gfac/core/GFacUtilsTest.java
@@ -0,0 +1,43 @@
+/**
+ *
+ * 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.gfac.core;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class GFacUtilsTest {
+
+    @Test
+    public void testGetQoS_1() throws Exception {
+        String qos = "shared=oneweek";
+        String shared = GFacUtils.getQoS(qos, "shared");
+        Assert.assertNotNull(shared);
+        Assert.assertEquals("oneweek", shared);
+    }
+    @Test
+    public void testGetQoS_2() throws Exception {
+        String qos = "shared=oneweek,compute=oneweek";
+        String shared = GFacUtils.getQoS(qos, "shared");
+        Assert.assertNotNull(shared);
+        Assert.assertEquals("oneweek", shared);
+    }
+
+
+}
\ No newline at end of file