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 2011/10/20 23:59:54 UTC

svn commit: r1187079 - in /incubator/airavata/trunk/modules/commons/workflow-execution-context/src: main/java/org/apaceh/airavata/common/workflow/execution/context/ test/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/airavata/ te...

Author: lahiru
Date: Thu Oct 20 21:59:53 2011
New Revision: 1187079

URL: http://svn.apache.org/viewvc?rev=1187079&view=rev
Log:
minor changes.

Added:
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/result.xml
Modified:
    incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apaceh/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java

Modified: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apaceh/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apaceh/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java?rev=1187079&r1=1187078&r2=1187079&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apaceh/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java (original)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/main/java/org/apaceh/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilder.java Thu Oct 20 21:59:53 2011
@@ -122,13 +122,15 @@ public class WorkflowContextHeaderBuilde
     }
 
     public XmlElement getXml() {
+        ContextHeaderDocument document = ContextHeaderDocument.Factory.newInstance();
         this.contextHeader.setWorkflowMonitoringContext(this.workflowMonitoringContext);
         this.contextHeader.setSoaServiceEprs(this.soaServiceEprs);
         this.contextHeader.setSecurityContext(this.securityContext);
         this.contextHeader.setWorkflowSchedulingContext(this.workflowSchedulingContext);
         this.contextHeader.setUserIdentifier(this.userIdentifier);
         this.contextHeader.setWorkflowOutputDataHandling(this.workflowOutputDataHandling);
-        return XMLUtil.stringToXmlElement3(this.contextHeader.toString());
+        document.setContextHeader(this.contextHeader);
+        return XMLUtil.stringToXmlElement3(document.xmlText());
     }
 
     public WorkflowContextHeaderBuilder setResourceSchedularUrl(String resourceSchedular) {

Added: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java?rev=1187079&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java (added)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/java/org/apache/airavata/common/workflow/execution/context/WorkflowContextHeaderBuilderTest.java Thu Oct 20 21:59:53 2011
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.common.workflow.execution.context;
+
+import com.sun.xml.internal.ws.util.xml.XmlUtil;
+import org.apaceh.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
+import org.apache.airavata.common.utils.XMLUtil;
+import org.apache.woden.wsdl20.validation.Assertion;
+import org.junit.Test;
+import sun.jvm.hotspot.utilities.Assert;
+
+import javax.xml.bind.annotation.XmlElement;
+import java.io.File;
+
+public class WorkflowContextHeaderBuilderTest {
+     @Test
+	public void testExecute() {
+         WorkflowContextHeaderBuilder builder  = new WorkflowContextHeaderBuilder("brokerurl","gfacurl","registryurl","experimentid","workflowid");
+
+         try {
+             File testFile = new File(this.getClass().getClassLoader().getResource("result.xml").getPath());
+             System.out.println(XMLUtil.xmlElementToString(XMLUtil.xmlElement3ToXmlElement5(builder.getXml())));
+             System.out.println(XMLUtil.xmlElementToString(XMLUtil.loadXML(testFile)));
+             org.junit.Assert.assertTrue(XMLUtil.isEqual(XMLUtil.loadXML(testFile), XMLUtil.xmlElement3ToXmlElement5(builder.getXml())));
+         } catch (Exception e) {
+             e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+         }
+     }
+
+}

Added: incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/result.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/result.xml?rev=1187079&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/result.xml (added)
+++ incubator/airavata/trunk/modules/commons/workflow-execution-context/src/test/resources/result.xml Thu Oct 20 21:59:53 2011
@@ -0,0 +1,24 @@
+<wor:context-header
+      xmlns:wor="http://schemas.airavata.apache.org/workflow-execution-context">
+    <wor:user-identifier xsi:nil="true"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xmlns:wor="http://schemas.airavata.apache.org/workflow-execution-context" />
+    <wor:soa-service-eprs>
+        <wor:gfac-url>gfacurl</wor:gfac-url>
+        <wor:registry-url>registryurl</wor:registry-url>
+    </wor:soa-service-eprs>
+    <wor:workflow-monitoring-context>
+        <wor:experiment-id>experimentid</wor:experiment-id>
+        <wor:workflow-instance-id>workflowid</wor:workflow-instance-id>
+        <wor:event-publish-epr>brokerurl</wor:event-publish-epr>
+    </wor:workflow-monitoring-context>
+    <wor:workflow-scheduling-context xsi:nil="true"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xmlns:wor="http://schemas.airavata.apache.org/workflow-execution-context" />
+    <wor:workflow-output-data-handling xsi:nil="true"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xmlns:wor="http://schemas.airavata.apache.org/workflow-execution-context" />
+    <wor:security-context xsi:nil="true"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xmlns:wor="http://schemas.airavata.apache.org/workflow-execution-context" />
+</wor:context-header>
\ No newline at end of file