ServiceTest.java
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 Google Inc.
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00005  * use this file except in compliance with the License. You may obtain a copy of
00006  * the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
00013  * License for the specific language governing permissions and limitations under
00014  * the License.
00015  */
00016 
00017 package org.ros.internal.message;
00018 
00019 import org.junit.Before;
00020 import org.junit.Test;
00021 import org.ros.internal.message.service.ServiceDefinitionResourceProvider;
00022 import org.ros.internal.message.service.ServiceRequestMessageFactory;
00023 import org.ros.internal.message.service.ServiceResponseMessageFactory;
00024 
00028 public class ServiceTest {
00029 
00030   private ServiceDefinitionResourceProvider serviceDefinitionResourceProvider;
00031   private ServiceRequestMessageFactory serviceRequestMessageFactory;
00032   private ServiceResponseMessageFactory serviceResponseMessageFactory;
00033 
00034   @Before
00035   public void setUp() {
00036     serviceDefinitionResourceProvider = new ServiceDefinitionResourceProvider();
00037     serviceDefinitionResourceProvider.add("foo/Echo", "string data\n---\nstring data");
00038     serviceRequestMessageFactory =
00039         new ServiceRequestMessageFactory(serviceDefinitionResourceProvider);
00040     serviceResponseMessageFactory =
00041         new ServiceResponseMessageFactory(serviceDefinitionResourceProvider);
00042   }
00043 
00044   @Test
00045   public void testCreateEchoService() {
00046     RawMessage request = serviceRequestMessageFactory.newFromType("foo/Echo");
00047     RawMessage response = serviceResponseMessageFactory.newFromType("foo/Echo");
00048     request.setString("data", "Hello, ROS!");
00049     response.setString("data", "Hello, ROS!");
00050   }
00051 }


rosjava_core
Author(s):
autogenerated on Wed Aug 26 2015 16:06:49