WW-4522 Support latest stable AngularJS version in maven angularjs archetype
- Rename HelloAction to ApplicationAction Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8312ed14 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8312ed14 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8312ed14 Branch: refs/heads/master Commit: 8312ed14ba4ca8fe4035a423f0b1379c11469269 Parents: 7928d34 Author: Johannes Geppert <[email protected]> Authored: Fri Jul 10 16:32:23 2015 +0200 Committer: Johannes Geppert <[email protected]> Committed: Fri Jul 10 16:32:23 2015 +0200 ---------------------------------------------------------------------- .../main/java/actions/ApplicationAction.java | 64 ++++++++++++++++++++ .../src/main/java/actions/HelloAction.java | 64 -------------------- .../src/main/java/actions/Index.java | 4 +- .../main/webapp/WEB-INF/content/application.jsp | 31 ++++++++++ .../src/main/webapp/WEB-INF/content/hello.jsp | 31 ---------- .../src/main/webapp/index.jsp | 2 +- .../java/actions/ApplicationActionTest.java | 34 +++++++++++ .../src/test/java/actions/HelloActionTest.java | 36 ----------- 8 files changed, 132 insertions(+), 134 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java new file mode 100644 index 0000000..4ed1ab9 --- /dev/null +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/ApplicationAction.java @@ -0,0 +1,64 @@ +/* + * $Id$ + * + * 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 ${package}.actions; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * <code>Set welcome message.</code> + */ +public class ApplicationAction extends ActionSupport { + + private static final long serialVersionUID = -3243216917801206214L; + + public String execute() throws Exception { + setMessage(getText(MESSAGE)); + return SUCCESS; + } + + /** + * Provide default valuie for Message property. + */ + public static final String MESSAGE = "hello.message"; + + /** + * Field for Message property. + */ + private String message; + + /** + * Return Message property. + * + * @return Message property + */ + public String getMessage() { + return message; + } + + /** + * Set Message property. + * + * @param message Text to display on HelloWorld page. + */ + public void setMessage(String message) { + this.message = message; + } +} http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/HelloAction.java ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/HelloAction.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/HelloAction.java deleted file mode 100644 index d448141..0000000 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/HelloAction.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * $Id$ - * - * 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 ${package}.actions; - -import com.opensymphony.xwork2.ActionSupport; - -/** - * <code>Set welcome message.</code> - */ -public class HelloAction extends ActionSupport { - - private static final long serialVersionUID = -3243216917801206214L; - - public String execute() throws Exception { - setMessage(getText(MESSAGE)); - return SUCCESS; - } - - /** - * Provide default valuie for Message property. - */ - public static final String MESSAGE = "hello.message"; - - /** - * Field for Message property. - */ - private String message; - - /** - * Return Message property. - * - * @return Message property - */ - public String getMessage() { - return message; - } - - /** - * Set Message property. - * - * @param message Text to display on HelloWorld page. - */ - public void setMessage(String message) { - this.message = message; - } -} http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/Index.java ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/Index.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/Index.java index c865dd8..5643b4a 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/Index.java +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/java/actions/Index.java @@ -26,7 +26,7 @@ import org.apache.struts2.convention.annotation.Result; import org.apache.struts2.convention.annotation.Results; @Results({ - @Result(name = Action.SUCCESS, location = "${redirectName}", type = "redirectAction") + @Result(name = Action.SUCCESS, location = "${redirectName}", type = "redirectAction") }) public class Index extends ActionSupport { @@ -35,7 +35,7 @@ public class Index extends ActionSupport { private String redirectName; public String execute() { - redirectName = "hello"; + redirectName = "application"; return Action.SUCCESS; } http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp new file mode 100644 index 0000000..d66b06a --- /dev/null +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/application.jsp @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<%@ page contentType="text/html; charset=UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<html lang="en" ng-app="angularStrutsApp"> +<head> + <meta charset="utf-8"> + <title>My AngularJS Struts2 App</title> + + <s:url var="ctxUrl" forceAddSchemeHostAndPort="true" includeContext="true" value="/" namespace="/" ></s:url> + <base href="<s:property value="ctxUrl"/>"> +</head> +<body> + +<h2><s:property value="message"/></h2> + +<div> + <a href="/home">Home</a> - <a href="/projects">Projects</a> +</div> + +<div ng-controller="AppController"> + <div ng-view></div> +</div> + +<script src="<s:url value="js/lib/angular/angular.min.js" />"></script> +<script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script> +<script src="<s:url value="js/bootstrap.js" />"></script> +<script src="<s:url value="js/directives.js" />"></script> +<script src="<s:url value="js/services.js" />"></script> +<script src="<s:url value="js/controllers.js" />"></script> +</body> +</html> http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp deleted file mode 100644 index d66b06a..0000000 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/WEB-INF/content/hello.jsp +++ /dev/null @@ -1,31 +0,0 @@ -<!DOCTYPE html> -<%@ page contentType="text/html; charset=UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<html lang="en" ng-app="angularStrutsApp"> -<head> - <meta charset="utf-8"> - <title>My AngularJS Struts2 App</title> - - <s:url var="ctxUrl" forceAddSchemeHostAndPort="true" includeContext="true" value="/" namespace="/" ></s:url> - <base href="<s:property value="ctxUrl"/>"> -</head> -<body> - -<h2><s:property value="message"/></h2> - -<div> - <a href="/home">Home</a> - <a href="/projects">Projects</a> -</div> - -<div ng-controller="AppController"> - <div ng-view></div> -</div> - -<script src="<s:url value="js/lib/angular/angular.min.js" />"></script> -<script src="<s:url value="js/lib/angular/angular-route.min.js" />"></script> -<script src="<s:url value="js/bootstrap.js" />"></script> -<script src="<s:url value="js/directives.js" />"></script> -<script src="<s:url value="js/services.js" />"></script> -<script src="<s:url value="js/controllers.js" />"></script> -</body> -</html> http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp index 8f58a1a..3fa05a5 100644 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/main/webapp/index.jsp @@ -1 +1 @@ -<% response.sendRedirect("hello"); %> \ No newline at end of file +<% response.sendRedirect("application"); %> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java new file mode 100644 index 0000000..0933a81 --- /dev/null +++ b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/ApplicationActionTest.java @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * 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 ${package}.actions; + +import com.opensymphony.xwork2.ActionSupport; +import org.apache.struts2.StrutsTestCase; + +public class ApplicationActionTest extends StrutsTestCase { + + public void testApplicationAction() throws Exception { + ApplicationAction hello = new ApplicationAction(); + String result = hello.execute(); + assertTrue("Expected a success result!", ActionSupport.SUCCESS.equals(result)); + assertTrue("Expected the default message!", hello.getText(ApplicationAction.MESSAGE).equals(hello.getMessage())); + } +} http://git-wip-us.apache.org/repos/asf/struts/blob/8312ed14/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java ---------------------------------------------------------------------- diff --git a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java b/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java deleted file mode 100644 index b864899..0000000 --- a/archetypes/struts2-archetype-angularjs/src/main/resources/archetype-resources/src/test/java/actions/HelloActionTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * $Id$ - * - * 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 ${package}.actions; - -import com.opensymphony.xwork2.ActionSupport; -import org.apache.struts2.StrutsTestCase; - -public class HelloActionTest extends StrutsTestCase { - - public void testHelloAction() throws Exception { - HelloAction hello = new HelloAction(); - String result = hello.execute(); - assertTrue("Expected a success result!", - ActionSupport.SUCCESS.equals(result)); - assertTrue("Expected the default message!", - hello.getText(HelloAction.MESSAGE).equals(hello.getMessage())); - } -}
