diff options
author | Eike Stepper | 2012-07-19 08:22:04 +0000 |
---|---|---|
committer | Eike Stepper | 2012-07-19 08:22:04 +0000 |
commit | 1460904fd3c193ffaf809913b2983a400fce9d94 (patch) | |
tree | 72f3a17b75fedba3ae1060df1d32c9c7889be954 /plugins/org.eclipse.net4j.http.tests | |
parent | 5f360965ae87478e0681899bf310a210cafc2c44 (diff) | |
download | cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.gz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.tar.xz cdo-1460904fd3c193ffaf809913b2983a400fce9d94.zip |
Fix line endings in master (dos2unix)
Diffstat (limited to 'plugins/org.eclipse.net4j.http.tests')
6 files changed, 251 insertions, 251 deletions
diff --git a/plugins/org.eclipse.net4j.http.tests/.settings/org.eclipse.core.resources.prefs b/plugins/org.eclipse.net4j.http.tests/.settings/org.eclipse.core.resources.prefs index 49abe01107..9cf3f2f2e7 100644 --- a/plugins/org.eclipse.net4j.http.tests/.settings/org.eclipse.core.resources.prefs +++ b/plugins/org.eclipse.net4j.http.tests/.settings/org.eclipse.core.resources.prefs @@ -1,3 +1,3 @@ -#Mon Jul 04 12:54:07 CEST 2011
-eclipse.preferences.version=1
-encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8
+#Mon Jul 04 12:54:07 CEST 2011 +eclipse.preferences.version=1 +encoding//model/org.eclipse.emf.cdo.defs.ecorediag=UTF-8 diff --git a/plugins/org.eclipse.net4j.http.tests/copyright.txt b/plugins/org.eclipse.net4j.http.tests/copyright.txt index 8f6328980e..0a0f67e6d7 100644 --- a/plugins/org.eclipse.net4j.http.tests/copyright.txt +++ b/plugins/org.eclipse.net4j.http.tests/copyright.txt @@ -1,8 +1,8 @@ -Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Eclipse Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/epl-v10.html
-
-Contributors:
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. +All rights reserved. This program and the accompanying materials +are made available under the terms of the Eclipse Public License v1.0 +which accompanies this distribution, and is available at +http://www.eclipse.org/legal/epl-v10.html + +Contributors: Eike Stepper - initial API and implementation
\ No newline at end of file diff --git a/plugins/org.eclipse.net4j.http.tests/plugin.properties b/plugins/org.eclipse.net4j.http.tests/plugin.properties index f1b2f27644..bbcf852134 100644 --- a/plugins/org.eclipse.net4j.http.tests/plugin.properties +++ b/plugins/org.eclipse.net4j.http.tests/plugin.properties @@ -1,11 +1,11 @@ -# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Eike Stepper - initial API and implementation
-
-pluginName = Net4j Signalling Platform Transport HTTP Tests
-providerName = Eclipse Modeling Project
+# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Eike Stepper - initial API and implementation + +pluginName = Net4j Signalling Platform Transport HTTP Tests +providerName = Eclipse Modeling Project diff --git a/plugins/org.eclipse.net4j.http.tests/plugin.xml b/plugins/org.eclipse.net4j.http.tests/plugin.xml index 7d41c86aa5..cc6202116c 100644 --- a/plugins/org.eclipse.net4j.http.tests/plugin.xml +++ b/plugins/org.eclipse.net4j.http.tests/plugin.xml @@ -1,23 +1,23 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Eike Stepper - initial API and implementation
--->
-
-<plugin>
-
- <extension
- point="org.eclipse.equinox.http.registry.servlets">
- <servlet
- alias="/net4j/echotest"
- class="org.eclipse.net4j.http.tests.Net4jEchoTestServlet"/>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<!-- + Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + Eike Stepper - initial API and implementation +--> + +<plugin> + + <extension + point="org.eclipse.equinox.http.registry.servlets"> + <servlet + alias="/net4j/echotest" + class="org.eclipse.net4j.http.tests.Net4jEchoTestServlet"/> + </extension> + +</plugin> diff --git a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java index 3e68919444..d04c27ac81 100644 --- a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java +++ b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/HTTPTest.java @@ -1,134 +1,134 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.http.tests;
-
-import org.eclipse.net4j.Net4jUtil;
-import org.eclipse.net4j.http.HTTPUtil;
-import org.eclipse.net4j.internal.http.HTTPClientConnector;
-import org.eclipse.net4j.tests.AbstractTransportTest;
-import org.eclipse.net4j.tests.signal.IntRequest;
-import org.eclipse.net4j.tests.signal.TestSignalProtocol;
-import org.eclipse.net4j.util.WrappedException;
-import org.eclipse.net4j.util.container.IManagedContainer;
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.RequestEntity;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-/**
- * @author Eike Stepper
- */
-public class HTTPTest extends AbstractTransportTest
-{
- public HTTPTest()
- {
- }
-
- @Override
- protected IManagedContainer createContainer()
- {
- IManagedContainer container = super.createContainer();
- HTTPUtil.prepareContainer(container);
- return container;
- }
-
- /**
- * Result: With the current implementation (HttpClient / Jetty) it's not possible to transfer request data before
- */
- public void _testRequestFlush() throws Exception
- {
- HttpClient client = new HttpClient();
- PostMethod method = new PostMethod("http://eike@localhost:8080/net4j/echotest"); //$NON-NLS-1$
- method.setRequestEntity(new RequestEntity()
- {
- public long getContentLength()
- {
- return -1;
- }
-
- public String getContentType()
- {
- return "application/octet-stream"; //$NON-NLS-1$
- }
-
- public boolean isRepeatable()
- {
- return false;
- }
-
- public void writeRequest(OutputStream out) throws IOException
- {
- int count = 10;
- out.write(count);
- for (int i = 0; i < count; i++)
- {
- send(out, i);
- }
- }
-
- private void send(OutputStream out, int b) throws IOException
- {
- try
- {
- msg("Writing " + b); //$NON-NLS-1$
- out.write(b);
- out.flush();
- Thread.sleep(1000);
- }
- catch (InterruptedException ex)
- {
- throw WrappedException.wrap(ex);
- }
- }
- });
-
- client.executeMethod(method);
- InputStream responseBody = method.getResponseBodyAsStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(responseBody);
- int count = in.readInt();
- for (int i = 0; i < count; i++)
- {
- int b = in.readByte();
- assertEquals(i, b);
-
- long gap = in.readLong();
- msg("Gap: " + gap); //$NON-NLS-1$
- }
-
- method.releaseConnection();
- }
-
- public void test1() throws Exception
- {
- HTTPClientConnector connector = getHTTPConnector();
- TestSignalProtocol protocol = new TestSignalProtocol(connector);
-
- IntRequest request = new IntRequest(protocol, 305419896);
- int result = request.send();
- assertEquals(305419896, result);
-
- sleep(500);
- protocol.close();
- sleep(500);
- connector.deactivate();
- }
-
- private HTTPClientConnector getHTTPConnector()
- {
- return (HTTPClientConnector)Net4jUtil.getConnector(container, "http", //$NON-NLS-1$
- "http://eike@localhost:8080/net4j"); //$NON-NLS-1$
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.http.tests; + +import org.eclipse.net4j.Net4jUtil; +import org.eclipse.net4j.http.HTTPUtil; +import org.eclipse.net4j.internal.http.HTTPClientConnector; +import org.eclipse.net4j.tests.AbstractTransportTest; +import org.eclipse.net4j.tests.signal.IntRequest; +import org.eclipse.net4j.tests.signal.TestSignalProtocol; +import org.eclipse.net4j.util.WrappedException; +import org.eclipse.net4j.util.container.IManagedContainer; +import org.eclipse.net4j.util.io.ExtendedDataInputStream; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.RequestEntity; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * @author Eike Stepper + */ +public class HTTPTest extends AbstractTransportTest +{ + public HTTPTest() + { + } + + @Override + protected IManagedContainer createContainer() + { + IManagedContainer container = super.createContainer(); + HTTPUtil.prepareContainer(container); + return container; + } + + /** + * Result: With the current implementation (HttpClient / Jetty) it's not possible to transfer request data before + */ + public void _testRequestFlush() throws Exception + { + HttpClient client = new HttpClient(); + PostMethod method = new PostMethod("http://eike@localhost:8080/net4j/echotest"); //$NON-NLS-1$ + method.setRequestEntity(new RequestEntity() + { + public long getContentLength() + { + return -1; + } + + public String getContentType() + { + return "application/octet-stream"; //$NON-NLS-1$ + } + + public boolean isRepeatable() + { + return false; + } + + public void writeRequest(OutputStream out) throws IOException + { + int count = 10; + out.write(count); + for (int i = 0; i < count; i++) + { + send(out, i); + } + } + + private void send(OutputStream out, int b) throws IOException + { + try + { + msg("Writing " + b); //$NON-NLS-1$ + out.write(b); + out.flush(); + Thread.sleep(1000); + } + catch (InterruptedException ex) + { + throw WrappedException.wrap(ex); + } + } + }); + + client.executeMethod(method); + InputStream responseBody = method.getResponseBodyAsStream(); + ExtendedDataInputStream in = new ExtendedDataInputStream(responseBody); + int count = in.readInt(); + for (int i = 0; i < count; i++) + { + int b = in.readByte(); + assertEquals(i, b); + + long gap = in.readLong(); + msg("Gap: " + gap); //$NON-NLS-1$ + } + + method.releaseConnection(); + } + + public void test1() throws Exception + { + HTTPClientConnector connector = getHTTPConnector(); + TestSignalProtocol protocol = new TestSignalProtocol(connector); + + IntRequest request = new IntRequest(protocol, 305419896); + int result = request.send(); + assertEquals(305419896, result); + + sleep(500); + protocol.close(); + sleep(500); + connector.deactivate(); + } + + private HTTPClientConnector getHTTPConnector() + { + return (HTTPClientConnector)Net4jUtil.getConnector(container, "http", //$NON-NLS-1$ + "http://eike@localhost:8080/net4j"); //$NON-NLS-1$ + } +} diff --git a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/Net4jEchoTestServlet.java b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/Net4jEchoTestServlet.java index cb0c171b74..aee76351be 100644 --- a/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/Net4jEchoTestServlet.java +++ b/plugins/org.eclipse.net4j.http.tests/src/org/eclipse/net4j/http/tests/Net4jEchoTestServlet.java @@ -1,73 +1,73 @@ -/*
- * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Eike Stepper - initial API and implementation
- */
-package org.eclipse.net4j.http.tests;
-
-import org.eclipse.net4j.util.io.ExtendedDataInputStream;
-import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
-import org.eclipse.net4j.util.io.IOUtil;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import java.io.IOException;
-
-/**
- * @author Eike Stepper
- */
-public class Net4jEchoTestServlet extends HttpServlet
-{
- private static final long serialVersionUID = 1L;
-
- public Net4jEchoTestServlet()
- {
- }
-
- @Override
- protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doPost(req, resp);
- }
-
- @Override
- protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- doRequest(req, resp);
- }
-
- protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
- {
- ServletInputStream servletInputStream = req.getInputStream();
- ExtendedDataInputStream in = new ExtendedDataInputStream(servletInputStream);
-
- ServletOutputStream servletOutputStream = resp.getOutputStream();
- ExtendedDataOutputStream out = new ExtendedDataOutputStream(servletOutputStream);
-
- long lastTime = System.currentTimeMillis();
- int count = in.readByte();
- out.writeInt(count);
- for (int i = 0; i < count; i++)
- {
- byte b = in.readByte();
- long now = System.currentTimeMillis();
- long gap = now - lastTime;
- lastTime = now;
- IOUtil.OUT().println("Gap: " + gap); //$NON-NLS-1$
-
- out.writeByte(b);
- out.writeLong(gap);
- out.flush();
- }
- }
-}
+/* + * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Eike Stepper - initial API and implementation + */ +package org.eclipse.net4j.http.tests; + +import org.eclipse.net4j.util.io.ExtendedDataInputStream; +import org.eclipse.net4j.util.io.ExtendedDataOutputStream; +import org.eclipse.net4j.util.io.IOUtil; + +import javax.servlet.ServletException; +import javax.servlet.ServletInputStream; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import java.io.IOException; + +/** + * @author Eike Stepper + */ +public class Net4jEchoTestServlet extends HttpServlet +{ + private static final long serialVersionUID = 1L; + + public Net4jEchoTestServlet() + { + } + + @Override + protected final void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + doPost(req, resp); + } + + @Override + protected final void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + doRequest(req, resp); + } + + protected void doRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException + { + ServletInputStream servletInputStream = req.getInputStream(); + ExtendedDataInputStream in = new ExtendedDataInputStream(servletInputStream); + + ServletOutputStream servletOutputStream = resp.getOutputStream(); + ExtendedDataOutputStream out = new ExtendedDataOutputStream(servletOutputStream); + + long lastTime = System.currentTimeMillis(); + int count = in.readByte(); + out.writeInt(count); + for (int i = 0; i < count; i++) + { + byte b = in.readByte(); + long now = System.currentTimeMillis(); + long gap = now - lastTime; + lastTime = now; + IOUtil.OUT().println("Gap: " + gap); //$NON-NLS-1$ + + out.writeByte(b); + out.writeLong(gap); + out.flush(); + } + } +} |