Added:
/trunk/jjson-struts2/src/test/java/de
/trunk/jjson-struts2/src/test/java/de/grobmeier
/trunk/jjson-struts2/src/test/java/de/grobmeier/json
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/JsonResultTest.java
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/TestAction.java
/trunk/jjson-struts2/src/test/resources
/trunk/jjson-struts2/src/test/resources/struts.xml
=======================================
--- /dev/null
+++
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/JsonResultTest.java
Tue Jul 5 02:16:54 2011
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2011 Christian Grobmeier
+ *
+ * Licensed 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 de.grobmeier.json.plugins.struts2;
+
+import junit.framework.Assert;
+
+import org.apache.struts2.StrutsTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JsonResultTest extends StrutsTestCase {
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void testSomething() throws Exception {
+ String executeAction = this.executeAction("/test");
+ Assert.assertEquals("{\"test\":\"mytest\"}", executeAction);
+ }
+}
=======================================
--- /dev/null
+++
/trunk/jjson-struts2/src/test/java/de/grobmeier/json/plugins/struts2/TestAction.java
Tue Jul 5 02:16:54 2011
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2011 Christian Grobmeier
+ *
+ * Licensed 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 de.grobmeier.json.plugins.struts2;
+
+import com.opensymphony.xwork2.ActionSupport;
+
+import de.grobmeier.jjson.convert.JSON;
+
+@JSON
+public class TestAction extends ActionSupport {
+ /** Serial */
+ private static final long serialVersionUID = 4333762297932307290L;
+
+ @JSON
+ private String test = "mytest";
+
+ public String execute(){
+ return SUCCESS;
+ }
+
+ public String getTest() {
+ return test;
+ }
+ public void setTest(String test) {
+ this.test = test;
+ }
+
+
+}
=======================================
--- /dev/null
+++ /trunk/jjson-struts2/src/test/resources/struts.xml Tue Jul 5 02:16:54
2011
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2011 Christian Grobmeier
+ *
+ * Licensed 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.
+ */
+ -->
+<!DOCTYPE struts PUBLIC
+ "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
+ "http://struts.apache.org/dtds/struts-2.0.dtd">
+
+<struts>
+ <package name="jjson" extends="struts-default">
+ <result-types>
+ <result-type name="json"
class="de.grobmeier.json.plugins.struts2.JsonResult"/>
+ </result-types>
+
+ <action name="test" class="de.grobmeier.json.plugins.struts2.TestAction">
+ <result type="json" />
+ </action>
+ </package>
+</struts>