本文整理汇总了Java中com.packtpub.mmj.restaurant.domain.valueobject.RestaurantVO类的典型用法代码示例。如果您正苦于以下问题:Java RestaurantVO类的具体用法?Java RestaurantVO怎么用?Java RestaurantVO使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RestaurantVO类属于com.packtpub.mmj.restaurant.domain.valueobject包,在下文中一共展示了RestaurantVO类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import com.packtpub.mmj.restaurant.domain.valueobject.RestaurantVO; //导入依赖的package包/类
/**
* Add restaurant with the specified information.
*
* @param restaurantVO
* @return A non-null restaurant.
*/
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Restaurant> add(@RequestBody RestaurantVO restaurantVO) {
logger.info(String.format("restaurant-service add() invoked: %s for %s", restaurantService.getClass().getName(), restaurantVO.getName()));
System.out.println(restaurantVO);
Restaurant restaurant = new Restaurant(null, null, null, null);
BeanUtils.copyProperties(restaurantVO, restaurant);
try {
restaurantService.add(restaurant);
} catch (Exception ex) {
logger.log(Level.WARNING, "Exception raised add Restaurant REST Call {0}", ex);
return new ResponseEntity<>(HttpStatus.UNPROCESSABLE_ENTITY);
}
return new ResponseEntity<>(HttpStatus.CREATED);
}
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:21,代码来源:RestaurantController.java
示例2: validAdd
import com.packtpub.mmj.restaurant.domain.valueobject.RestaurantVO; //导入依赖的package包/类
/**
* Test method for add method
*/
@Test
public void validAdd() {
Logger.getGlobal().info("Start validAdd test");
RestaurantVO restaurant = new RestaurantVO();
restaurant.setId("999");
restaurant.setName("Test Restaurant");
ResponseEntity<Restaurant> restaurants = restaurantController.add(restaurant);
Assert.assertEquals(HttpStatus.CREATED, restaurants.getStatusCode());
Logger.getGlobal().info("End validAdd test");
}
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:15,代码来源:AbstractRestaurantControllerTests.java