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