コード例 #1
0
 @Test
 public void testDeleteServerById() throws PhrescoException {
   String id = "2c909c4836f2bb7b0136f2bba6db0003";
   serviceManager = ServiceClientFactory.getServiceManager(context);
   RestClient<Server> databaseClient =
       serviceManager.getRestClient(RestResourceURIs.REST_API_SERVERS);
   databaseClient.delete(id);
 }
コード例 #2
0
 @Before
 public void setUp() throws PhrescoException {
   // String serviceURL = "http://172.16.25.196:3030/service/rest/api";
   //		String serviceURL = "http://172.16.25.44:8081/service/rest/api";
   String serviceURL = "http://172.16.17.117:7070/service-3/rest/api";
   String userName = "******";
   String password = "******";
   ServiceContext context = new ServiceContext();
   context.put("phresco.service.url", serviceURL);
   context.put("phresco.service.username", userName);
   context.put("phresco.service.password", password);
   serviceManager = ServiceClientFactory.getServiceManager(context);
 }
コード例 #3
0
 @Ignore
 public void testPostServer() throws PhrescoException {
   List<Server> servers = new ArrayList<Server>();
   Server server = new Server();
   server.setName("hello");
   server.setDescription("tomcat");
   servers.add(server);
   serviceManager = ServiceClientFactory.getServiceManager(context);
   String ServerJson = new Gson().toJson(servers);
   RestClient<Server> ServerClient =
       serviceManager.getRestClient(RestResourceURIs.REST_API_SERVERS);
   ServerClient.setAccept(MediaType.APPLICATION_JSON);
   ServerClient.setType(MediaType.APPLICATION_JSON);
   ServerClient.create(ServerJson);
 }
コード例 #4
0
 @Ignore
 public void testGetServer() {
   try {
     serviceManager = ServiceClientFactory.getServiceManager(context);
     RestClient<Server> customerClient =
         serviceManager.getRestClient(RestResourceURIs.REST_API_SERVERS);
     customerClient.setType(MediaType.APPLICATION_JSON);
     GenericType<List<Server>> genericType = new GenericType<List<Server>>() {};
     List<Server> list = customerClient.get(genericType);
     for (Server Server : list) {
       System.out.println("Server Name == " + Server.getName());
     }
   } catch (PhrescoException e) {
     e.printStackTrace();
   }
 }
コード例 #5
0
 @Ignore
 public void testGetServerById() throws PhrescoException {
   try {
     String id = "2c909c4836f2bb7b0136f2bba6db0003";
     serviceManager = ServiceClientFactory.getServiceManager(context);
     RestClient<Server> ServerClient =
         serviceManager.getRestClient(RestResourceURIs.REST_API_SERVERS);
     ServerClient.setType(MediaType.APPLICATION_JSON);
     GenericType<List<Server>> genericType = new GenericType<List<Server>>() {};
     List<Server> list = ServerClient.get(genericType);
     for (Server Server : list) {
       System.out.println("name == " + Server.getName());
     }
   } catch (PhrescoException e) {
     e.printStackTrace();
   }
 }
コード例 #6
0
 @Ignore
 public void testPutServer() throws PhrescoException {
   String id = "2c909c4836f2bb7b0136f2bba6db0003";
   List<Server> servers = new ArrayList<Server>();
   Server server = new Server();
   server.setName("Local Server");
   server.setDescription("Apache tomcat");
   servers.add(server);
   server.setId(id);
   serviceManager = ServiceClientFactory.getServiceManager(context);
   String ServerJson = new Gson().toJson(servers);
   RestClient<Server> ServerClient =
       serviceManager.getRestClient(RestResourceURIs.REST_API_SERVERS);
   ServerClient.setAccept(MediaType.APPLICATION_JSON);
   ServerClient.setType(MediaType.APPLICATION_JSON);
   ServerClient.update(ServerJson);
 }