From d899d3fa0a1072b56a461339c039f44537dbdd64 Mon Sep 17 00:00:00 2001 From: John Blum Date: Thu, 27 Feb 2020 21:45:51 -0800 Subject: [PATCH] Polish for enabling Function Executions to return results from all servers. Resolves gh-37. --- .../ExecutionTimeoutFunctionException.java | 2 +- .../UncategorizedFunctionException.java | 2 +- .../execution/AbstractFunctionExecution.java | 7 ++++--- .../GemfireFunctionProxyFactoryBean.java | 4 +++- .../execution/OnRegionFunctionExecution.java | 5 ++--- ...ResultsFromAllServersIntegrationTests.java | 2 -- .../function/execution/onservers/Metric.java | 21 ++++++++++--------- .../gemfire/util/SpringUtilsUnitTests.java | 1 + 8 files changed, 23 insertions(+), 21 deletions(-) diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/ExecutionTimeoutFunctionException.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/ExecutionTimeoutFunctionException.java index 5a493e93..e150ed73 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/ExecutionTimeoutFunctionException.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/ExecutionTimeoutFunctionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/UncategorizedFunctionException.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/UncategorizedFunctionException.java index 4eea3b6f..0b9e1af0 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/UncategorizedFunctionException.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/UncategorizedFunctionException.java @@ -1,5 +1,5 @@ /* - * Copyright 2020-2021 the original author or authors. + * Copyright 2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/AbstractFunctionExecution.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/AbstractFunctionExecution.java index 18267396..3fca1024 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/AbstractFunctionExecution.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/AbstractFunctionExecution.java @@ -1,5 +1,9 @@ /* +<<<<<<< HEAD * Copyright 2020-2021 the original author or authors. +======= + * Copyright 2020 the original author or authors. +>>>>>>> 9eae72c6a... DATAGEODE-295 - Polish. * * Licensed 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 @@ -40,14 +44,11 @@ import org.slf4j.LoggerFactory; * @author David Turanski * @author John Blum * @author Patrick Johnson -<<<<<<< HEAD * @see java.util.concurrent.TimeUnit * @see org.apache.geode.cache.execute.Execution * @see org.apache.geode.cache.execute.Function * @see org.apache.geode.cache.execute.FunctionService * @see org.apache.geode.cache.execute.ResultCollector -======= ->>>>>>> ae69760bf... DATAGEODE-295 - Functions return results from all servers. */ @SuppressWarnings("unused") abstract class AbstractFunctionExecution { diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/GemfireFunctionProxyFactoryBean.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/GemfireFunctionProxyFactoryBean.java index 270b4395..2b9871e5 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/GemfireFunctionProxyFactoryBean.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/GemfireFunctionProxyFactoryBean.java @@ -122,7 +122,9 @@ public class GemfireFunctionProxyFactoryBean extends AbstractFactoryBeanSupport< GemfireFunctionOperations template = getGemfireFunctionOperations(); - String functionId = getFunctionExecutionMethodMetadata().getMethodMetadata(method).getFunctionId(); + String functionId = getFunctionExecutionMethodMetadata() + .getMethodMetadata(method) + .getFunctionId(); return isFunctionExecutionForAllServers(method) ? template.execute(functionId, args) diff --git a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/OnRegionFunctionExecution.java b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/OnRegionFunctionExecution.java index 7253c187..cb459364 100644 --- a/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/OnRegionFunctionExecution.java +++ b/spring-data-geode/src/main/java/org/springframework/data/gemfire/function/execution/OnRegionFunctionExecution.java @@ -19,9 +19,8 @@ import org.apache.geode.cache.execute.Execution; import org.apache.geode.cache.execute.Function; import org.apache.geode.cache.execute.FunctionService; -import org.apache.shiro.util.Assert; - -import org.springframework.util.CollectionUtils; +import org.springframework.data.gemfire.util.CollectionUtils; +import org.springframework.util.Assert; /** * Creates an {@literal OnRegion} {@link Function} {@link Execution} initialized with a {@link Region} diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/FunctionsReturnResultsFromAllServersIntegrationTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/FunctionsReturnResultsFromAllServersIntegrationTests.java index 2b2ec4b0..a078aee2 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/FunctionsReturnResultsFromAllServersIntegrationTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/FunctionsReturnResultsFromAllServersIntegrationTests.java @@ -113,7 +113,6 @@ public class FunctionsReturnResultsFromAllServersIntegrationTests extends Client private static final int DEFAULT_CACHE_SERVER_PORT = 40404; private static final String CACHE_SERVER_PORT_PROPERTY = "spring.data.gemfire.cache.server.port"; - private static final String GEMFIRE_LOG_LEVEL = "error"; private static final String GEMFIRE_NAME = "MetricsServer" + getCacheServerPort(); public static void main(String[] args) throws Exception { @@ -124,7 +123,6 @@ public class FunctionsReturnResultsFromAllServersIntegrationTests extends Client return new CacheFactory() .set("name", GEMFIRE_NAME) - .set("log-level", GEMFIRE_LOG_LEVEL) .create(); } diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/Metric.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/Metric.java index 74d9f7c4..ad2c8381 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/Metric.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/function/execution/onservers/Metric.java @@ -18,23 +18,24 @@ package org.springframework.data.gemfire.function.execution.onservers; import java.io.Serializable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.ToString; + /** * @author Patrick Johnson */ +@Getter +@ToString +@AllArgsConstructor public class Metric implements Serializable { - private String name; + private final String name; - private Number value; + private final Number value; - private String category; + private final String category; - private String type; + private final String type; - public Metric(String name, Number value, String category, String type) { - this.name = name; - this.value = value; - this.category = category; - this.type = type; - } } diff --git a/spring-data-geode/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java b/spring-data-geode/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java index 0255f934..cf1d6393 100644 --- a/spring-data-geode/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java +++ b/spring-data-geode/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java @@ -61,6 +61,7 @@ import org.springframework.data.gemfire.util.SpringUtils.ValueReturningThrowable * * @author John Blum * @see java.util.function.Function + * @see java.util.function.Supplier * @see org.junit.Test * @see org.mockito.Mock * @see org.mockito.Mockito