Пример #1
0
 @Test(expected = NotFoundException.class)
 @Transactional
 public void testSetTransientPropertyFieldNotManaged() {
   Person p = new Person("Michael", 35);
   p.setThought("food");
   p.getUnderlyingState().getProperty("Person.thought");
 }
Пример #2
0
 @Test
 @Transactional
 public void testGetTransientPropertyFieldNotManaged() {
   Person p = new Person("Michael", 35);
   p.setThought("food");
   p.getUnderlyingState().setProperty("Person.thought", "sleep");
   assertEquals("Should not have read transient value from graph.", "food", p.getThought());
 }
Пример #3
0
 @Test
 @Transactional
 public void testGetPropertyEnum() {
   Person p = new Person("Michael", 35);
   p.getUnderlyingState().setProperty("Person.personality", "EXTROVERT");
   assertEquals(
       "Did not deserialize property value properly.", Personality.EXTROVERT, p.getPersonality());
 }
Пример #4
0
 @Test
 @Transactional
 public void testRelationshipGetPropertyDate() {
   Person p = new Person("Michael", 35);
   Person p2 = new Person("David", 25);
   Friendship f = p.knows(p2);
   f.getUnderlyingState().setProperty("Friendship.firstMeetingDate", "3");
   assertEquals("Date not deserialized properly.", new Date(3), f.getFirstMeetingDate());
 }
Пример #5
0
 // Would like to have this working.
 @Ignore
 @Test
 @Transactional
 public void testRelationshipIdField() {
   Person p = new Person("Michael", 35);
   Person p2 = new Person("David", 25);
   Friendship f = p.knows(p2);
   //		assertEquals("Wrong ID.", f.getUnderlyingState().getId(), f.getId());
 }
Пример #6
0
 @Test(expected = NotFoundException.class)
 @Transactional
 public void testRelationshipSetTransientPropertyFieldNotManaged() {
   Person p = new Person("Michael", 35);
   Person p2 = new Person("David", 25);
   Friendship f = p.knows(p2);
   f.setLatestLocation("Menlo Park");
   f.getUnderlyingState().getProperty("Friendship.latestLocation");
 }
Пример #7
0
 @Test
 @Transactional
 public void testSetPropertyEnum() {
   Person p = new Person("Michael", 35);
   p.setPersonality(Personality.EXTROVERT);
   assertEquals(
       "Wrong enum serialization.",
       "EXTROVERT",
       p.getUnderlyingState().getProperty("Person.personality"));
 }
Пример #8
0
 @Test
 @Transactional
 public void testRelationshipGetTransientPropertyFieldNotManaged() {
   Person p = new Person("Michael", 35);
   Person p2 = new Person("David", 25);
   Friendship f = p.knows(p2);
   f.setLatestLocation("Menlo Park");
   f.getUnderlyingState().setProperty("Friendship.latestLocation", "Palo Alto");
   assertEquals(
       "Should not have read transient value from graph.", "Menlo Park", f.getLatestLocation());
 }
Пример #9
0
 @Test
 @Transactional
 public void testEntityIdField() {
   Person p = new Person("Michael", 35);
   assertEquals("Wrong ID.", p.getUnderlyingState().getId(), p.getId());
 }