aboutsummaryrefslogtreecommitdiffstats
path: root/example-spring-boot
diff options
context:
space:
mode:
Diffstat (limited to 'example-spring-boot')
-rw-r--r--example-spring-boot/pom.xml24
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ContextRefreshedListener.java14
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/EmployeeServiceClient.java8
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ExampleClient.java7
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/SpringBootApp.java8
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/common/MsbHelper.java6
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/controller/EmployeeController.java9
-rw-r--r--example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/model/Employee.java17
8 files changed, 49 insertions, 44 deletions
diff --git a/example-spring-boot/pom.xml b/example-spring-boot/pom.xml
index be3ada7..07a02c2 100644
--- a/example-spring-boot/pom.xml
+++ b/example-spring-boot/pom.xml
@@ -2,11 +2,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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>
-
+
<parent>
- <groupId>org.onap.oparent</groupId>
- <artifactId>oparent</artifactId>
- <version>1.0.0-SNAPSHOT</version>
+ <groupId>org.onap.oparent</groupId>
+ <artifactId>oparent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>org.onap.msb.sdk</groupId>
@@ -34,30 +34,26 @@
</dependency>
</dependencies>
</dependencyManagement>
-
+
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
-
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.onap.msb.sdk</groupId>
+ <dependency>
+ <groupId>org.onap.msb.sdk</groupId>
<artifactId>msb-java-sdk</artifactId>
<version>1.0.0-SNAPSHOT</version>
- </dependency>
-
+ </dependency>
</dependencies>
<build>
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ContextRefreshedListener.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ContextRefreshedListener.java
index 9f3e532..2c4cc45 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ContextRefreshedListener.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ContextRefreshedListener.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -28,11 +30,11 @@ public class ContextRefreshedListener implements ApplicationListener<ContextRefr
MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
MsbHelper helper = new MsbHelper(msbClient);
-
+
try {
- helper.registerMsb();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ helper.registerMsb();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
} \ No newline at end of file
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/EmployeeServiceClient.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/EmployeeServiceClient.java
index 8017f04..1718517 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/EmployeeServiceClient.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/EmployeeServiceClient.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -19,6 +21,6 @@ import retrofit2.http.GET;
@ServiceHttpEndPoint(serviceName = "employee", serviceVersion = "v1")
public interface EmployeeServiceClient {
- @GET("employee")
- Call<Employee> queryEmployee();
+ @GET("employee")
+ Call<Employee> queryEmployee();
}
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ExampleClient.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ExampleClient.java
index ff0dee8..bce0d96 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ExampleClient.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/ExampleClient.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -17,7 +19,6 @@ import org.onap.msb.sdk.example.springboot.model.Employee;
import org.onap.msb.sdk.httpclient.RestServiceCreater;
import org.onap.msb.sdk.httpclient.msb.MSBServiceClient;
-
public class ExampleClient {
/**
@@ -26,7 +27,7 @@ public class ExampleClient {
*/
public static void main(String[] args) throws IOException {
//For real use case, MSB IP and Port should come from configuration file instead of hard code here
- String MSB_IP="192.168.0.110";
+ String MSB_IP="127.0.0.1";
int MSB_Port=10081;
MSBServiceClient msbClient = new MSBServiceClient(MSB_IP, MSB_Port);
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/SpringBootApp.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/SpringBootApp.java
index 4a37b58..8ba925d 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/SpringBootApp.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/SpringBootApp.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -16,9 +18,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootApp {
-
public static void main(String[] args) {
SpringApplication.run(SpringBootApp.class, args);
}
-}
-
+} \ No newline at end of file
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/common/MsbHelper.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/common/MsbHelper.java
index 9c1642c..ba28cba 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/common/MsbHelper.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/common/MsbHelper.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -38,7 +40,7 @@ public class MsbHelper {
msinfo.setUrl("/api/v1");
msinfo.setProtocol("REST");
msinfo.setVisualRange("0|1");
-
+
Set<Node> nodes = new HashSet<>();
Node node1 = new Node();
node1.setIp(InetAddress.getLocalHost().getHostAddress());
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/controller/EmployeeController.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/controller/EmployeeController.java
index 9223006..bed8bfa 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/controller/EmployeeController.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/controller/EmployeeController.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -13,9 +15,8 @@ package org.onap.msb.sdk.example.springboot.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-
-import org.onap.msb.sdk.example.springboot.model.Employee;;
-
+import org.onap.msb.sdk.example.springboot.model.Employee;
+
@RestController
public class EmployeeController {
@RequestMapping("/employee")
diff --git a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/model/Employee.java b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/model/Employee.java
index 43e6d88..f0076c2 100644
--- a/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/model/Employee.java
+++ b/example-spring-boot/src/main/java/org/onap/msb/sdk/example/springboot/model/Employee.java
@@ -1,9 +1,11 @@
/*******************************************************************************
* Copyright 2017 Infosys Limited and others.
- *------------------------------------------------------------------------------
+ *
* 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
+ *
* 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
@@ -12,25 +14,24 @@
package org.onap.msb.sdk.example.springboot.model;
import java.io.Serializable;
-
import com.fasterxml.jackson.annotation.JsonProperty;
public class Employee implements Serializable {
-
- private static final long serialVersionUID = 1L;
+
+ private static final long serialVersionUID = 1L;
@JsonProperty
private Integer id;
-
+
@JsonProperty
private String firstName;
-
+
@JsonProperty
private String lastName;
@JsonProperty
private String email;
-
+
public Employee() {}
public Employee(Integer id, String firstName, String lastName, String email) {
@@ -40,7 +41,7 @@ public class Employee implements Serializable {
this.lastName = lastName;
this.email = email;
}
-
+
public Integer getId() {
return id;
}