geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xiam...@apache.org
Subject svn commit: r979521 [3/3] - in /geronimo/server/trunk/testsuite/javaee6-testsuite: ./ servlet3.0-test/ servlet3.0-test/fragment1/ servlet3.0-test/fragment1/src/ servlet3.0-test/fragment1/src/main/ servlet3.0-test/fragment1/src/main/java/ servlet3.0-tes...
Date Tue, 27 Jul 2010 04:19:29 GMT
Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,149 @@
+/**
+ *  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.geronimo.testsuite.servlet3;
+
+import org.testng.annotations.Test;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+
+public class TestAnnotationsAndServletContextListener extends SeleniumTestSupport{
+
+	@Test
+	public void testNewServletAnnotationsNullClass() throws Exception {
+		//System.out.println("Start testing!");
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test Annotations and ServletContextListener.");
+		waitForPageLoad();
+
+		selenium.click("//input[@type='submit']");
+		waitForPageLoad();
+		assertEquals("Class Viewer Servlet", selenium.getTitle());
+		assertEquals("Message:", selenium
+				.getText("xpath=/html/body/font[1]/b"));
+		assertEquals(
+						"You have input nothing.We set it to the default class :java.lang.Integer.\nThe class
java.lang.Integer is valid.The detail information is:",
+						selenium.getText("xpath=/html/body/font[2]/b"));
+		assertTrue(selenium.isTextPresent("ClassName:"));
+		assertTrue(selenium.isTextPresent("java.lang.Integer"));
+		assertTrue(selenium.isTextPresent("Extends:"));
+		assertTrue(selenium.isTextPresent("class java.lang.Number"));
+		assertTrue(selenium.isTextPresent("Implements:"));
+		assertTrue(selenium.isTextPresent("interface java.lang.Comparable"));
+		assertTrue(selenium.isTextPresent("Methods:"));
+		assertTrue(selenium.isTextPresent("public static int java.lang.Integer.numberOfLeadingZeros(int)"));
+		assertTrue(selenium.isTextPresent("public static int java.lang.Integer.numberOfTrailingZeros(int)"));
+		assertTrue(selenium.isTextPresent("public static int java.lang.Integer.bitCount(int)"));
+		assertTrue(selenium.isTextPresent("public boolean java.lang.Integer.equals(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public static java.lang.String java.lang.Integer.toString(int,int)"));
+		assertTrue(selenium.isTextPresent("public static java.lang.String java.lang.Integer.toString(int)"));
+		assertTrue(selenium.isTextPresent("public java.lang.String java.lang.Integer.toString()"));
+		assertTrue(selenium.isTextPresent("public int java.lang.Integer.hashCode()"));
+		assertTrue(selenium.isTextPresent("public static int java.lang.Integer.reverseBytes(int)"));
+		assertTrue(selenium.isTextPresent("public int java.lang.Integer.compareTo(java.lang.Integer)"));
+		assertTrue(selenium.isTextPresent("public int java.lang.Integer.compareTo(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public static java.lang.String java.lang.Integer.toHexString(int)"));
+		assertTrue(selenium.isTextPresent("public static java.lang.Integer java.lang.Integer.decode(java.lang.String)
throws java.lang.NumberFormatException"));
+		assertTrue(selenium.isTextPresent("static void java.lang.Integer.getChars(int,int,char[])"));
+		assertTrue(selenium.isTextPresent("public static java.lang.Integer java.lang.Integer.valueOf(java.lang.String,int)
throws java.lang.NumberFormatException"));
+		assertTrue(selenium.isTextPresent("public static java.lang.Integer java.lang.Integer.valueOf(java.lang.String)
throws java.lang.NumberFormatException"));
+	}
+
+	@Test
+	public void testNewServletAnnotationsValidClass() throws Exception {
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test Annotations and ServletContextListener.");
+		waitForPageLoad();
+		selenium.type("class", "java.util.ArrayList");
+		selenium.click("//input[@type='submit']");
+		waitForPageLoad();
+		assertEquals("Class Viewer Servlet", selenium.getTitle());
+		assertEquals("Message:", selenium
+				.getText("xpath=/html/body/font[1]/b"));
+		assertEquals(
+						"The class java.util.ArrayList is valid.The detail information is:",
+						selenium.getText("xpath=/html/body/font[2]/b"));
+		assertEquals("ClassName:", selenium
+				.getText("xpath=/html/body/font[3]/b"));
+		assertTrue(selenium.isTextPresent("java.util.ArrayList"));
+		assertTrue(selenium.isTextPresent("Extends:"));
+		assertTrue(selenium.isTextPresent("class java.util.AbstractList"));
+		assertTrue(selenium.isTextPresent("Implements:"));
+		assertTrue(selenium.isTextPresent("interface java.util.List"));
+		assertTrue(selenium.isTextPresent("interface java.util.RandomAccess"));
+		assertTrue(selenium.isTextPresent("interface java.lang.Cloneable"));
+		assertTrue(selenium.isTextPresent("interface java.io.Serializable"));
+		assertTrue(selenium.isTextPresent("Methods:"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.add(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public void java.util.ArrayList.add(int,java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object java.util.ArrayList.get(int)"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object java.util.ArrayList.clone()"));
+		assertTrue(selenium.isTextPresent("public int java.util.ArrayList.indexOf(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public void java.util.ArrayList.clear()"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.contains(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.isEmpty()"));
+		assertTrue(selenium.isTextPresent("public int java.util.ArrayList.lastIndexOf(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.addAll(int,java.util.Collection)"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.addAll(java.util.Collection)"));
+		assertTrue(selenium.isTextPresent("public int java.util.ArrayList.size()"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object[] java.util.ArrayList.toArray(java.lang.Object[])"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object[] java.util.ArrayList.toArray()"));
+		assertTrue(selenium.isTextPresent("public boolean java.util.ArrayList.remove(java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object java.util.ArrayList.remove(int)"));
+		assertTrue(selenium.isTextPresent("private void java.util.ArrayList.writeObject(java.io.ObjectOutputStream)
throws java.io.IOException"));
+		assertTrue(selenium.isTextPresent("private void java.util.ArrayList.readObject(java.io.ObjectInputStream)
throws java.io.IOException,java.lang.ClassNotFoundException"));
+		assertTrue(selenium.isTextPresent("public java.lang.Object java.util.ArrayList.set(int,java.lang.Object)"));
+		assertTrue(selenium.isTextPresent("public void java.util.ArrayList.ensureCapacity(int)"));
+		assertTrue(selenium.isTextPresent("protected void java.util.ArrayList.removeRange(int,int)"));
+		assertTrue(selenium.isTextPresent("public void java.util.ArrayList.trimToSize()"));		
+	}
+
+	@Test
+	public void testNewServletAnnotationsInvalidClass() throws Exception {
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test Annotations and ServletContextListener.");
+		waitForPageLoad();
+		selenium.type("class", "Integer");
+		selenium.click("//input[@type='submit']");
+		waitForPageLoad();
+		assertEquals("Class Viewer Servlet", selenium.getTitle());
+		assertEquals("Message:", selenium
+				.getText("xpath=/html/body/font[1]/b"));
+		assertEquals(
+						"You have input an invalid class.So we set it to default class:java.lang.String",
+						selenium.getText("xpath=/html/body/font[2]/b"));
+		assertEquals("ClassName:", selenium
+				.getText("xpath=/html/body/font[3]/b"));
+		assertTrue(selenium.isTextPresent("java.lang.String"));
+		assertTrue(selenium.isTextPresent("Extends:"));
+		assertTrue(selenium.isTextPresent("class java.lang.Object"));
+		assertTrue(selenium.isTextPresent("Implements:"));
+		assertTrue(selenium.isTextPresent("interface java.io.Serializable interface java.lang.Comparable
interface java.lang.CharSequence"));
+		assertTrue(selenium.isTextPresent("Methods:"));
+		
+	}
+
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAnnotationsAndServletContextListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,56 @@
+/**
+ *  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.geronimo.testsuite.servlet3;
+
+import org.testng.annotations.Test;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+
+public class TestAsync extends SeleniumTestSupport {
+	
+		@Test
+	public void testAsyncServlet() throws Exception {
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test AsyncServlet.");
+		waitForPageLoad();
+		
+		assertTrue(selenium.isTextPresent("Servlet starts at:"));
+		assertTrue(selenium.isTextPresent("Task assigned to executor.Servlet ends at:"));
+		assertTrue(selenium.isTextPresent("TaskExecutor starts at:"));
+		assertTrue(selenium.isTextPresent("Task finishes."));
+		assertTrue(selenium.isTextPresent("TaskExecutor ends at:"));
+		
+
+        // servlet finish time
+		String set = selenium.getText("xpath=//p[2]").substring(60, 62);
+        // servlet task start time
+	    String tst = selenium.getText("xpath=//p[3]").substring(41, 43);
+        // servlet task finish time
+        String tet = selenium.getText("xpath=//p[5]").substring(39, 41);
+        int seti = Integer.parseInt(set);
+        int tsti = Integer.parseInt(tst);
+        int teti = Integer.parseInt(tet);        
+        assertTrue(seti==tsti);
+        assertTrue(seti==teti - 10);       
+	}
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestAsync.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,35 @@
+/**
+ *  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.geronimo.testsuite.servlet3;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+import org.testng.annotations.Test;
+
+public class TestInitializer extends SeleniumTestSupport {
+	@Test
+	public void testServletContainerInitializerClass() throws Exception {
+        String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test Add Servlet Mapping through ServletContainerInitializer.");
+		waitForPageLoad();
+		assertTrue(selenium.isTextPresent("Add this servlet correctly through ServletContainerInitializer."));
+	}
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestInitializer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,39 @@
+/**
+ *  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.geronimo.testsuite.servlet3;
+
+import org.testng.annotations.Test;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+
+public class TestJarresource extends SeleniumTestSupport{
+
+	@Test
+	public void testJarResources() throws Exception {
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		
+		selenium.click("link=Test Access Jar Resource.");
+		waitForPageLoad();
+		assertTrue(selenium.isTextPresent("This is a JSP executed inside a jar file of the web
module. "));
+		assertTrue(selenium.isTextPresent("The remote host is 127.0.0.1."));
+	}
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestJarresource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,106 @@
+/**
+ *  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.geronimo.testsuite.servlet3;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.testng.annotations.Test;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+
+/**
+ * Test MultiPart through File upload.
+ */
+public class TestMultiPart extends SeleniumTestSupport {
+
+    @Test
+    public void testUploadSuccess() throws Exception {
+        copyFile("small.txt");
+        String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+        selenium.selectFrame("sampleDocumentFrame");
+        selenium.click("link=Test File Upload.");
+        waitForPageLoad();
+        // TODO: Figure out how to upload a file
+        selenium.type("testFile", "c:\\test_file\\small.txt");
+        selenium.click("//input[@value='Submit The File!']");
+        waitForPageLoad();
+        assertEquals("File Upload System", selenium.getTitle());
+        assertEquals("A listener is dectecting online person number.", selenium.getText("xpath=/html/body/h2[1]"));
+        // assertEquals("Currently,there are 1 people visiting this file upload system!",
+        // selenium.getText("xpath=/html/body/h3"));
+    }
+
+    @Test
+    public void testNoFileInput() throws Exception {
+        String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+        selenium.selectFrame("sampleDocumentFrame");
+        selenium.click("link=Test File Upload.");
+        waitForPageLoad();
+        selenium.click("//input[@value='Submit The File!']");
+        waitForPageLoad();
+        assertEquals("File Upload System", selenium.getTitle());
+        assertEquals("A listener is dectecting online person number.", selenium.getText("xpath=/html/body/h2[1]"));
+    }
+
+    @Test
+    public void testFileTooLarge() throws Exception {
+        String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+        selenium.selectFrame("sampleDocumentFrame");
+        selenium.click("fileupload");
+        waitForPageLoad();
+        // TODO: Figure out how to upload a file
+        selenium.type("testFile", "D:\\allServers\\apache-james-2.3.2.zip");
+        selenium.click("//input[@value='Submit The File!']");
+        waitForPageLoad();
+        //assertTrue(selenium.isTextPresent("The file size is 7996381b, it's filterd because
the file size is limited to 10 kb"));
+    }
+
+    private void copyFile(String fileName) {
+        File file = new File(fileName);
+        FileInputStream fis;
+        FileOutputStream fos;
+        try {
+            fis = new FileInputStream(file);
+/*            byte[] buffer = new byte[(int) file.length()];
+            fis.read(buffer);
+            File localFile = new File("c:\\test_file\\" + fileName);
+            localFile.mkdirs();
+            fos = new FileOutputStream(localFile);
+            fos.write(buffer);*/
+
+        } catch (FileNotFoundException e) {
+            System.out.println("File not found.");
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            
+        }
+
+        File filel = new File("c://test_file//" + fileName);
+        System.out.println(filel.getName());
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestMultiPart.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
Tue Jul 27 04:19:27 2010
@@ -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.geronimo.testsuite.servlet3;
+
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+import org.testng.annotations.Test;
+
+public class TestWebFragment extends SeleniumTestSupport {
+	@Test
+	public void testWebFragmentSuccess() throws Exception {
+		String appContextStr = System.getProperty("appContext");
+		selenium.open(appContextStr);
+		selenium.selectFrame("sampleDocumentFrame");
+		selenium.click("link=Test WebFragment.");
+		waitForPageLoad();
+		selenium.click("QueryAll");
+		selenium.waitForPageToLoad("30000");
+		selenium.type("ID", "1");
+		selenium.type("quantity", "6");
+		selenium.click("addToCart");
+		waitForPageLoad();
+		selenium.click("link=>>Continue shopping!");
+		waitForPageLoad();
+		selenium.type("ID", "6");
+		selenium.type("quantity", "1");
+		selenium.click("addToCart");
+		waitForPageLoad();
+		selenium.click("link=>>Go to pay!");
+		waitForPageLoad();
+		assertEquals("Servlet Payment", selenium.getTitle());
+		assertEquals("Dear Customer,\nYou have to pay 120.", selenium
+				.getText("xpath=/html/body/h1[1]"));
+		assertEquals(
+						"Congratulations!You have successfully finished the payment process.",
+						selenium.getText("xpath=/html/body/h1[2]"));
+		assertTrue(selenium
+				.isElementPresent("link=See message generated from different fragments."));
+
+		 selenium.click("link=See message generated from different fragments.");
+		 waitForPageLoad();
+		 assertEquals("Servlet WebFragmentMessageRecord", selenium.getTitle());
+		 assertTrue(selenium
+	                .isTextPresent("The absolute-ordering of fragments in web.xml is: fragment3,fragment2,fragment1,filter
chain responses in this order."));
+		 assertTrue(selenium.isTextPresent("FilterMessage is: "));
+		 assertTrue(selenium.isTextPresent("This Message is from fragment3 filter.This fragment
mainly serves to pay for the items you bought."));
+		 assertTrue(selenium.isTextPresent("This Message is from fragment2 filter.This fragment
mainly serves to add items to shopping cart."));
+		 assertTrue(selenium.isTextPresent("This Message is from fragment1 filter.This fragment
mainly serves to query all the items."));
+		 assertTrue(selenium.isTextPresent("The Listener Message is: "));
+		 assertTrue(selenium.isTextPresent("This Message is from fragment3 listener.This fragment
mainly serves to pay for the items you bought."));
+	}
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/java/org/apache/geronimo/testsuite/servlet3/TestWebFragment.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml?rev=979521&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
(added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
Tue Jul 27 04:19:27 2010
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+
+<suite name="Suite1" verbose="1">
+	<test name="javaee6-testsuite-3.0-servlet">
+		<packages>
+			<package name="org.apache.geronimo.testsuite.servlet3" />
+		</packages>
+		<classes>
+			<class name="org.apache.geronimo.testsuite.servlet3.TestMultiPart">
+				<methods>
+					<exclude name="fileTooLarge"></exclude>
+					<exclude name="uploadSuccess"></exclude>
+				</methods>
+			</class>
+		</classes>
+	</test>
+</suite>
+

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message