10 |
11 |
12 |
13 |
AWS Java Web Project
14 |
15 | Welcome to your new AWS Java Web Project! This project template gives you
16 | basic a starting point for creating a web application on AWS.
17 |
18 |
19 |
Contents of this Project
20 |
21 |
22 | This page is rendered from WebContent/index.html - a simple static
23 | HTML page. Any static content in the WebContent folder will be accessible
24 | from the equivalent path in your web application (for example,
25 | https://your-app-93s2kypa5y.elasticbeanstalk.com/index.html).
26 |
27 |
28 |
29 | Any JSP files in the WebContent folder
30 | will be processed dynamically to generate HTML pages. For example, the
31 | index.jsp file renders a simple page that displays
32 | a list of any Amazon S3 Buckets,
33 | Amazon DynamoDB Tables,
34 | and Amazon EC2 Instances currently
35 | associated with your AWS account.
36 |
37 |
38 |
Deploying this Project Locally
39 |
40 |
41 | If you have a local installation of
42 | Apache Tomcat, you can deploy this project to it for local testing
43 | using the standard Eclipse Web Tools Platform integration with Tomcat.
44 |
45 |
46 |
47 | - Right/control click on this project in the Project Explorer
48 | - Choose Run As, then Run on Server
49 | - Select the option to manually define a new server
50 | - Expand the Apache folder, then select an appropriate version of Tomcat
51 | - Point Eclipse at your local Tomcat installation and click Finish
52 |
53 |
54 |
55 | This page will open up, now served by your local Tomcat installation.
56 |
57 |
58 |
Deploying the Project to AWS Elastic Beanstalk
59 |
60 |
61 | AWS Elastic Beanstalk
62 | is the quickest and easiest way to deploy an AWS Java Web Project to the
63 | cloud. To deploy this project to AWS Elastic Beanstalk:
64 |
65 |
66 |
67 | - Right/control click on this project in the Project Explorer
68 | - Choose run As, then Run on Server
69 | - Select the option to manually define a new server
70 | - Expand the Amazon Web Services folder, then select an appropriate version of Tomcat
71 | - Select the AWS region where your application will be hosted
72 | - Provide a name for your application and environment and click Finish
73 |
74 |
75 |
76 | Your project will be uploaded to AWS Elastic Beanstalk, which will
77 | provision infrastructure to host your application and deploy your code
78 | to it. When it's finished, you will again see this page open up, now hosted
79 | in the cloud!
80 |
81 |
82 |
83 | For more information about working with AWS Elastic Beanstalk, refer to the
84 |
85 | AWS Elastic Beanstalk Developer Guide.
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/com.tsatsatzu.subwar.test/src/com/tsatsatzu/subwar/test/audio/GameTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Jo Jaquinta, TsaTsaTzu
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.tsatsatzu.subwar.test.audio;
17 |
18 | import static org.junit.Assert.*;
19 |
20 | import org.junit.Test;
21 |
22 | import com.tsatsatzu.subwar.audio.api.SubWarAudioAPI;
23 | import com.tsatsatzu.subwar.audio.data.SWInvocationBean;
24 | import com.tsatsatzu.subwar.game.api.SubWarGameAPI;
25 | import com.tsatsatzu.subwar.game.data.SWContextBean;
26 | import com.tsatsatzu.subwar.game.data.SWOperationBean;
27 |
28 | /**
29 | * This test walks through the game play design dialog.
30 | */
31 | public class GameTest extends BaseTest
32 | {
33 |
34 | /**
35 | * Play a basic round of the game.
36 | */
37 | @Test
38 | public void play()
39 | {
40 | SWOperationBean op = getOperation(SWOperationBean.TEST);
41 | op.setInt1(SWOperationBean.TEST_RESET_SEED);
42 | op.setInt2(1);
43 | SWContextBean context = SubWarGameAPI.invoke(op);
44 | assertNull(context.getLastOperationError());
45 |
46 | SWInvocationBean resp;
47 | resp = dialog(SubWarAudioAPI.CMD_LAUNCH_APP);
48 | assertNull(resp.getGame());
49 | assertFalse(resp.isEndSession());
50 | resp = dialog(SubWarAudioAPI.CMD_LAUNCH);
51 | assertNotNull(resp.getGame());
52 | assertFalse(resp.isEndSession());
53 | aiMove();
54 | resp = dialog(SubWarAudioAPI.CMD_HELP);
55 | assertNotNull(resp.getGame());
56 | assertFalse(resp.isEndSession());
57 | aiMove();
58 | resp = dialog(SubWarAudioAPI.CMD_NORTH);
59 | assertNotNull(resp.getGame());
60 | assertFalse(resp.isEndSession());
61 | aiMove();
62 | resp = dialog(SubWarAudioAPI.CMD_LISTEN);
63 | assertNotNull(resp.getGame());
64 | assertFalse(resp.isEndSession());
65 | aiMove();
66 | resp = dialog(SubWarAudioAPI.CMD_SONAR);
67 | assertNotNull(resp.getGame());
68 | assertFalse(resp.isEndSession());
69 | aiMove();
70 | resp = dialog(SubWarAudioAPI.CMD_DIVE);
71 | assertNotNull(resp.getGame());
72 | assertFalse(resp.isEndSession());
73 | aiMove();
74 | resp = dialog(SubWarAudioAPI.CMD_WEST);
75 | assertNotNull(resp.getGame());
76 | assertFalse(resp.isEndSession());
77 | aiMove();
78 | resp = dialog(SubWarAudioAPI.CMD_LISTEN);
79 | assertNotNull(resp.getGame());
80 | assertFalse(resp.isEndSession());
81 | aiMove();
82 | resp = dialog(SubWarAudioAPI.CMD_FIRE, "east");
83 | assertNotNull(resp.getGame());
84 | assertFalse(resp.isEndSession());
85 | aiMove();
86 | resp = dialog(SubWarAudioAPI.CMD_EAST);
87 | assertNotNull(resp.getGame());
88 | assertFalse(resp.isEndSession());
89 | aiMove();
90 | resp = dialog(SubWarAudioAPI.CMD_DIVE);
91 | assertNotNull(resp.getGame());
92 | assertFalse(resp.isEndSession());
93 | resp = dialog(SubWarAudioAPI.CMD_DOCK);
94 | assertNull(resp.getGame());
95 | assertFalse(resp.isEndSession());
96 | resp = dialog(SubWarAudioAPI.CMD_STOP);
97 | assertNull(resp.getGame());
98 | assertTrue(resp.isEndSession());
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/com.tsatsatzu.subwar/src/com/tsatsatzu/subwar/game/data/SWGameDetailsBean.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Jo Jaquinta, TsaTsaTzu
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.tsatsatzu.subwar.game.data;
17 |
18 | /**
19 | * The Class SWGameDetailsBean.
20 | * These are the details the user knows about a running game.
21 | */
22 | public class SWGameDetailsBean
23 | {
24 |
25 | /** The Eastern boundary. */
26 | private int mEast;
27 |
28 | /** The Western boundary. */
29 | private int mWest;
30 |
31 | /** The Northern boundary. */
32 | private int mNorth;
33 |
34 | /** The Southern boundary. */
35 | private int mSouth;
36 |
37 | /** The Max depth. */
38 | private int mMaxDepth;
39 |
40 | /** The User position. */
41 | private SWPositionBean mUserPosition;
42 |
43 | /**
44 | * Gets the eastern boundary.
45 | *
46 | * @return the eastern boundary
47 | */
48 | public int getEast()
49 | {
50 | return mEast;
51 | }
52 |
53 | /**
54 | * Sets the eastern boundary.
55 | *
56 | * @param east the new eastern boundary
57 | */
58 | public void setEast(int east)
59 | {
60 | mEast = east;
61 | }
62 |
63 | /**
64 | * Gets the western boundary.
65 | *
66 | * @return the western boundary
67 | */
68 | public int getWest()
69 | {
70 | return mWest;
71 | }
72 |
73 | /**
74 | * Sets the western boundary.
75 | *
76 | * @param west the new western boundary
77 | */
78 | public void setWest(int west)
79 | {
80 | mWest = west;
81 | }
82 |
83 | /**
84 | * Gets the northern boundary.
85 | *
86 | * @return the northern boundary
87 | */
88 | public int getNorth()
89 | {
90 | return mNorth;
91 | }
92 |
93 | /**
94 | * Sets the northern boundary.
95 | *
96 | * @param north the new northern boundary
97 | */
98 | public void setNorth(int north)
99 | {
100 | mNorth = north;
101 | }
102 |
103 | /**
104 | * Gets the southern boundary.
105 | *
106 | * @return the southern boundary
107 | */
108 | public int getSouth()
109 | {
110 | return mSouth;
111 | }
112 |
113 | /**
114 | * Sets the southern boundary.
115 | *
116 | * @param south the new southern boundary
117 | */
118 | public void setSouth(int south)
119 | {
120 | mSouth = south;
121 | }
122 |
123 | /**
124 | * Gets the max depth.
125 | *
126 | * @return the max depth
127 | */
128 | public int getMaxDepth()
129 | {
130 | return mMaxDepth;
131 | }
132 |
133 | /**
134 | * Sets the max depth.
135 | *
136 | * @param maxDepth the new max depth
137 | */
138 | public void setMaxDepth(int maxDepth)
139 | {
140 | mMaxDepth = maxDepth;
141 | }
142 |
143 | /**
144 | * Gets the user position.
145 | *
146 | * @return the user position
147 | */
148 | public SWPositionBean getUserPosition()
149 | {
150 | return mUserPosition;
151 | }
152 |
153 | /**
154 | * Sets the user position.
155 | *
156 | * @param userPosition the new user position
157 | */
158 | public void setUserPosition(SWPositionBean userPosition)
159 | {
160 | mUserPosition = userPosition;
161 | }
162 | }
163 |
--------------------------------------------------------------------------------
/com.tsatsatzu.subwar/src/com/tsatsatzu/subwar/game/logic/mem/MemIODriver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Jo Jaquinta, TsaTsaTzu
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.tsatsatzu.subwar.game.logic.mem;
17 |
18 | import java.util.ArrayList;
19 | import java.util.Collections;
20 | import java.util.Comparator;
21 | import java.util.HashMap;
22 | import java.util.List;
23 | import java.util.Map;
24 |
25 | import com.tsatsatzu.subwar.game.data.SWUserBean;
26 | import com.tsatsatzu.subwar.game.logic.IIODriver;
27 |
28 | /*
29 | * This I/O driver is used for unit testing purposes. It stores the User base only
30 | * in memory.
31 | */
32 |
33 | /**
34 | * The Class MemIODriver.
35 | */
36 | public class MemIODriver implements IIODriver
37 | {
38 |
39 | /** The User store. */
40 | private Map