Issue #2106 Add ability to run deploy tests again
Change-Id: I912137e02d4decb0ff07f9d73d1debeb9d9226a1 Former-commit-id:ccef13f8cd
[formerly09b97672cd
] [formerlyccef13f8cd
[formerly09b97672cd
] [formerly35305d2c1d
[formerly 290c1fb3bc7e9fd4871799e9884fcb10a28db46f]]] Former-commit-id:35305d2c1d
Former-commit-id:79205e287a
[formerly36e0fd26d8
] Former-commit-id:ea2b206bc6
This commit is contained in:
parent
d4f13dac41
commit
8d4c94b29b
3 changed files with 49 additions and 7 deletions
|
@ -23,6 +23,11 @@ import java.io.ByteArrayInputStream;
|
|||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.junit.Ignore;
|
||||
|
||||
import com.raytheon.uf.common.auth.RequestConstants;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
||||
|
||||
/**
|
||||
* Configuration for deploy tests.
|
||||
*
|
||||
|
@ -34,12 +39,14 @@ import java.util.Properties;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 14, 2012 1169 djohnson Initial creation
|
||||
* Dec 06, 2012 1397 djohnson Also set the request server.
|
||||
* Jul 08, 2013 2106 djohnson Add @Ignore, use constants.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
@Ignore
|
||||
public final class DeployTestProperties {
|
||||
|
||||
private static volatile DeployTestProperties INSTANCE;
|
||||
|
@ -57,8 +64,9 @@ public final class DeployTestProperties {
|
|||
*/
|
||||
private DeployTestProperties(Properties properties) {
|
||||
this.dataDeliveryServer = properties
|
||||
.getProperty("datadelivery.server");
|
||||
this.requestServer = properties.getProperty("request.server");
|
||||
.getProperty(DataDeliveryConstants.DATA_DELIVERY_SERVER);
|
||||
this.requestServer = properties
|
||||
.getProperty(RequestConstants.REQUEST_SERVER);
|
||||
this.userId = properties.getProperty("user.id");
|
||||
}
|
||||
|
||||
|
@ -117,4 +125,5 @@ public final class DeployTestProperties {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,12 @@ import static org.mockito.Mockito.verify;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.raytheon.uf.common.auth.RequestConstants;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
|
||||
import com.raytheon.uf.common.registry.RegistryConstants;
|
||||
import com.raytheon.uf.common.util.DeployTestProperties;
|
||||
import com.raytheon.uf.common.util.registry.RegistryException;
|
||||
import com.raytheon.uf.edex.auth.RemoteServerRequestRouter;
|
||||
|
||||
/**
|
||||
* Test {@link RequestRouter}.
|
||||
|
@ -39,6 +44,7 @@ import com.raytheon.uf.common.util.registry.RegistryException;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 14, 2012 1286 djohnson Initial creation
|
||||
* Mar 05, 2013 1754 djohnson Test that infinite loop for request server does not occur.
|
||||
* Jul 08, 2013 2106 djohnson Add setDeployInstance().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,6 +66,33 @@ public class RequestRouterTest {
|
|||
|
||||
private final IServerRequest serverRequest = mock(IServerRequest.class);
|
||||
|
||||
/**
|
||||
* Configures the {@link RequestRouter} to route to deployed EDEX instances.
|
||||
*/
|
||||
public static void setDeployInstance() {
|
||||
try {
|
||||
RequestRouterTest.clearRegistry();
|
||||
|
||||
final DeployTestProperties deployTestProperties = DeployTestProperties
|
||||
.getInstance();
|
||||
|
||||
final RemoteServerRequestRouter requestRouter = new RemoteServerRequestRouter(
|
||||
deployTestProperties.getRequestServer());
|
||||
final RemoteServerRequestRouter dataDeliveryRouter = new RemoteServerRequestRouter(
|
||||
deployTestProperties.getDataDeliveryServer());
|
||||
RequestRouterTest.register(
|
||||
DataDeliveryConstants.DATA_DELIVERY_SERVER,
|
||||
dataDeliveryRouter);
|
||||
RequestRouterTest.register(
|
||||
RegistryConstants.EBXML_REGISTRY_SERVICE,
|
||||
dataDeliveryRouter);
|
||||
RequestRouterTest.register(RequestConstants.REQUEST_SERVER,
|
||||
requestRouter);
|
||||
} catch (RegistryException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a router for the specified server key.
|
||||
*
|
||||
|
@ -118,8 +151,7 @@ public class RequestRouterTest {
|
|||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testUnregisteredRouterWillThrowException()
|
||||
throws Exception {
|
||||
public void testUnregisteredRouterWillThrowException() throws Exception {
|
||||
RequestRouter.route(serverRequest, "noRegisteredServer");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.util.List;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.log4j.lf5.util.StreamUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
|
||||
|
@ -60,6 +60,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
|
|||
* Sep 07, 2012 1102 djohnson Add test for more specification defined properties of hashCode/equals.
|
||||
* Oct 23, 2012 1286 djohnson setupTestClassDir() takes any class.
|
||||
* Jun 05, 2013 2038 djohnson Add constant for metadata tx manager.
|
||||
* Jul 08, 2013 2106 djohnson Use IOUtils instead of log4j for stream copying.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -182,7 +183,7 @@ public final class TestUtil {
|
|||
try {
|
||||
is = callingClass.getResourceAsStream(file);
|
||||
|
||||
StreamUtils.copy(is, bos);
|
||||
IOUtils.copy(is, bos);
|
||||
|
||||
String contents = bos.toString("UTF-8");
|
||||
|
||||
|
@ -324,7 +325,7 @@ public final class TestUtil {
|
|||
try {
|
||||
is = callingClass.getResourceAsStream(resource);
|
||||
try {
|
||||
StreamUtils.copy(is, bos);
|
||||
IOUtils.copy(is, bos);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue