Author: asoldano
Date: 2014-02-27 10:33:16 -0500 (Thu, 27 Feb 2014)
New Revision: 18441
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
Log:
[JBWS-3702] Improving test (also prevents intermittent exception logging due to connection
being closed before the stream is read)
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java 2014-02-26
16:57:45 UTC (rev 18440)
+++
stack/cxf/trunk/modules/addons/transports/http/undertow/src/main/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineFactory.java 2014-02-27
15:33:16 UTC (rev 18441)
@@ -45,7 +45,7 @@
public class UndertowServerEngineFactory implements BusLifeCycleListener
{
private static final Logger LOG =
LogUtils.getL7dLogger(UndertowServerEngineFactory.class);
- private static Map<Integer, UndertowServerEngine> portMap = new
HashMap<Integer, UndertowServerEngine>();
+ private static final Map<Integer, UndertowServerEngine> portMap = new
HashMap<Integer, UndertowServerEngine>();
private BusLifeCycleManager lifeCycleManager;
private Bus bus;
Modified:
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java 2014-02-26
16:57:45 UTC (rev 18440)
+++
stack/cxf/trunk/modules/addons/transports/http/undertow/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/undertow/UndertowServerEngineTest.java 2014-02-27
15:33:16 UTC (rev 18441)
@@ -1,6 +1,6 @@
/*
* JBoss, Home of Professional Open Source.
- * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2014, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
@@ -23,12 +23,14 @@
import io.undertow.server.HttpServerExchange;
+import java.io.BufferedReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.util.ArrayList;
import java.util.Collections;
-import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -39,11 +41,9 @@
import org.apache.cxf.configuration.spring.ConfigurerImpl;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
-import org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerEngine;
-import org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerEngineFactory;
/**
- * Tests for HttpServerEngine
+ * Tests for UndertowServerEngineTest
*
* @author Magesh Kumar B <mageshbk(a)jboss.com> (C) 2011 Red Hat Inc.
* @author alessio.soldano(a)jboss.com
@@ -155,7 +155,13 @@
try
{
HttpURLConnection connection1 = (HttpURLConnection) url.openConnection();
- connection1.getInputStream();
+ StringBuilder sb = new StringBuilder();
+ BufferedReader br = new BufferedReader(new
InputStreamReader(connection1.getInputStream()));
+ String line;
+ while ((line = br.readLine()) != null) {
+ sb.append(line);
+ }
+ assertEquals("Hello", sb.toString());
connection1.disconnect();
}
catch (IOException e)