Inside the wlpcfg project there is the it.springboot.security.HelloControllerTest that will test the Spring WebSocket endpoint to ensure it is working.
+
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/Application.java b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/Application.java
new file mode 100644
index 0000000..23eb45c
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/Application.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package application.springboot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.web.SpringBootServletInitializer;
+
+
+@SpringBootApplication
+
+public class Application extends SpringBootServletInitializer {
+
+ @Override
+ protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
+ return application.sources(Application.class);
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+}
\ No newline at end of file
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/MvcConfig.java b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/MvcConfig.java
new file mode 100644
index 0000000..8e9cec0
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/MvcConfig.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package application.springboot.websocket;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class MvcConfig extends WebMvcConfigurerAdapter {
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry) {
+ registry.addViewController("/springbootwebsocket").setViewName("websocketsample");
+ }
+
+}
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/SystemWebSocketHandler.java b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/SystemWebSocketHandler.java
new file mode 100644
index 0000000..435bd1a
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/SystemWebSocketHandler.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package application.springboot.websocket;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.apache.log4j.spi.LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.core.Constants;
+import org.springframework.web.socket.CloseStatus;
+import org.springframework.web.socket.TextMessage;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.WebSocketMessage;
+import org.springframework.web.socket.WebSocketSession;
+
+public class SystemWebSocketHandler implements WebSocketHandler {
+
+
+ @Override
+ public void afterConnectionEstablished(WebSocketSession session) throws Exception {
+
+ session.sendMessage(new TextMessage("Connection Established successfully!"));
+
+ }
+
+ @Override
+ public void handleMessage(WebSocketSession session, WebSocketMessage> message) throws Exception {
+
+ session.sendMessage(new TextMessage("Hello from server!"));
+ }
+
+ @Override
+ public void handleTransportError(WebSocketSession session, Throwable exception) throws Exception {
+
+ }
+
+ @Override
+ public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
+
+
+ }
+
+ @Override
+ public boolean supportsPartialMessages() {
+ return false;
+ }
+
+}
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/WebSocketConfig.java b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/WebSocketConfig.java
new file mode 100644
index 0000000..d20bc0d
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/java/application/springboot/websocket/WebSocketConfig.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package application.springboot.websocket;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.messaging.simp.config.MessageBrokerRegistry;
+import org.springframework.web.socket.WebSocketHandler;
+import org.springframework.web.socket.config.annotation.EnableWebSocket;
+import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
+import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
+import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
+import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
+
+@Configuration
+@EnableWebSocket
+public class WebSocketConfig implements WebSocketConfigurer {
+ @Override
+ public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
+ registry.addHandler(systemWebSocketHandler(),"/webSocketServer");
+ }
+
+ @Bean
+ public WebSocketHandler systemWebSocketHandler(){
+ return new SystemWebSocketHandler();
+ }
+
+
+
+}
+
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/application.properties b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/application.properties
new file mode 100644
index 0000000..409b428
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/application.properties
@@ -0,0 +1 @@
+server.contextPath=/myLibertyApp
\ No newline at end of file
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/templates/websocketsample.html b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/templates/websocketsample.html
new file mode 100644
index 0000000..b0a86be
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-application/src/main/resources/templates/websocketsample.html
@@ -0,0 +1,60 @@
+
+
+
+ WebSocket Stomp Receiving Example
+
+
+
Welcome to Spring WebSocket!
+
+ The text you type in will get sent to the server application using WebSockets.
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-wlpcfg/src/test/java/it/springboot/websocket/HelloControllerTest.java b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-wlpcfg/src/test/java/it/springboot/websocket/HelloControllerTest.java
new file mode 100644
index 0000000..23be95e
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/main/webapp/sample/myProject-wlpcfg/src/test/java/it/springboot/websocket/HelloControllerTest.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package it.springboot.websocket;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Response;
+import it.EndpointTest;
+
+import org.junit.Test;
+
+public class HelloControllerTest extends EndpointTest {
+
+
+ @Test
+ public void testDeployment() {
+ testEndpoint("/springbootwebsocket", "Welcome to Spring WebSocket!");
+ }
+}
\ No newline at end of file
diff --git a/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/EndpointTest.java b/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/EndpointTest.java
new file mode 100644
index 0000000..02f80bd
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/EndpointTest.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package com.ibm.liberty.starter.service.springboot.api.v1.it;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Response;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class EndpointTest {
+
+ //use this to give the REST endpoint a chance to come up after the server has reported it's started
+ public void checkAvailability(String endpoint) {
+ String ep = getEndPoint(endpoint);
+ for(int x = 0; x < 3; x++) {
+ Response response = null;
+ try {
+ response = sendRequest(ep, "GET");
+ if(response.getStatus() == 200) {
+ return;
+ }
+ } finally {
+ if(response != null) {
+ response.close();
+ }
+ }
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ //just exit
+ }
+ }
+ }
+
+ private String getEndPoint(String endpoint) {
+ String port = System.getProperty("liberty.test.port");
+ String war = System.getProperty("war.name");
+ return "http://localhost:" + port + "/" + war + endpoint;
+ }
+
+ @SuppressWarnings("unchecked")
+ public T testEndpoint(String endpoint, Class> entity) throws Exception {
+ String url = getEndPoint(endpoint);
+ System.out.println("Testing " + url);
+ Response response = null;
+ try {
+ response = sendRequest(url, "GET");
+ int responseCode = response.getStatus();
+ assertTrue("Incorrect response code for " + url + ": " + responseCode,
+ responseCode == 200);
+ String json = response.readEntity(String.class);
+ ObjectMapper mapper = new ObjectMapper();
+ return (T) mapper.readValue(json, entity);
+ } finally {
+ if(response != null) {
+ response.close();
+ }
+ }
+ }
+
+ public Response sendRequest(String url, String requestType) {
+ Client client = ClientBuilder.newClient();
+ System.out.println("Testing " + url);
+ WebTarget target = client.target(url);
+ Invocation.Builder invoBuild = target.request();
+ Response response = invoBuild.build(requestType).invoke();
+ return response;
+ }
+}
diff --git a/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/TestApplication.java b/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/TestApplication.java
new file mode 100644
index 0000000..4e4242a
--- /dev/null
+++ b/starter-microservice-springboot-websocket/src/test/java/com/ibm/liberty/starter/service/springboot/websocket/api/v1/it/TestApplication.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corp.
+ *
+ * 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 the License.
+ *******************************************************************************/
+package com.ibm.liberty.starter.service.springboot.api.v1.it;
+
+import static org.junit.Assert.*;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.ibm.liberty.starter.api.v1.model.provider.Dependency;
+import com.ibm.liberty.starter.api.v1.model.provider.Provider;
+import com.ibm.liberty.starter.api.v1.model.provider.Sample;
+import com.ibm.liberty.starter.api.v1.model.provider.ServerConfig;
+
+/**
+ * Test the deployed service responds as expected
+ *
+ */
+public class TestApplication extends EndpointTest {
+
+ @Before
+ public void checkSetup() {
+ checkAvailability("/api/v1/provider/");
+ }
+
+ @Test
+ public void testProvider() throws Exception {
+ Provider provider = testEndpoint("/api/v1/provider/", Provider.class);
+ assertNotNull("No response from API for provider", provider);
+ assertTrue("Description was not found.", provider.getDescription().contains("