2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (c) 2017 AT&T Intellectual Property
6 * ===================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 * ============LICENSE_END=============================================
20 * ====================================================================
22 package org.onap.music.rest;
24 import java.util.HashMap;
27 import javax.servlet.http.HttpServletResponse;
28 import javax.ws.rs.GET;
29 import javax.ws.rs.Path;
30 import javax.ws.rs.Produces;
31 import javax.ws.rs.core.Context;
32 import javax.ws.rs.core.MediaType;
34 import org.onap.music.main.MusicUtil;
36 import com.att.eelf.configuration.EELFLogger;
37 import com.att.eelf.configuration.EELFManager;
39 import io.swagger.annotations.Api;
40 import io.swagger.annotations.ApiOperation;
43 @Path("/v{version: [0-9]+}/test")
44 @Api(value="Test Api")
45 public class RestMusicTestAPI {
46 private static EELFLogger logger = EELFManager.getInstance().getLogger(RestMusicTestAPI.class);
49 * Returns a test JSON. This will confirm that REST is working.
53 @ApiOperation(value = "Get Test", response = Map.class)
54 @Produces(MediaType.APPLICATION_JSON)
55 public Map<String, HashMap<String, String>> simpleTests(
56 @Context HttpServletResponse response) {
57 response.addHeader("X-latestVersion",MusicUtil.getVersion());
58 Map<String, HashMap<String, String>> testMap = new HashMap<>();
59 for(int i=0; i < 3; i++){
60 HashMap<String, String> innerMap = new HashMap<>();
61 innerMap.put(i+"", i+1+"");
62 innerMap.put(i+1+"", i+2+"");
63 testMap.put(i+"", innerMap);