示例#1
0
 @Test
 public void uuidFunctions() throws IOException {
   ServiceLocator locator = container;
   CompositeRepository repository = locator.resolve(CompositeRepository.class);
   UUID id = UUID.randomUUID();
   String uri = repository.insert(new Composite().setId(id));
   Composite found =
       repository.query().filter(it -> it.getId().toString().equals(uri)).findAny().get();
   Assert.assertEquals(id, found.getId());
   found =
       repository.query().filter(it -> UUID.fromString(it.getURI()).equals(id)).findAny().get();
   Assert.assertEquals(id, found.getId());
 }
示例#2
0
 @Test
 public void sendDomainObjectAsArgument() throws IOException {
   ServiceLocator locator = container;
   CompositeRepository repository = locator.resolve(CompositeRepository.class);
   UUID id = UUID.randomUUID();
   Random rnd = new Random();
   int next = rnd.nextInt(100000);
   repository.insert(
       new Composite().setId(id).setSimple(new Simple().setEn(En.A).setNumber(next)));
   Simple simple = new Simple().setEn(En.A).setNumber(next);
   Composite found =
       repository
           .query()
           .filter(it -> it.getSimple().getNumber() == simple.getNumber())
           .sortedBy(it -> it.getId())
           .findFirst()
           .get();
   Assert.assertEquals(id, found.getId());
 }