forked from graniteds/graniteds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
William Drai
committed
Oct 2, 2013
1 parent
4c4d37f
commit e9a68c8
Showing
9 changed files
with
192 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
94 changes: 94 additions & 0 deletions
94
...te-client-java-udp/src/test/java/org/granite/client/test/udp/server/TestUdpMessaging.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/** | ||
* GRANITE DATA SERVICES | ||
* Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S. | ||
* | ||
* This file is part of the Granite Data Services Platform. | ||
* | ||
* Granite Data Services is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* Granite Data Services is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
* USA, or see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.granite.client.test.udp.server; | ||
|
||
import org.granite.client.messaging.*; | ||
import org.granite.client.messaging.udp.UdpChannelBuilder; | ||
import org.granite.client.test.server.ChatApplication; | ||
import org.granite.client.test.server.TestMessaging; | ||
import org.granite.logging.Logger; | ||
import org.granite.test.container.EmbeddedContainer; | ||
import org.granite.test.container.Utils; | ||
import org.granite.util.ContentType; | ||
import org.granite.util.TypeUtil; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.WebArchive; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by william on 30/09/13. | ||
*/ | ||
@RunWith(Parameterized.class) | ||
public class TestUdpMessaging extends TestMessaging { | ||
|
||
private static final Logger log = Logger.getLogger(TestUdpMessaging.class); | ||
|
||
private static String CONTAINER_CLASS_NAME = System.getProperty("container.className"); | ||
|
||
@Parameterized.Parameters(name = "container: {0}, encoding: {1}") | ||
public static Iterable<Object[]> data() { | ||
List<Object[]> params = new ArrayList<Object[]>(); | ||
for (ContentType contentType : Arrays.asList(ContentType.JMF_AMF, ContentType.AMF)) { | ||
params.add(new Object[] { CONTAINER_CLASS_NAME, contentType }); | ||
} | ||
return params; | ||
} | ||
|
||
private ContentType contentType; | ||
private String containerClassName; | ||
private static EmbeddedContainer container; | ||
|
||
private static final ServerApp SERVER_APP_APP = new ServerApp("/chat", false, "localhost", 8787); | ||
|
||
public TestUdpMessaging(String containerClassName, ContentType contentType) { | ||
super(containerClassName, contentType, UdpChannelBuilder.UDP_CHANNEL_TYPE); | ||
} | ||
|
||
@BeforeClass | ||
public static void startContainer() throws Exception { | ||
// Build a chat server application | ||
WebArchive war = ShrinkWrap.create(WebArchive.class, "chat.war"); | ||
war.addClass(ChatApplication.class); | ||
war.addAsLibraries(new File("granite-server-core/build/libs/").listFiles(new Utils.ArtifactFileFilter())); | ||
war.addAsLibraries(new File("granite-server-servlet3/build/libs/").listFiles(new Utils.ArtifactFileFilter())); | ||
war.addAsLibraries(new File("granite-server-udp/build/libs/").listFiles(new Utils.ArtifactFileFilter())); | ||
war.addAsWebInfResource(new File("granite-client-java-udp/src/test/resources/granite-config-udp.xml"), "granite/granite-config.xml"); | ||
|
||
container = (EmbeddedContainer) TypeUtil.newInstance(CONTAINER_CLASS_NAME, new Class<?>[]{WebArchive.class}, new Object[]{war}); | ||
container.start(); | ||
log.info("Container started"); | ||
} | ||
|
||
@AfterClass | ||
public static void stopContainer() throws Exception { | ||
container.stop(); | ||
log.info("Container stopped"); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
granite-client-java-udp/src/test/resources/granite-config-udp.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<!DOCTYPE granite-config PUBLIC "-//Granite Data Services//DTD granite-config internal//EN" | ||
"http://www.graniteds.org/public/dtd/3.0.0/granite-config.dtd"> | ||
|
||
<granite-config> | ||
<gravity> | ||
<udp/> | ||
</gravity> | ||
</granite-config> |
17 changes: 17 additions & 0 deletions
17
granite-client-java-udp/tests-tomcat7/granite-client-java-udp-tests-tomcat7.iml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$" /> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" scope="TEST" name="org.apache.tomcat.embed:tomcat-embed-core:7.0.42" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="org.apache.tomcat.embed:tomcat-embed-jasper:7.0.42" level="project" /> | ||
<orderEntry type="library" scope="TEST" name="org.apache.tomcat.embed:tomcat-embed-logging-juli:7.0.42" level="project" /> | ||
<orderEntry type="module" module-name="granite-server-udp" scope="TEST" /> | ||
<orderEntry type="module" module-name="granite-server-tomcat7" scope="TEST" /> | ||
<orderEntry type="module" module-name="granite-client-java" /> | ||
<orderEntry type="module" module-name="granite-client-java-udp" /> | ||
</component> | ||
</module> | ||
|
21 changes: 21 additions & 0 deletions
21
granite-client-java/src/test/java/org/granite/client/test/MockTransport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters