flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gordonsm...@apache.org
Subject svn commit: r1407702 - /incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/
Date Sat, 10 Nov 2012 00:18:13 GMT
Author: gordonsmith
Date: Sat Nov 10 00:18:12 2012
New Revision: 1407702

URL: http://svn.apache.org/viewvc?rev=1407702&view=rev
Log:
Falcon: Added tests for parsing <RemoteObject> / <method>, <HTTPService>
/ <request>, and <WebService> / <operation> tags.

Added:
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java
  (with props)
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
  (with props)
Modified:
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNodeTests.java
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
    incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java?rev=1407702&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java
Sat Nov 10 00:18:12 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.flex.compiler.internal.tree.mxml;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLHTTPServiceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLHTTPServiceRequestPropertyNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLHTTPServiceNode} and {@link MXMLHTTPServiceRequestPropertyNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLHTTPServiceNodeTests extends MXMLInstanceNodeTests
+{
+	private static String EOL = "\n\t\t";
+	
+	private IMXMLHTTPServiceNode getMXMLHTTPServiceNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLHTTPServiceNode node = (IMXMLHTTPServiceNode)findFirstDescendantOfType(fileNode, IMXMLHTTPServiceNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLHTTPServiceID));
+		assertThat("getName", node.getName(), is("mx.rpc.http.mxml.HTTPService"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLHTTPServiceNode_postRequest()
+	{
+		String code =
+		    "<mx:HTTPService id='userRequest' url='http://whatever' method='POST'>" + EOL
+
+		    "    <mx:request xmlns=''>" + EOL +
+		    "        <username>{username.text}</username>" + EOL +
+            "        <emailaddress>{emailaddress.text}</emailaddress>" + EOL
+
+		    "    </mx:request>" + EOL +
+		    "</mx:HTTPService>";
+		IMXMLHTTPServiceNode node = getMXMLHTTPServiceNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(3));
+		IMXMLPropertySpecifierNode urlNode = (IMXMLPropertySpecifierNode)node.getChild(0);
+		assertThat("", urlNode.getName(), is("url"));
+		IMXMLPropertySpecifierNode methodNode = (IMXMLPropertySpecifierNode)node.getChild(1);
+		assertThat("", methodNode.getName(), is("method"));
+		IMXMLHTTPServiceRequestPropertyNode requestNode = (MXMLHTTPServiceRequestPropertyNode)node.getChild(2);
+		assertThat("", requestNode.getName(), is("request"));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLHTTPServiceNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNodeTests.java?rev=1407702&r1=1407701&r2=1407702&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNodeTests.java
(original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLInstanceNodeTests.java
Sat Nov 10 00:18:12 2012
@@ -30,7 +30,7 @@ public class MXMLInstanceNodeTests exten
 {
 	protected String getPrefix()
 	{
-		return "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:d='flash.display.*'>\n"
+
+		return "<d:Sprite xmlns:fx='http://ns.adobe.com/mxml/2009' xmlns:d='flash.display.*'
xmlns:s='library://ns.adobe.com/flex/spark' xmlns:mx='library://ns.adobe.com/flex/mx'>\n"
+
 	           "    <fx:Declarations>\n" +
 		       "        ";
 	}

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java?rev=1407702&r1=1407701&r2=1407702&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
(original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLNodeBaseTests.java
Sat Nov 10 00:18:12 2012
@@ -99,6 +99,7 @@ public class MXMLNodeBaseTests
 		List<File> libraries = new ArrayList<File>();
 		libraries.add(new File(SDK + "\\frameworks\\libs\\player\\11.1\\playerglobal.swc"));
 		libraries.add(new File(SDK + "\\frameworks\\libs\\framework.swc"));
+		libraries.add(new File(SDK + "\\frameworks\\libs\\rpc.swc"));
 		libraries.add(new File(SDK + "\\frameworks\\libs\\spark.swc"));
 		project.setLibraries(libraries);
 		

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java?rev=1407702&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java
Sat Nov 10 00:18:12 2012
@@ -0,0 +1,70 @@
+/*
+ *
+ *  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.flex.compiler.internal.tree.mxml;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLRemoteObjectMethodNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLRemoteObjectNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLRemoteObjectNode} and {@link MXMLRemoteObjectMethodNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLRemoteObjectNodeTests extends MXMLInstanceNodeTests
+{
+	private static String EOL = "\n\t\t";
+	
+	private IMXMLRemoteObjectNode getMXMLRemoteObjectNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLRemoteObjectNode node = (IMXMLRemoteObjectNode)findFirstDescendantOfType(fileNode,
IMXMLRemoteObjectNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLRemoteObjectID));
+		assertThat("getName", node.getName(), is("mx.rpc.remoting.mxml.RemoteObject"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLRemoteObjectNode_postRequest()
+	{
+		String code =
+		    "<mx:RemoteObject id='userRequest' destination='Whatever'>" + EOL +
+		    "    <mx:method name='GetQuote'>" + EOL +
+		    "        <mx:arguments>" + EOL +
+		    "            <symbol>{stockSymbol.text}</symbol>" + EOL +
+		    "        </mx:arguments>" + EOL +
+		    "    </mx:method>" + EOL +
+		    "</mx:RemoteObject>";
+		IMXMLRemoteObjectNode node = getMXMLRemoteObjectNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(2));
+		IMXMLPropertySpecifierNode destinationNode = (IMXMLPropertySpecifierNode)node.getChild(0);
+		assertThat("", destinationNode.getName(), is("destination"));
+		IMXMLRemoteObjectMethodNode methodNode = (IMXMLRemoteObjectMethodNode)node.getChild(1);
+		assertThat("", methodNode.getName(), is("mx.rpc.remoting.mxml.Operation"));
+		assertThat("", methodNode.getMethodName(), is("GetQuote"));
+	}
+
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLRemoteObjectNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java?rev=1407702&r1=1407701&r2=1407702&view=diff
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
(original)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLStringNodeTests.java
Sat Nov 10 00:18:12 2012
@@ -49,7 +49,7 @@ public class MXMLStringNodeTests extends
 	{
 		String code = "<fx:String/>";
 		IMXMLStringNode node = getMXMLStringNode(code);
-		assertThat("getValue", node.getValue(), is((String)"")); // was null in old compiler, but
this is inconsistent with an empty String attribute
+		assertThat("getValue", node.getValue(), is("")); // was null in old compiler, but this
is inconsistent with an empty String attribute
 		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 	
@@ -58,7 +58,7 @@ public class MXMLStringNodeTests extends
 	{
 		String code = "<fx:String></fx:String>";
 		IMXMLStringNode node = getMXMLStringNode(code);
-		assertThat("getValue", node.getValue(), is((String)""));
+		assertThat("getValue", node.getValue(), is(""));
 		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 
@@ -67,7 +67,7 @@ public class MXMLStringNodeTests extends
 	{
 		String code = "<fx:String> \t\r\n</fx:String>";
 		IMXMLStringNode node = getMXMLStringNode(code);
-		assertThat("getValue", node.getValue(), is((String)""));
+		assertThat("getValue", node.getValue(), is(""));
 		//assertThat("getExpressionNode", node.getExpressionNode(), is((IASNode)null));
 	}
 	

Added: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
URL: http://svn.apache.org/viewvc/incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java?rev=1407702&view=auto
==============================================================================
--- incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
(added)
+++ incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
Sat Nov 10 00:18:12 2012
@@ -0,0 +1,69 @@
+/*
+ *
+ *  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.flex.compiler.internal.tree.mxml;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.flex.compiler.tree.ASTNodeID;
+import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLPropertySpecifierNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLWebServiceNode;
+import org.apache.flex.compiler.tree.mxml.IMXMLWebServiceOperationNode;
+import org.junit.Test;
+
+/**
+ * JUnit tests for {@link MXMLWebServiceNode} and {@link MXMLWebServiceOperationNode}.
+ * 
+ * @author Gordon Smith
+ */
+public class MXMLWebServiceNodeTests extends MXMLInstanceNodeTests
+{
+	private static String EOL = "\n\t\t";
+	
+	private IMXMLWebServiceNode getMXMLWebServiceNode(String code)
+	{
+		IMXMLFileNode fileNode = getMXMLFileNode(code);
+		IMXMLWebServiceNode node = (IMXMLWebServiceNode)findFirstDescendantOfType(fileNode, IMXMLWebServiceNode.class);
+		assertThat("getNodeID", node.getNodeID(), is(ASTNodeID.MXMLWebServiceID));
+		assertThat("getName", node.getName(), is("mx.rpc.soap.mxml.WebService"));
+		return node;
+	}
+	
+	@Test
+	public void MXMLWebServiceNode_twoOperations()
+	{
+		String code =
+		    "<mx:WebService id='ws' wsdl='http://whatever'>" + EOL +
+		    "    <mx:operation name='op1'/>" + EOL +
+		    "    <mx:operation name='op2'/>" + EOL +
+		    "</mx:WebService>";
+		IMXMLWebServiceNode node = getMXMLWebServiceNode(code);
+		assertThat("getChildCount", node.getChildCount(), is(3));
+		IMXMLPropertySpecifierNode wsdlNode = (IMXMLPropertySpecifierNode)node.getChild(0);
+		assertThat("", wsdlNode.getName(), is("wsdl"));
+		IMXMLWebServiceOperationNode op1Node = (IMXMLWebServiceOperationNode)node.getChild(1);
+		assertThat("", op1Node.getName(), is("mx.rpc.soap.mxml.Operation"));
+		assertThat("", op1Node.getOperationName(), is("op1"));
+		IMXMLWebServiceOperationNode op2Node = (IMXMLWebServiceOperationNode)node.getChild(2);
+		assertThat("", op2Node.getName(), is("mx.rpc.soap.mxml.Operation"));
+		assertThat("", op2Node.getOperationName(), is("op2"));
+	}
+}

Propchange: incubator/flex/falcon/trunk/compiler.tests/unit-tests/org/apache/flex/compiler/internal/tree/mxml/MXMLWebServiceNodeTests.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message