use of example.User in project elide by yahoo.
the class ResourceIT method setup.
@BeforeEach
public void setup() throws IOException {
dataStore.populateEntityDictionary(EntityDictionary.builder().build());
DataStoreTransaction tx = dataStore.beginTransaction();
final Company company = new Company();
company.setId("abc");
company.setDescription("ABC");
Address address = new Address();
address.setStreet1("foo");
address.setProperties(Map.of("boo", "baz"));
company.setAddress(address);
tx.createObject(company, null);
// id 1
Parent parent = new Parent();
// id 1
Child child = new Child();
parent.setChildren(Sets.newHashSet(child));
parent.setSpouses(Sets.newHashSet());
child.setParents(Sets.newHashSet(parent));
tx.createObject(parent, null);
tx.createObject(child, null);
// Single tests
// id 2
Parent p1 = new Parent();
p1.setFirstName("John");
p1.setSpouses(Sets.newHashSet());
// id 2
Child c1 = new Child();
c1.setName("Child-ID2");
c1.setParents(Sets.newHashSet(p1));
// id 3
Child c2 = new Child();
c2.setName("Child-ID3");
c2.setParents(Sets.newHashSet(p1));
Set<Child> friendSet = new HashSet<>();
friendSet.add(c2);
c1.setFriends(friendSet);
Set<Child> childrenSet1 = new HashSet<>();
childrenSet1.add(c1);
childrenSet1.add(c2);
p1.setChildren(childrenSet1);
// List tests
// id 3
Parent p2 = new Parent();
// id 4
Parent p3 = new Parent();
// id 4
Child c3 = new Child();
c3.setParents(Sets.newHashSet(p2));
// id 5
Child c4 = new Child();
c4.setParents(Sets.newHashSet(p2));
Set<Child> childrenSet2 = new HashSet<>();
childrenSet2.add(c3);
childrenSet2.add(c4);
p2.setChildren(childrenSet2);
p2.setFirstName("Link");
p3.setFirstName("Unknown");
p2.setSpouses(Sets.newHashSet());
p3.setSpouses(Sets.newHashSet(p2));
p3.setChildren(Sets.newHashSet());
tx.createObject(c1, null);
tx.createObject(c2, null);
tx.createObject(c3, null);
tx.createObject(c4, null);
tx.createObject(p1, null);
tx.createObject(p2, null);
tx.createObject(p3, null);
Book bookWithPercentage = new Book();
bookWithPercentage.setTitle("titlewith%percentage");
Book bookWithoutPercentage = new Book();
bookWithoutPercentage.setTitle("titlewithoutpercentage");
tx.createObject(bookWithPercentage, null);
tx.createObject(bookWithoutPercentage, null);
FunWithPermissions fun = new FunWithPermissions();
tx.createObject(fun, null);
// ID 1
User user = new User();
user.setPassword("god");
tx.createObject(user, null);
Invoice invoice = new Invoice();
invoice.setId(1);
LineItem item = new LineItem();
invoice.setItems(Sets.newHashSet(item));
item.setInvoice(invoice);
tx.createObject(invoice, null);
tx.createObject(item, null);
ExceptionThrowingBean etb = new ExceptionThrowingBean();
etb.setId(1L);
tx.createObject(etb, null);
tx.commit(null);
tx.close();
}
use of example.User in project elide by yahoo.
the class ResourceIT method elideSecurityEnabled.
@Test
public void elideSecurityEnabled() {
Elide elide = new Elide(new ElideSettingsBuilder(dataStore).withEntityDictionary(EntityDictionary.builder().checks(TestCheckMappings.MAPPINGS).build()).withAuditLogger(new TestAuditLogger()).build());
elide.doScans();
com.yahoo.elide.core.security.User user = new com.yahoo.elide.core.security.User(() -> "-1");
ElideResponse response = elide.get(baseUrl, "parent/1/children", new MultivaluedHashMap<>(), user, NO_VERSION);
assertEquals(HttpStatus.SC_OK, response.getResponseCode());
assertEquals("{\"data\":[]}", response.getBody());
}
Aggregations