[geode] branch develop updated: GEODE-5792: ClientServerTransactionDUnitTest occasionally fails on Windows (#2529)
This is an automated email from the ASF dual-hosted git repository. jensdeppe pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 1a547e0 GEODE-5792: ClientServerTransactionDUnitTest occasionally fails on Windows (#2529) 1a547e0 is described below commit 1a547e05fefa3e5fac5beb78160f927b76f0d25a Author: Jens Deppe AuthorDate: Tue Oct 2 22:02:48 2018 -0700 GEODE-5792: ClientServerTransactionDUnitTest occasionally fails on Windows (#2529) --- .../cache/ClientServerTransactionDUnitTest.java| 32 -- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java index 0e3f149..70016bf 100644 --- a/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java +++ b/geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java @@ -2912,15 +2912,6 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest } }); -datastore1.invoke(new SerializableCallable() { - public Object call() throws Exception { -CacheServer s = getCache().addCacheServer(); -getCache().getLogger().info("SWAP:ds1"); -s.setPort(port2); -s.start(); -return null; - } -}); datastore1.invoke(new CreateReplicateRegion("r1")); datastore2.invoke(new CreateReplicateRegion("r2")); @@ -2937,6 +2928,16 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest } }); +datastore1.invoke(new SerializableCallable() { + public Object call() throws Exception { +CacheServer s = getCache().addCacheServer(); +getCache().getLogger().info("SWAP:ds1"); +s.setPort(port2); +s.start(); +return null; + } +}); + accessor.invoke(new SerializableCallable() { public Object call() throws Exception { getCache().getLogger().info("SWAP:accessor"); @@ -3012,12 +3013,6 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest return null; }); -datastore1.invoke("create backup server", () -> { - CacheServer s = getCache().addCacheServer(); - s.setPort(port2); - s.start(); - return null; -}); datastore1.invoke(new CreateReplicateRegion("r1")); datastore2.invoke(new CreateReplicateRegion("r1")); @@ -3030,6 +3025,13 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest return cCache.getCacheTransactionManager().getTransactionId(); }); +datastore1.invoke("create backup server", () -> { + CacheServer s = getCache().addCacheServer(); + s.setPort(port2); + s.start(); + return null; +}); + server.invoke("close cache after sending tx message to other servers", () -> { final TXManagerImpl mgr = (TXManagerImpl) getCache().getCacheTransactionManager(); assertTrue(mgr.isHostedTxInProgress((TXId) txId));
[geode] branch develop updated: GEODE-5805: Extract LoginHandlerInterceptor tests (#2551)
This is an automated email from the ASF dual-hosted git repository. heybales pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new e71bcfe GEODE-5805: Extract LoginHandlerInterceptor tests (#2551) e71bcfe is described below commit e71bcfeab76ffd85f15fa52fcf7e21cd18f7a8a2 Author: Dale Emery AuthorDate: Tue Oct 2 14:06:52 2018 -0700 GEODE-5805: Extract LoginHandlerInterceptor tests (#2551) --- .../support/LoginHandlerInterceptorTest.java | 172 - 1 file changed, 102 insertions(+), 70 deletions(-) diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorTest.java index d28ba5b..4c50bbc 100644 --- a/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorTest.java +++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/controllers/support/LoginHandlerInterceptorTest.java @@ -19,7 +19,9 @@ import static java.util.Collections.enumeration; import static org.apache.geode.management.internal.security.ResourceConstants.PASSWORD; import static org.apache.geode.management.internal.security.ResourceConstants.USER_NAME; import static org.apache.geode.management.internal.web.controllers.support.LoginHandlerInterceptor.ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX; +import static org.apache.geode.management.internal.web.controllers.support.LoginHandlerInterceptorTest.RequestBuilder.request; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.data.MapEntry.entry; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -35,7 +37,6 @@ import java.util.concurrent.Semaphore; import javax.servlet.http.HttpServletRequest; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -47,7 +48,6 @@ import org.apache.geode.internal.security.SecurityService; import org.apache.geode.test.junit.rules.ConcurrencyRule; public class LoginHandlerInterceptorTest { - @Mock private SecurityService securityService; private HandlerInterceptor interceptor; @@ -65,79 +65,87 @@ public class LoginHandlerInterceptorTest { interceptor = new LoginHandlerInterceptor(securityService); } - @After - public void tearDown() { -LoginHandlerInterceptor.getEnvironment().clear(); + @Test + public void beforeFirstCallToPreHandle_environmentIsEmpty() { +assertThat(LoginHandlerInterceptor.getEnvironment()).isEmpty(); } @Test - public void preHandleSetsEnvironmentVariablesFromPrefixedRequestParameters() - throws Exception { -final Map requestParameters = new HashMap<>(2); -requestParameters.put("parameter", "one"); -requestParameters.put(ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "variable", "two"); -final HttpServletRequest mockHttpRequest = mock(HttpServletRequest.class, name.getMethodName()); - when(mockHttpRequest.getParameterNames()).thenReturn(enumeration(requestParameters.keySet())); -when(mockHttpRequest.getHeader(USER_NAME)).thenReturn("admin"); -when(mockHttpRequest.getHeader(PASSWORD)).thenReturn("password"); - when(mockHttpRequest.getParameter(ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "variable")) -.thenReturn("two"); + public void preHandle_createsNewEnvironmentInstance() throws Exception { +HttpServletRequest request = request().build(); Map environmentBeforePreHandle = LoginHandlerInterceptor.getEnvironment(); -assertThat(environmentBeforePreHandle) -.describedAs("environment before preHandle()") -.isEmpty(); -assertThat(interceptor.preHandle(mockHttpRequest, null, null)) -.describedAs("preHandle() result") -.isTrue(); +interceptor.preHandle(request, null, null); + assertThat(LoginHandlerInterceptor.getEnvironment()) -.describedAs("environment after preHandle()") -.isNotSameAs(environmentBeforePreHandle) -.hasSize(1) -.containsEntry("variable", "two"); +.isNotSameAs(environmentBeforePreHandle); + } -Properties expectedLoginProperties = new Properties(); -expectedLoginProperties.put(USER_NAME, "admin"); -expectedLoginProperties.put(PASSWORD, "password"); -verify(securityService, times(1)).login(expectedLoginProperties); + @Test + public void preHandle_copiesPrefixedRequestParametersIntoEnvironment() throws Exception { +HttpServletRequest request = request() +.withParameter(ENVIRONMENT_VARIABLE_REQUEST_PARAMETER_PREFIX + "prefixed", "prefixed value") +.withParameter("not-prefixed", "not-prefixed value") +.build(); + +intercep
[geode] branch develop updated: GEODE-5747: Handling SocketException consistently (#2504)
This is an automated email from the ASF dual-hosted git repository. mcmellawatt pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 41dbe2e GEODE-5747: Handling SocketException consistently (#2504) 41dbe2e is described below commit 41dbe2e5804939df0b33ae47e57da50f6c7d9152 Author: Ryan McMahon AuthorDate: Tue Oct 2 12:48:11 2018 -0700 GEODE-5747: Handling SocketException consistently (#2504) --- .../internal/tcpserver/TcpServerJUnitTest.java | 73 -- .../distributed/internal/tcpserver/TcpServer.java | 3 +- .../geode/internal/InternalDataSerializer.java | 44 - .../internal/InternalDataSerializerJUnitTest.java | 31 + 4 files changed, 111 insertions(+), 40 deletions(-) diff --git a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java index 71a1eba..4f83560 100644 --- a/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java +++ b/geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/tcpserver/TcpServerJUnitTest.java @@ -18,12 +18,18 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; import java.io.DataInput; import java.io.DataOutput; +import java.io.EOFException; import java.io.IOException; import java.net.ConnectException; import java.net.InetAddress; +import java.net.SocketException; import java.util.Properties; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -34,6 +40,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import org.apache.geode.DataSerializable; import org.apache.geode.cache.GemFireCache; @@ -79,18 +87,20 @@ public class TcpServerJUnitTest { EchoHandler handler = new EchoHandler(); start(handler); +TcpClient tcpClient = new TcpClient(); + TestObject test = new TestObject(); test.id = 5; TestObject result = -(TestObject) new TcpClient().requestToServer(localhost, port, test, 60 * 1000); +(TestObject) tcpClient.requestToServer(localhost, port, test, 60 * 1000); assertEquals(test.id, result.id); -String[] info = new TcpClient().getInfo(localhost, port); +String[] info = tcpClient.getInfo(localhost, port); assertNotNull(info); assertTrue(info.length > 1); try { - new TcpClient().stop(localhost, port); + tcpClient.stop(localhost, port); } catch (ConnectException ignore) { // must not be running } @@ -109,12 +119,14 @@ public class TcpServerJUnitTest { DelayHandler handler = new DelayHandler(latch); start(handler); +TcpClient tcpClient = new TcpClient(); + final AtomicBoolean done = new AtomicBoolean(); Thread delayedThread = new Thread() { public void run() { Boolean delay = Boolean.valueOf(true); try { - new TcpClient().requestToServer(localhost, port, delay, 60 * 1000); + tcpClient.requestToServer(localhost, port, delay, 60 * 1000); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { @@ -127,7 +139,7 @@ public class TcpServerJUnitTest { try { Thread.sleep(500); assertFalse(done.get()); - new TcpClient().requestToServer(localhost, port, Boolean.valueOf(false), 60 * 1000); + tcpClient.requestToServer(localhost, port, Boolean.valueOf(false), 60 * 1000); assertFalse(done.get()); latch.countDown(); @@ -138,7 +150,7 @@ public class TcpServerJUnitTest { delayedThread.join(60 * 1000); assertTrue(!delayedThread.isAlive()); // GemStoneAddition try { -new TcpClient().stop(localhost, port); +tcpClient.stop(localhost, port); } catch (ConnectException ignore) { // must not be running } @@ -146,6 +158,55 @@ public class TcpServerJUnitTest { } } + @Test + public void testNewConnectionsAcceptedAfterSocketException() throws IOException, + ClassNotFoundException, InterruptedException { +// Initially mock the handler to throw a SocketException. We want to verify that the server +// can recover and serve new client requests after a SocketException is thrown. +TcpHandler mockTcpHandler = mock(TcpHandler.cl
[geode] branch develop updated: GEODE-5784: Remove unused duplicate condition from AbstractConfig (#2545)
This is an automated email from the ASF dual-hosted git repository. klund pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 7112b62 GEODE-5784: Remove unused duplicate condition from AbstractConfig (#2545) 7112b62 is described below commit 7112b626794091a6c8e1fa90b8e263808993d752 Author: Kirk Lund AuthorDate: Tue Oct 2 12:35:04 2018 -0700 GEODE-5784: Remove unused duplicate condition from AbstractConfig (#2545) Add new characterization tests for AbstractConfig.setAttribute --- .../org/apache/geode/internal/AbstractConfig.java | 12 .../geode/internal/i18n/LocalizedStrings.java | 3 - .../apache/geode/internal/AbstractConfigTest.java | 74 -- 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java index f5b1d3d..a1d36d0 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java +++ b/geode-core/src/main/java/org/apache/geode/internal/AbstractConfig.java @@ -37,7 +37,6 @@ import java.util.StringTokenizer; import java.util.TreeSet; import org.apache.geode.InternalGemFireException; -import org.apache.geode.UnmodifiableException; import org.apache.geode.distributed.internal.FlowControlParams; import org.apache.geode.internal.i18n.LocalizedStrings; import org.apache.geode.internal.net.SocketCreator; @@ -224,7 +223,6 @@ public abstract class AbstractConfig implements Config { if (valueType.equals(String.class)) { attObjectValue = value; } else if (valueType.equals(String[].class)) { -// TODO:GEODE-5784: DUPLICATE CONDITION with different behavior attObjectValue = value.split(","); } else if (valueType.equals(Integer.class)) { attObjectValue = Integer.valueOf(value); @@ -252,16 +250,6 @@ public abstract class AbstractConfig implements Config { LocalizedStrings.AbstractConfig_0_VALUE_1_MUST_BE_A_VALID_HOST_NAME_2 .toLocalizedString(name, value, ex.toString())); } - } else if (valueType.equals(String[].class)) { -// TODO:GEODE-5784: DUPLICATE CONDITION with different behavior -if (value == null || value.length() == 0) { - attObjectValue = null; -} else { - String trimAttName = name.substring(0, name.length() - 1); - throw new UnmodifiableException( - LocalizedStrings.AbstractConfig_THE_0_CONFIGURATION_ATTRIBUTE_CAN_NOT_BE_SET_FROM_THE_COMMAND_LINE_SET_1_FOR_EACH_INDIVIDUAL_PARAMETER_INSTEAD - .toLocalizedString(name, trimAttName)); -} } else if (valueType.equals(FlowControlParams.class)) { String[] values = value.split(","); if (values.length != 3) { diff --git a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java index 198f081..73030ee 100755 --- a/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java +++ b/geode-core/src/main/java/org/apache/geode/internal/i18n/LocalizedStrings.java @@ -1888,9 +1888,6 @@ public class LocalizedStrings { public static final StringId AbstractConfig_0_VALUE_1_MUST_HAVE_THREE_ELEMENTS_SEPARATED_BY_COMMAS = new StringId(2155, "{0} value \"{1}\" must have three elements separated by commas"); - public static final StringId AbstractConfig_THE_0_CONFIGURATION_ATTRIBUTE_CAN_NOT_BE_SET_FROM_THE_COMMAND_LINE_SET_1_FOR_EACH_INDIVIDUAL_PARAMETER_INSTEAD = - new StringId(2157, - "The \"{0}\" configuration attribute can not be set from the command line. Set \"{1}\" for each individual parameter instead."); public static final StringId AbstractConfig_UNHANDLED_ATTRIBUTE_NAME_0 = new StringId(2158, "unhandled attribute name \"{0}\"."); public static final StringId AbstractConfig_UNHANDLED_ATTRIBUTE_TYPE_0_FOR_1 = diff --git a/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java index 9ad7403..aebb928 100644 --- a/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java +++ b/geode-core/src/test/java/org/apache/geode/internal/AbstractConfigTest.java @@ -15,18 +15,82 @@ package org.apache.geode.internal; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.catchThrowable; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import org.junit.Before; import org.junit.Test; - public class AbstractConfigTest { + private ConfigSource source; + private AbstractC
[geode] 01/02: GEODE-5787: move MethExecutor into dunit
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a commit to branch feature/GEODE-5787-dunit-internal in repository https://gitbox.apache.org/repos/asf/geode.git commit 27548dcf3b2a080670120128d0150f12dc651b1e Author: Sai Boorlagadda AuthorDate: Tue Oct 2 11:44:28 2018 -0700 GEODE-5787: move MethExecutor into dunit --- .../main/java/org/apache/geode/test/dunit/VM.java | 3 +- .../geode/test/dunit/standalone/DUnitLauncher.java | 2 +- .../geode/test/dunit/standalone/MethExecutor.java | 363 + .../test/dunit/standalone/MethExecutorResult.java | 174 ++ .../geode/test/dunit/standalone/RemoteDUnitVM.java | 2 - .../test/dunit/standalone/RemoteDUnitVMIF.java | 2 - 6 files changed, 539 insertions(+), 7 deletions(-) diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java index 32643ec..74f618a 100644 --- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/VM.java @@ -24,10 +24,9 @@ import java.rmi.RemoteException; import java.util.List; import java.util.concurrent.Callable; -import hydra.MethExecutorResult; - import org.apache.geode.internal.process.ProcessUtils; import org.apache.geode.test.dunit.standalone.BounceResult; +import org.apache.geode.test.dunit.standalone.MethExecutorResult; import org.apache.geode.test.dunit.standalone.RemoteDUnitVMIF; import org.apache.geode.test.dunit.standalone.StandAloneDUnitEnv; import org.apache.geode.test.dunit.standalone.VersionManager; diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java index 8f82f9b..d427896 100644 --- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java @@ -48,7 +48,7 @@ import java.util.Properties; import batterytest.greplogs.ExpectedStrings; import batterytest.greplogs.LogConsumer; -import hydra.MethExecutorResult; +import org.apache.geode.test.dunit.standalone.MethExecutorResult; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.LoggerContext; diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/MethExecutor.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/MethExecutor.java new file mode 100644 index 000..7913739 --- /dev/null +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/MethExecutor.java @@ -0,0 +1,363 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.geode.test.dunit.standalone; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +import org.apache.geode.SystemFailure; + +/** + * + * A class specialized for executing (via reflection) the receiver/selector pairs found in + * TestTasks. + * + */ +public class MethExecutor { + + // @todo lises add static args method + + /** + * Helper method that searches a class (and its superclasses) for a method with the given name and + * parameter types. + * + * @throws NoSuchMethodException If the method cannot be found + */ + public static Method getMethod(Class c, String methodName, Class[] paramTypes) + throws NoSuchMethodException { + +ArrayList matchingMethods = new ArrayList(); +for (Class q = c; q != null; q = q.getSuperclass()) { + Method[] methods = q.getDeclaredMethods(); + NEXT_METHOD: for (int i = 0; i < methods.length; i++) { +Method m = methods[i]; +if (!m.getName().equals(methodName)) { + continue; +} + +Class[] argTypes = m.getParameterTypes(); +if (argTypes.length != paramTypes.length) { + continue; +} + +for (int j = 0; j < argTypes.length; j++) { + if (paramTypes[j] == null) { +if (argTypes[j].isPrimitive()) { +
[geode] branch feature/GEODE-5787-dunit-internal created (now 16aeb26)
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a change to branch feature/GEODE-5787-dunit-internal in repository https://gitbox.apache.org/repos/asf/geode.git. at 16aeb26 GEODE-5787: extract inner classes in dunit This branch includes the following new commits: new 27548dc GEODE-5787: move MethExecutor into dunit new 16aeb26 GEODE-5787: extract inner classes in dunit The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[geode] 02/02: GEODE-5787: extract inner classes in dunit
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a commit to branch feature/GEODE-5787-dunit-internal in repository https://gitbox.apache.org/repos/asf/geode.git commit 16aeb26da4a9323676df77a6613249a055141be1 Author: Sai Boorlagadda AuthorDate: Tue Oct 2 12:18:54 2018 -0700 GEODE-5787: extract inner classes in dunit Signed-off-by: Kirk Lund --- .../geode/test/dunit/standalone/ChildVM.java | 1 - .../geode/test/dunit/standalone/DUnitHost.java | 99 + .../geode/test/dunit/standalone/DUnitLauncher.java | 160 + .../apache/geode/test/dunit/standalone/Master.java | 56 .../geode/test/dunit/standalone/MasterRemote.java | 16 +++ .../geode/test/dunit/standalone/MethExecutor.java | 2 +- .../test/dunit/standalone/ProcessManager.java | 36 + .../geode/test/dunit/standalone/RemoteDUnitVM.java | 2 +- .../test/dunit/standalone/StandAloneDUnitEnv.java | 1 - 9 files changed, 177 insertions(+), 196 deletions(-) diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ChildVM.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ChildVM.java index fe3277b..3c0e43c 100644 --- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ChildVM.java +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ChildVM.java @@ -23,7 +23,6 @@ import org.apache.geode.internal.OSProcess; import org.apache.geode.internal.Version; import org.apache.geode.internal.logging.LogService; import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase; -import org.apache.geode.test.dunit.standalone.DUnitLauncher.MasterRemote; public class ChildVM { diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitHost.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitHost.java new file mode 100644 index 000..46f3e24 --- /dev/null +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitHost.java @@ -0,0 +1,99 @@ +package org.apache.geode.test.dunit.standalone; + +import java.io.IOException; +import java.rmi.AccessException; +import java.rmi.NotBoundException; +import java.rmi.RemoteException; +import java.rmi.registry.Registry; + +import org.apache.geode.test.dunit.Host; +import org.apache.geode.test.dunit.VM; + +class DUnitHost extends Host { + private static final long serialVersionUID = -8034165624503666383L; + + private final transient VM debuggingVM; + + private transient ProcessManager processManager; + + public DUnitHost(String hostName, ProcessManager processManager) throws RemoteException { +super(hostName); +this.debuggingVM = new VM(this, -1, new RemoteDUnitVM()); +this.processManager = processManager; + } + + public void init(Registry registry, int numVMs) + throws AccessException, RemoteException, NotBoundException, InterruptedException { +for (int i = 0; i < numVMs; i++) { + RemoteDUnitVMIF remote = processManager.getStub(i); + addVM(i, remote); +} + +addLocator(DUnitLauncher.LOCATOR_VM_NUM, processManager.getStub(DUnitLauncher.LOCATOR_VM_NUM)); + +addHost(this); + } + + /** + * Retrieves one of this host's VMs based on the specified VM ID. This will not bounce VM to a + * different version. It will only get the current running VM or launch a new one if not already + * launched. + * + * @param n ID of the requested VM; a value of -1 will return the controller VM, + *which may be useful for debugging. + * @return VM for the requested VM ID. + */ + @Override + public VM getVM(int n) { +if (n < getVMCount() && n != DUnitLauncher.DEBUGGING_VM_NUM) { + VM current = super.getVM(n); + return getVM(current.getVersion(), n); +} else { + return getVM(VersionManager.CURRENT_VERSION, n); +} + } + + @Override + public VM getVM(String version, int n) { +if (n == DUnitLauncher.DEBUGGING_VM_NUM) { + // for ease of debugging, pass -1 to get the local VM + return debuggingVM; +} + +if (n < getVMCount()) { + VM current = super.getVM(n); + if (!current.getVersion().equals(version)) { +System.out.println( +"Bouncing VM" + n + " from version " + current.getVersion() + " to " + version); +current.bounce(version); + } + return current; +} + +int oldVMCount = getVMCount(); +if (n >= oldVMCount) { + // If we don't have a VM with that number, dynamically create it. + try { +// first fill in any gaps, to keep the superclass, Host, happy +for (int i = oldVMCount; i < n; i++) { + processManager.launchVM(i); +} +processManager.waitForVMs(DUnitLauncher.STARTUP_TIMEOUT); + +for (int i = oldVMCount; i < n; i++) { + addVM(i, processManager.getStub(i)); +} + +// now create the one we really want +
[geode-native] branch develop updated: GEODE-4728: Native Client doc improvements - Incorporate reviewer suggestions
This is an automated email from the ASF dual-hosted git repository. dbarnes pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git The following commit(s) were added to refs/heads/develop by this push: new 16e0e47 GEODE-4728: Native Client doc improvements - Incorporate reviewer suggestions 16e0e47 is described below commit 16e0e4735d8eaf2f1d9ddbf59b81de2fa04b7786 Author: Dave Barnes AuthorDate: Wed Sep 26 17:27:40 2018 -0700 GEODE-4728: Native Client doc improvements - Incorporate reviewer suggestions --- .../master_middleman/source/subnavs/geode-nc-nav.erb | 10 +- .../configuring/config-client-cache.html.md.erb | 5 + .../configuring/system-level-configuration.html.md.erb | 12 ++-- .../getting-started/getting-started-nc-client.html.md.erb| 8 +--- docs/geode-native-docs/regions/regions.html.md.erb | 2 +- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb b/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb index a1eccfc..fdd1133 100644 --- a/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb +++ b/docs/geode-native-book/master_middleman/source/subnavs/geode-nc-nav.erb @@ -24,8 +24,16 @@ limitations under the License. Getting Started with the Native Library - + Application Development Walkthroughs + + + C++ App Development Walkthrough + + + .NET App Development Walkthrough + + Programming Examples diff --git a/docs/geode-native-docs/configuring/config-client-cache.html.md.erb b/docs/geode-native-docs/configuring/config-client-cache.html.md.erb index 541c400..4c7ab65 100644 --- a/docs/geode-native-docs/configuring/config-client-cache.html.md.erb +++ b/docs/geode-native-docs/configuring/config-client-cache.html.md.erb @@ -40,7 +40,4 @@ The `Cache` inherits `RegionService` and adds management of these client caching - Region creation - Subscription keepalive management for durable clients - Access to the underlying distributed system -- `RegionService` creation for secure access by multiple users -See [Creating Multiple Secure User Connections with RegionService](../security/createsecureconnregionservice.html) - - +- `RegionService` creation for secure access by multiple users (see [Creating Multiple Secure User Connections with RegionService](../security/createsecureconnregionservice.html). diff --git a/docs/geode-native-docs/configuring/system-level-configuration.html.md.erb b/docs/geode-native-docs/configuring/system-level-configuration.html.md.erb index 27b2fb6..623e657 100644 --- a/docs/geode-native-docs/configuring/system-level-configuration.html.md.erb +++ b/docs/geode-native-docs/configuring/system-level-configuration.html.md.erb @@ -29,7 +29,7 @@ In case an attribute is defined in more than one place, the first source in this - Programmatic configuration - Properties set at the command line - _current-working-directory_/geode.properties file -- _native-client-dir_/defaultSystem/geode.properties file +- _native-client-installation-directory_/defaultSystem/geode.properties file - defaults The `geode.properties` files and programmatic configuration are optional. If they are not present, @@ -39,9 +39,9 @@ object, see [Defining Properties Programmatically](#native-client-config_definin ## Search Path for Multiple Properties Files The client and cache server processes first look for their properties file in the -_native-client-dir_/defaultSystem directory, then in the working directory. +_native-client-installation-directory_/defaultSystem directory, then in the working directory. -Any properties set in the working directory override settings in the `defaultSystem/geode.properties` file. +Any properties set in the working directory override settings in the _native-client-installation-directory_/defaultSystem/geode.properties file. The `geode.properties` file provides information to the client regarding the expected server configuration. Properties set in this file (in the client environment) do not have any effect on the @@ -69,14 +69,14 @@ The `geode.properties` file provides local settings required to connect a client ## Configuration File Locations -A client looks for a `geode.properties` file first in the working directory where the process runs, then in _native-client-dir_/defaultSystem. +A client looks for a `geode.properties` file first in the working directory where the process runs, then in _native-client-installation-directory_/defaultSystem. Use the `defaultSystem` directory to group configuration files or to share them among processes for more convenient administration. If `geode.prop
[geode] branch develop updated: GEODE-5787: extract ProcessHolder to be an outer class (#2550)
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git The following commit(s) were added to refs/heads/develop by this push: new 9622a68 GEODE-5787: extract ProcessHolder to be an outer class (#2550) 9622a68 is described below commit 9622a68f0288ba926fa91bdd91c5a45c7f226e97 Author: Jens Deppe AuthorDate: Tue Oct 2 11:39:06 2018 -0700 GEODE-5787: extract ProcessHolder to be an outer class (#2550) * Removed getter on ProcessHolder to get underlying process * Added waitFor to ProcessHolder * Added getters to get underlying process error & input stream Signed-off-by: Sai Boorlagadda --- .../geode/test/dunit/standalone/DUnitLauncher.java | 3 +- .../geode/test/dunit/standalone/ProcessHolder.java | 56 ++ .../test/dunit/standalone/ProcessManager.java | 37 ++ 3 files changed, 61 insertions(+), 35 deletions(-) diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java index 58c7c9b..8f82f9b 100644 --- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java @@ -124,8 +124,9 @@ public class DUnitLauncher { static final String MASTER_PARAM = "DUNIT_MASTER"; public static final String RMI_PORT_PARAM = GEMFIRE_PREFIX + "DUnitLauncher.RMI_PORT"; + public static final String RMI_HOST_PARAM = GEMFIRE_PREFIX + "DUnitLauncher.RMI_HOST"; public static final String VM_NUM_PARAM = GEMFIRE_PREFIX + "DUnitLauncher.VM_NUM"; - static final String VM_VERSION_PARAM = GEMFIRE_PREFIX + "DUnitLauncher.VM_VERSION"; + public static final String VM_VERSION_PARAM = GEMFIRE_PREFIX + "DUnitLauncher.VM_VERSION"; private static final String LAUNCHED_PROPERTY = GEMFIRE_PREFIX + "DUnitLauncher.LAUNCHED"; diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessHolder.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessHolder.java new file mode 100644 index 000..ebc0530 --- /dev/null +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessHolder.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ +package org.apache.geode.test.dunit.standalone; + +import java.io.InputStream; + +public class ProcessHolder { + private final Process process; + private volatile boolean killed = false; + + public ProcessHolder(Process process) { +this.process = process; + } + + public void kill() { +this.killed = true; +process.destroy(); + } + + public void killForcibly() { +this.killed = true; +process.destroyForcibly(); + } + + public void waitFor() throws InterruptedException { +process.waitFor(); + } + + public InputStream getErrorStream() { +return process.getErrorStream(); + } + + public InputStream getInputStream() { +return process.getInputStream(); + } + + public boolean isKilled() { +return killed; + } + + public boolean isAlive() { +return !killed && process.isAlive(); + } +} diff --git a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessManager.java b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessManager.java index a200f14..79a3dda 100755 --- a/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessManager.java +++ b/geode-dunit/src/main/java/org/apache/geode/test/dunit/standalone/ProcessManager.java @@ -95,8 +95,8 @@ public class ProcessManager { pendingVMs++; ProcessHolder holder = new ProcessHolder(process); processes.put(vmNum, holder); - linkStreams(version, vmNum, holder, process.getErrorStream(), System.err); - linkStreams(version, vmNum, holder, process.getInputStream(), System.out); + linkStreams(version, vmNum, holder, holder.getErrorStream(), System.err); + linkStreams(version, vmNum, holder, holder.getInputStream(), System.out); } catch (Ru
[geode] branch feature/GEODE-5787-process-holder deleted (was 3a4e3dd)
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a change to branch feature/GEODE-5787-process-holder in repository https://gitbox.apache.org/repos/asf/geode.git. was 3a4e3dd add license header The revisions that were on this branch are still contained in other references; therefore, this change does not discard any commits from the repository.
[geode] branch develop updated (ab55a84 -> 03d57a9)
This is an automated email from the ASF dual-hosted git repository. sai_boorlagadda pushed a change to branch develop in repository https://gitbox.apache.org/repos/asf/geode.git. from ab55a84 GEODE-5781: split repeatTest into separate tasks (#2526) add 03d57a9 GEODE-5808: Move dunit framework tests to geode-dunit (#2553) No new revisions were added by this update. Summary of changes: .../java/org/apache/geode/test/dunit/tests/BasicDistributedTest.java | 0 .../org/apache/geode/test/dunit/tests/GetCurrentVmNumDistributedTest.java | 0 .../geode/test/dunit/tests/GetDefaultDiskStoreNameDistributedTest.java| 0 .../geode/test/dunit/tests/GetPidAndIdAfterBounceDistributedTest.java | 0 .../org/apache/geode/test/dunit/tests/GetPidAndIdDistributedTest.java | 0 .../apache/geode/test/dunit/tests/GetTestMethodNameDistributedTest.java | 0 .../org/apache/geode/test/dunit/tests/GetUniqueNameDistributedTest.java | 0 .../dunit/tests/OverridingGetPropertiesDisconnectsAllDistributedTest.java | 0 .../java/org/apache/geode/test/dunit/tests/VMDistributedTest.java | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/BasicDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetCurrentVmNumDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetDefaultDiskStoreNameDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetPidAndIdAfterBounceDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetPidAndIdDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetTestMethodNameDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/GetUniqueNameDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/OverridingGetPropertiesDisconnectsAllDistributedTest.java (100%) rename {geode-core => geode-dunit}/src/distributedTest/java/org/apache/geode/test/dunit/tests/VMDistributedTest.java (100%)
[geode-native] branch feature-GEODE-5802 created (now 9b9ce66)
This is an automated email from the ASF dual-hosted git repository. echobravo pushed a change to branch feature-GEODE-5802 in repository https://gitbox.apache.org/repos/asf/geode-native.git. at 9b9ce66 Geode-5638: Reorganize the projects (#364) No new revisions were added by this update.