DATAGEODE-121 - Do not allow eager init when getting beans by type to resolve Configurers for Annotation configuration.
This commit is contained in:
@@ -193,7 +193,7 @@ public class AddCacheServerConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(CacheServerConfigurer.class, true, true);
|
.getBeansOfType(CacheServerConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -198,7 +198,6 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
registry.registerBeanDefinition(poolName, poolFactoryBean.getBeanDefinition());
|
registry.registerBeanDefinition(poolName, poolFactoryBean.getBeanDefinition());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
private List<PoolConfigurer> resolvePoolConfigurers() {
|
private List<PoolConfigurer> resolvePoolConfigurers() {
|
||||||
|
|
||||||
return Optional.ofNullable(this.poolConfigurers)
|
return Optional.ofNullable(this.poolConfigurers)
|
||||||
@@ -208,7 +207,7 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, PoolConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(PoolConfigurer.class, true, true);
|
.getBeansOfType(PoolConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
})
|
})
|
||||||
@@ -243,7 +242,6 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
return poolFactoryBean;
|
return poolFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected BeanDefinitionBuilder configurePoolLocators(String poolName, Map<String, Object> enablePoolAttributes,
|
protected BeanDefinitionBuilder configurePoolLocators(String poolName, Map<String, Object> enablePoolAttributes,
|
||||||
BeanDefinitionBuilder poolFactoryBean) {
|
BeanDefinitionBuilder poolFactoryBean) {
|
||||||
|
|
||||||
@@ -261,7 +259,6 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
return poolFactoryBean;
|
return poolFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected BeanDefinitionBuilder configurePoolServers(String poolName, Map<String, Object> enablePoolAttributes,
|
protected BeanDefinitionBuilder configurePoolServers(String poolName, Map<String, Object> enablePoolAttributes,
|
||||||
BeanDefinitionBuilder poolFactoryBean) {
|
BeanDefinitionBuilder poolFactoryBean) {
|
||||||
|
|
||||||
@@ -279,7 +276,6 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
return poolFactoryBean;
|
return poolFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected ConnectionEndpointList parseConnectionEndpoints(Map<String, Object> enablePoolAttributes,
|
protected ConnectionEndpointList parseConnectionEndpoints(Map<String, Object> enablePoolAttributes,
|
||||||
String arrayAttributeName, String stringAttributeName, int defaultPort) {
|
String arrayAttributeName, String stringAttributeName, int defaultPort) {
|
||||||
|
|
||||||
@@ -301,12 +297,10 @@ public class AddPoolConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
return connectionEndpoints;
|
return connectionEndpoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected ConnectionEndpoint newConnectionEndpoint(String host, Integer port) {
|
protected ConnectionEndpoint newConnectionEndpoint(String host, Integer port) {
|
||||||
return new ConnectionEndpoint(host, port);
|
return new ConnectionEndpoint(host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
@Override
|
@Override
|
||||||
protected Class getAnnotationType() {
|
protected Class getAnnotationType() {
|
||||||
return EnablePool.class;
|
return EnablePool.class;
|
||||||
|
|||||||
@@ -141,7 +141,6 @@ public class CacheServerConfiguration extends PeerCacheConfiguration {
|
|||||||
return gemfireCacheServer;
|
return gemfireCacheServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
private List<CacheServerConfigurer> resolveCacheServerConfigurers() {
|
private List<CacheServerConfigurer> resolveCacheServerConfigurers() {
|
||||||
|
|
||||||
return Optional.ofNullable(this.cacheServerConfigurers)
|
return Optional.ofNullable(this.cacheServerConfigurers)
|
||||||
@@ -153,7 +152,7 @@ public class CacheServerConfiguration extends PeerCacheConfiguration {
|
|||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
|
|
||||||
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, CacheServerConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(CacheServerConfigurer.class, true, true);
|
.getBeansOfType(CacheServerConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class ClientCacheConfiguration extends AbstractCacheConfiguration {
|
|||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
|
|
||||||
Map<String, ClientCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, ClientCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(ClientCacheConfigurer.class, true, true);
|
.getBeansOfType(ClientCacheConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ public class ContinuousQueryConfiguration extends AbstractAnnotationConfigSuppor
|
|||||||
|
|
||||||
Map<String, ContinuousQueryListenerContainerConfigurer> beansOfType =
|
Map<String, ContinuousQueryListenerContainerConfigurer> beansOfType =
|
||||||
((ListableBeanFactory) beanFactory).getBeansOfType(ContinuousQueryListenerContainerConfigurer.class,
|
((ListableBeanFactory) beanFactory).getBeansOfType(ContinuousQueryListenerContainerConfigurer.class,
|
||||||
true, true);
|
true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ public class DiskStoreConfiguration extends AbstractAnnotationConfigSupport
|
|||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
|
|
||||||
Map<String, DiskStoreConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, DiskStoreConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(DiskStoreConfigurer.class, true, true);
|
.getBeansOfType(DiskStoreConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -364,7 +364,7 @@ public class EntityDefinedRegionsConfiguration extends AbstractAnnotationConfigS
|
|||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
|
|
||||||
Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, RegionConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(RegionConfigurer.class, true, true);
|
.getBeansOfType(RegionConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -308,7 +308,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration {
|
|||||||
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
.filter(beanFactory -> beanFactory instanceof ListableBeanFactory)
|
||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, IndexConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(IndexConfigurer.class, true, true);
|
.getBeansOfType(IndexConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ public class PeerCacheConfiguration extends AbstractCacheConfiguration {
|
|||||||
return gemfireCache;
|
return gemfireCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
private List<PeerCacheConfigurer> resolvePeerCacheConfigurers() {
|
private List<PeerCacheConfigurer> resolvePeerCacheConfigurers() {
|
||||||
|
|
||||||
return Optional.ofNullable(this.peerCacheConfigurers)
|
return Optional.ofNullable(this.peerCacheConfigurers)
|
||||||
@@ -113,7 +112,7 @@ public class PeerCacheConfiguration extends AbstractCacheConfiguration {
|
|||||||
.map(beanFactory -> {
|
.map(beanFactory -> {
|
||||||
|
|
||||||
Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
Map<String, PeerCacheConfigurer> beansOfType = ((ListableBeanFactory) beanFactory)
|
||||||
.getBeansOfType(PeerCacheConfigurer.class, true, true);
|
.getBeansOfType(PeerCacheConfigurer.class, true, false);
|
||||||
|
|
||||||
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
return nullSafeMap(beansOfType).values().stream().collect(Collectors.toList());
|
||||||
|
|
||||||
|
|||||||
@@ -74,23 +74,19 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
protected static final String SYSTEM_PROPERTIES_LOG_FILE = "system-properties.log";
|
protected static final String SYSTEM_PROPERTIES_LOG_FILE = "system-properties.log";
|
||||||
protected static final String TEST_GEMFIRE_LOG_LEVEL = "error";
|
protected static final String TEST_GEMFIRE_LOG_LEVEL = "error";
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String asApplicationName(Class<?> type) {
|
protected static String asApplicationName(Class<?> type) {
|
||||||
return type.getSimpleName();
|
return type.getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String asDirectoryName(Class<?> type) {
|
protected static String asDirectoryName(Class<?> type) {
|
||||||
return String.format("%1$s-%2$s", asApplicationName(type),
|
return String.format("%1$s-%2$s", asApplicationName(type),
|
||||||
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-hh-mm-ss")));
|
LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-hh-mm-ss")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static File createDirectory(String pathname) {
|
protected static File createDirectory(String pathname) {
|
||||||
return createDirectory(new File(pathname));
|
return createDirectory(new File(pathname));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static File createDirectory(File directory) {
|
protected static File createDirectory(File directory) {
|
||||||
|
|
||||||
assertThat(directory.isDirectory() || directory.mkdirs())
|
assertThat(directory.isDirectory() || directory.mkdirs())
|
||||||
@@ -103,7 +99,6 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static int findAvailablePort() throws IOException {
|
protected static int findAvailablePort() throws IOException {
|
||||||
|
|
||||||
ServerSocket serverSocket = null;
|
ServerSocket serverSocket = null;
|
||||||
@@ -117,110 +112,89 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getClassNameAsPath(Class type) {
|
protected static String getClassNameAsPath(Class type) {
|
||||||
return type.getName().replaceAll("\\.", "/");
|
return type.getName().replaceAll("\\.", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getClassNameAsPath(Object obj) {
|
protected static String getClassNameAsPath(Object obj) {
|
||||||
return getClassNameAsPath(obj.getClass());
|
return getClassNameAsPath(obj.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getPackageNameAsPath(Class type) {
|
protected static String getPackageNameAsPath(Class type) {
|
||||||
return type.getPackage().getName().replaceAll("\\.", "/");
|
return type.getPackage().getName().replaceAll("\\.", "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getPackageNameAsPath(Object obj) {
|
protected static String getPackageNameAsPath(Object obj) {
|
||||||
return getPackageNameAsPath(obj.getClass());
|
return getPackageNameAsPath(obj.getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getContextXmlFileLocation(Class type) {
|
protected static String getContextXmlFileLocation(Class type) {
|
||||||
return getClassNameAsPath(type).concat("-context.xml");
|
return getClassNameAsPath(type).concat("-context.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String getServerContextXmlFileLocation(Class type) {
|
protected static String getServerContextXmlFileLocation(Class type) {
|
||||||
return getClassNameAsPath(type).concat("-server-context.xml");
|
return getClassNameAsPath(type).concat("-server-context.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean isDeleteDirectoryOnExit() {
|
protected static boolean isDeleteDirectoryOnExit() {
|
||||||
return Boolean.valueOf(System.getProperty(DIRECTORY_DELETE_ON_EXIT_PROPERTY, Boolean.TRUE.toString()));
|
return Boolean.valueOf(System.getProperty(DIRECTORY_DELETE_ON_EXIT_PROPERTY, Boolean.TRUE.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static int intValue(Number number) {
|
protected static int intValue(Number number) {
|
||||||
return (number != null ? number.intValue() : 0);
|
return (number != null ? number.intValue() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String logFile() {
|
protected static String logFile() {
|
||||||
return logFile(GEMFIRE_LOG_FILE);
|
return logFile(GEMFIRE_LOG_FILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String logFile(String defaultLogFilePathname) {
|
protected static String logFile(String defaultLogFilePathname) {
|
||||||
return System.getProperty(GEMFIRE_LOG_FILE_PROPERTY, defaultLogFilePathname);
|
return System.getProperty(GEMFIRE_LOG_FILE_PROPERTY, defaultLogFilePathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String logLevel() {
|
protected static String logLevel() {
|
||||||
return logLevel(GEMFIRE_LOG_LEVEL);
|
return logLevel(GEMFIRE_LOG_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static String logLevel(String defaultLogLevel) {
|
protected static String logLevel(String defaultLogLevel) {
|
||||||
return System.getProperty(GEMFIRE_LOG_LEVEL_PROPERTY, defaultLogLevel);
|
return System.getProperty(GEMFIRE_LOG_LEVEL_PROPERTY, defaultLogLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static void logSystemProperties() throws IOException {
|
protected static void logSystemProperties() throws IOException {
|
||||||
FileUtils.write(new File(SYSTEM_PROPERTIES_LOG_FILE),
|
FileUtils.write(new File(SYSTEM_PROPERTIES_LOG_FILE),
|
||||||
String.format("%s", CollectionUtils.toString(System.getProperties())));
|
String.format("%s", CollectionUtils.toString(System.getProperties())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static ProcessWrapper run(Class<?> type, String... arguments) throws IOException {
|
protected static ProcessWrapper run(Class<?> type, String... arguments) throws IOException {
|
||||||
return run(createDirectory(asDirectoryName(type)), type, arguments);
|
return run(createDirectory(asDirectoryName(type)), type, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static ProcessWrapper run(File workingDirectory, Class<?> type, String... arguments) throws IOException {
|
protected static ProcessWrapper run(File workingDirectory, Class<?> type, String... arguments) throws IOException {
|
||||||
return (isProcessRunAuto() ? launch(createDirectory(workingDirectory), type, arguments) : null);
|
return (isProcessRunAuto() ? launch(createDirectory(workingDirectory), type, arguments) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static ProcessWrapper run(String classpath, Class<?> type, String... arguments) throws IOException {
|
protected static ProcessWrapper run(String classpath, Class<?> type, String... arguments) throws IOException {
|
||||||
return run(createDirectory(asDirectoryName(type)), classpath, type, arguments);
|
return run(createDirectory(asDirectoryName(type)), classpath, type, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static ProcessWrapper run(File workingDirectory, String classpath, Class<?> type, String... arguments)
|
protected static ProcessWrapper run(File workingDirectory, String classpath, Class<?> type, String... arguments)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
||||||
return (isProcessRunAuto() ? launch(createDirectory(workingDirectory), classpath, type, arguments) : null);
|
return (isProcessRunAuto() ? launch(createDirectory(workingDirectory), classpath, type, arguments) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean isProcessRunAuto() {
|
protected static boolean isProcessRunAuto() {
|
||||||
return !isProcessRunManual();
|
return !isProcessRunManual();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean isProcessRunManual() {
|
protected static boolean isProcessRunManual() {
|
||||||
return Boolean.getBoolean(PROCESS_RUN_MANUAL_PROPERTY);
|
return Boolean.getBoolean(PROCESS_RUN_MANUAL_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static AnnotationConfigApplicationContext runSpringApplication(Class<?> annotatedClass, String... args) {
|
protected static AnnotationConfigApplicationContext runSpringApplication(Class<?> annotatedClass, String... args) {
|
||||||
return runSpringApplication(asArray(annotatedClass), args);
|
return runSpringApplication(asArray(annotatedClass), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static AnnotationConfigApplicationContext runSpringApplication(Class<?>[] annotatedClasses,
|
protected static AnnotationConfigApplicationContext runSpringApplication(Class<?>[] annotatedClasses,
|
||||||
String... args) {
|
String... args) {
|
||||||
|
|
||||||
@@ -232,12 +206,10 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
return applicationContext;
|
return applicationContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean stop(ProcessWrapper process) {
|
protected static boolean stop(ProcessWrapper process) {
|
||||||
return stop(process, DEFAULT_WAIT_DURATION);
|
return stop(process, DEFAULT_WAIT_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean stop(ProcessWrapper process, long duration) {
|
protected static boolean stop(ProcessWrapper process, long duration) {
|
||||||
|
|
||||||
return Optional.ofNullable(process)
|
return Optional.ofNullable(process)
|
||||||
@@ -254,22 +226,18 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
.orElse(true);
|
.orElse(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean waitForCacheServerToStart(CacheServer cacheServer) {
|
protected static boolean waitForCacheServerToStart(CacheServer cacheServer) {
|
||||||
return waitForServerToStart(cacheServer.getBindAddress(), cacheServer.getPort(), DEFAULT_WAIT_DURATION);
|
return waitForServerToStart(cacheServer.getBindAddress(), cacheServer.getPort(), DEFAULT_WAIT_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean waitForCacheServerToStart(CacheServer cacheServer, long duration) {
|
protected static boolean waitForCacheServerToStart(CacheServer cacheServer, long duration) {
|
||||||
return waitForServerToStart(cacheServer.getBindAddress(), cacheServer.getPort(), duration);
|
return waitForServerToStart(cacheServer.getBindAddress(), cacheServer.getPort(), duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean waitForServerToStart(String host, int port) {
|
protected static boolean waitForServerToStart(String host, int port) {
|
||||||
return waitForServerToStart(host, port, DEFAULT_WAIT_DURATION);
|
return waitForServerToStart(host, port, DEFAULT_WAIT_DURATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc) */
|
|
||||||
protected static boolean waitForServerToStart(final String host, final int port, long duration) {
|
protected static boolean waitForServerToStart(final String host, final int port, long duration) {
|
||||||
|
|
||||||
return ThreadUtils.timedWait(duration, DEFAULT_WAIT_INTERVAL, new ThreadUtils.WaitCondition() {
|
return ThreadUtils.timedWait(duration, DEFAULT_WAIT_INTERVAL, new ThreadUtils.WaitCondition() {
|
||||||
@@ -313,13 +281,14 @@ public class ClientServerIntegrationTestsSupport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException e) {
|
catch (InterruptedException cause) {
|
||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
return condition.evaluate();
|
return condition.evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
protected interface Condition {
|
protected interface Condition {
|
||||||
boolean evaluate();
|
boolean evaluate();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user