com.ewolff.microservice.order.clients.Item Java Examples

The following examples show how to use com.ewolff.microservice.order.clients.Item. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringRestDataConfig.java    From microservice-kubernetes with Apache License 2.0 5 votes vote down vote up
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

	return new RepositoryRestConfigurerAdapter() {
		@Override
		public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
			config.exposeIdsFor(Order.class, Item.class, Customer.class);
		}
	};
}
 
Example #2
Source File: CatalogConsumerDrivenContractTest.java    From microservice with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetOne() {
	Collection<Item> allItems = catalogClient.findAll();
	Long id = allItems.iterator().next().getItemId();
	Item result = catalogClient.getOne(id);
	assertEquals(id.longValue(), result.getItemId());
}
 
Example #3
Source File: CatalogStub.java    From microservice with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Item> getById(@PathVariable("id") long id) {
	if (id != 1) {
		return new ResponseEntity<Item>(HttpStatus.NOT_FOUND);
	}
	return new ResponseEntity<Item>(new Item(1, "iPod", 42.0),
			HttpStatus.OK);
}
 
Example #4
Source File: SpringRestDataConfig.java    From microservice with Apache License 2.0 5 votes vote down vote up
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

	return new RepositoryRestConfigurerAdapter() {
		@Override
		public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
			config.exposeIdsFor(Order.class, Item.class, Customer.class);
		}
	};
}
 
Example #5
Source File: CatalogConsumerDrivenContractTest.java    From microservice-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetOne() {
	Collection<Item> allItems = catalogClient.findAll();
	Long id = allItems.iterator().next().getItemId();
	Item result = catalogClient.getOne(id);
	assertEquals(id.longValue(), result.getItemId());
}
 
Example #6
Source File: CatalogConsumerDrivenContractTest.java    From microservice-consul with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindAll() {
	Collection<Item> result = catalogClient.findAll();
	assertEquals(
			1,
			result.stream()
					.filter(i -> (i.getName().equals("iPod")
							&& i.getPrice() == 42.0 && i.getItemId() == 1))
					.count());
}
 
Example #7
Source File: CatalogStub.java    From microservice-consul with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Item> getById(@PathVariable("id") long id) {
	if (id != 1) {
		return new ResponseEntity<Item>(HttpStatus.NOT_FOUND);
	}
	return new ResponseEntity<Item>(new Item(1, "iPod", 42.0),
			HttpStatus.OK);
}
 
Example #8
Source File: SpringRestDataConfig.java    From microservice-consul with Apache License 2.0 5 votes vote down vote up
@Bean
public RepositoryRestConfigurer repositoryRestConfigurer() {

	return new RepositoryRestConfigurerAdapter() {
		@Override
		public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
			config.exposeIdsFor(Order.class, Item.class, Customer.class);
		}
	};
}
 
Example #9
Source File: CatalogConsumerDrivenContractTest.java    From microservice-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetOne() {
	Collection<Item> allItems = catalogClient.findAll();
	Long id = allItems.iterator().next().getItemId();
	Item result = catalogClient.getOne(id);
	assertEquals(id.longValue(), result.getItemId());
}
 
Example #10
Source File: CatalogConsumerDrivenContractTest.java    From microservice-kubernetes with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindAll() {
	Collection<Item> result = catalogClient.findAll();
	assertEquals(
			1,
			result.stream()
					.filter(i -> (i.getName().equals("iPod")
							&& i.getPrice() == 42.0 && i.getItemId() == 1))
					.count());
}
 
Example #11
Source File: CatalogStub.java    From microservice-kubernetes with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<Item> getById(@PathVariable("id") long id) {
	if (id != 1) {
		return new ResponseEntity<Item>(HttpStatus.NOT_FOUND);
	}
	return new ResponseEntity<Item>(new Item(1, "iPod", 42.0),
			HttpStatus.OK);
}
 
Example #12
Source File: OrderController.java    From microservice-consul with Apache License 2.0 4 votes vote down vote up
@ModelAttribute("items")
public Collection<Item> items() {
	return catalogClient.findAll();
}
 
Example #13
Source File: CatalogStub.java    From microservice-consul with Apache License 2.0 4 votes vote down vote up
@RequestMapping(method = RequestMethod.GET)
public PagedResources<Item> getAll() {
	return new PagedResources<Item>(
			Arrays.asList(new Item(1, "iPod", 42.0)), new PageMetadata(1,
					0, 1));
}
 
Example #14
Source File: OrderController.java    From microservice with Apache License 2.0 4 votes vote down vote up
@ModelAttribute("items")
public Collection<Item> items() {
	return catalogClient.findAll();
}
 
Example #15
Source File: CatalogStub.java    From microservice-kubernetes with Apache License 2.0 4 votes vote down vote up
@RequestMapping(method = RequestMethod.GET)
public PagedModel<Item> getAll() {
	return new PagedModel<Item>(
			Arrays.asList(new Item(1, "iPod", 42.0)), new PageMetadata(1,
					0, 1));
}
 
Example #16
Source File: CatalogStub.java    From microservice with Apache License 2.0 4 votes vote down vote up
@RequestMapping(method = RequestMethod.GET)
public PagedModel<Item> getAll() {
	return new PagedModel<Item>(
			Arrays.asList(new Item(1, "iPod", 42.0)), new PageMetadata(1,
					0, 1));
}
 
Example #17
Source File: CatalogConsumerDrivenContractTest.java    From microservice with Apache License 2.0 4 votes vote down vote up
@Test
public void testFindAll() {
	Collection<Item> result = catalogClient.findAll();
	assertEquals(1, result.stream()
			.filter(i -> (i.getName().equals("iPod") && i.getPrice() == 42.0 && i.getItemId() == 1)).count());
}
 
Example #18
Source File: OrderController.java    From microservice-kubernetes with Apache License 2.0 4 votes vote down vote up
@ModelAttribute("items")
public Collection<Item> items() {
	return catalogClient.findAll();
}