@Test public void add_multi_value_attributes() { createFullUser("ama"); createUpdateUserWithMultiAddFields(); updateUser(); assertEquals(testUser.getPhoneNumbers().size() + 1, returnUser.getPhoneNumbers().size()); assertTrue(isValuePartOfPhoneNumberList(returnUser.getPhoneNumbers(), "99999999991")); assertEquals(testUser.getEmails().size() + 1, returnUser.getEmails().size()); assertTrue(isValuePartOfEmailList(returnUser.getEmails(), "*****@*****.**")); assertEquals(testUser.getAddresses().size() + 1, returnUser.getAddresses().size()); getAddress(returnUser.getAddresses(), "new Address"); assertEquals(testUser.getEntitlements().size() + 1, returnUser.getEntitlements().size()); assertTrue(isValuePartOfEntitlementList(returnUser.getEntitlements(), "right3")); assertEquals(testUser.getIms().size() + 1, returnUser.getIms().size()); assertTrue(isValuePartOfImList(returnUser.getIms(), "ims03")); assertEquals(testUser.getPhotos().size() + 1, returnUser.getPhotos().size()); URI uri = null; try { uri = new URI("photo03.jpg"); } catch (Exception e) { } assertTrue(isValuePartOfPhotoList(returnUser.getPhotos(), uri)); assertEquals(testUser.getRoles().size() + 1, returnUser.getRoles().size()); assertTrue(isValuePartOfRoleList(returnUser.getRoles(), "role03")); assertEquals( testUser.getX509Certificates().size() + 1, returnUser.getX509Certificates().size()); assertTrue(isValuePartOfX509CertificateList(returnUser.getX509Certificates(), "certificate03")); }
@Test public void List_Deep_Keys() { User u = where(user.firstName.eq("Jaakko")).singleResult(user.addresses.any().street); for (Address a : u.getAddresses()) { assertNotNull(a.street); assertNull(a.city); } }
@Test public void delete_all_multi_value_attributes() { createFullUser("dama"); createUpdateUserWithMultiAllDeleteFields(); updateUser(); assertThat(returnUser.getEmails(), is(empty())); assertThat(returnUser.getAddresses(), is(empty())); assertThat(returnUser.getEntitlements(), is(empty())); assertThat(returnUser.getIms(), is(empty())); assertThat(returnUser.getPhoneNumbers(), is(empty())); assertThat(returnUser.getPhotos(), is(empty())); assertThat(returnUser.getRoles(), is(empty())); assertThat(returnUser.getX509Certificates(), is(empty())); }
@Test public void delete_multi_value_attributes() { createFullUser("dma"); createUpdateUserWithMultiDeleteFields(); updateUser(); assertFalse(isValuePartOfEmailList(returnUser.getEmails(), "*****@*****.**")); assertFalse(isValuePartOfPhoneNumberList(returnUser.getPhoneNumbers(), "0245817964")); assertFalse(isValuePartOfImList(returnUser.getIms(), "ims01")); URI uri = null; try { uri = new URI("photo01.jpg"); } catch (Exception e) { } assertFalse(isValuePartOfPhotoList(returnUser.getPhotos(), uri)); assertFalse(isValuePartOfRoleList(returnUser.getRoles(), "role01")); assertFalse(isValuePartOfAddressList(returnUser.getAddresses(), "formated address 01")); assertFalse(isValuePartOfEntitlementList(returnUser.getEntitlements(), "right2")); assertFalse( isValuePartOfX509CertificateList(returnUser.getX509Certificates(), "certificate01")); }