Compiler warnings
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-function-adapter-openwhisk</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.function.Supplier;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.function.context.FunctionCatalog;
|
||||
import org.springframework.cloud.function.context.catalog.FunctionInspector;
|
||||
@@ -55,7 +56,6 @@ public class OpenWhiskFunctionInitializer {
|
||||
@Autowired
|
||||
private FunctionProperties properties;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void initialize() {
|
||||
logger.info("Initializing - OpenWhisk Function Initializer");
|
||||
if (!this.initialized.compareAndSet(false, true)) {
|
||||
@@ -65,9 +65,11 @@ public class OpenWhiskFunctionInitializer {
|
||||
String type = this.properties.getType();
|
||||
if ("function".equals(type)) {
|
||||
this.function = this.catalog.lookup(Function.class, name);
|
||||
} else if ("consumer".equals(type)) {
|
||||
}
|
||||
else if ("consumer".equals(type)) {
|
||||
this.consumer = this.catalog.lookup(Consumer.class, name);
|
||||
} else if ("supplier".equals(type)) {
|
||||
}
|
||||
else if ("supplier".equals(type)) {
|
||||
this.supplier = this.catalog.lookup(Supplier.class, name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,15 @@
|
||||
|
||||
package org.springframework.cloud.function.adapter.openwhisk;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
|
||||
@@ -31,10 +37,6 @@ import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
@@ -65,14 +67,14 @@ public class OpenWhiskActionHandlerTest {
|
||||
actionRequest.setValue(eventData);
|
||||
Object result = actionHandler.run(actionRequest);
|
||||
assertNotNull(result);
|
||||
assertEquals("{\"result\":{\"name\":\"Spring\",\"message\":\"Hello, Spring\"}}", result);
|
||||
assertEquals("{\"result\":{\"name\":\"Spring\",\"message\":\"Hello, Spring\"}}",
|
||||
result);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHandlerWithoutPayload() {
|
||||
Map<String, String> testData = new HashMap<>();
|
||||
testData.put("name", "Spring");
|
||||
Map<String, Object> eventData = new HashMap<>();
|
||||
actionHandler.init(new OpenWhiskInitRequest());
|
||||
OpenWhiskActionRequest actionRequest = new OpenWhiskActionRequest();
|
||||
actionRequest.setActionName("test_action");
|
||||
@@ -82,8 +84,8 @@ public class OpenWhiskActionHandlerTest {
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@Import({ContextFunctionCatalogAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class})
|
||||
@Import({ ContextFunctionCatalogAutoConfiguration.class,
|
||||
JacksonAutoConfiguration.class })
|
||||
protected static class OWFunctionConfig {
|
||||
|
||||
@Bean
|
||||
@@ -97,7 +99,6 @@ public class OpenWhiskActionHandlerTest {
|
||||
return new OpenWhiskActionHandler();
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public FunctionProperties properties() {
|
||||
return new FunctionProperties();
|
||||
@@ -125,7 +126,8 @@ public class OpenWhiskActionHandlerTest {
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = String.format(GREETINGS_FORMAT, this.name != null ? name : "nobody");
|
||||
this.message = String.format(GREETINGS_FORMAT,
|
||||
this.name != null ? name : "nobody");
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
||||
Reference in New Issue
Block a user