Lines 56-64
Link Here
|
56 |
{ |
56 |
{ |
57 |
// Client1 |
57 |
// Client1 |
58 |
CDOResource resource1 = transaction1.createResource("/test1"); |
58 |
CDOResource resource1 = transaction1.createResource("/test1"); |
|
|
59 |
|
59 |
Company company1 = Model1Factory.eINSTANCE.createCompany(); |
60 |
Company company1 = Model1Factory.eINSTANCE.createCompany(); |
60 |
resource1.getContents().add(company1); |
|
|
61 |
Category category1 = Model1Factory.eINSTANCE.createCategory(); |
61 |
Category category1 = Model1Factory.eINSTANCE.createCategory(); |
|
|
62 |
|
63 |
resource1.getContents().add(company1); |
62 |
company1.getCategories().add(category1); |
64 |
company1.getCategories().add(category1); |
63 |
transaction1.commit(); |
65 |
transaction1.commit(); |
64 |
|
66 |
|
Lines 66-71
Link Here
|
66 |
CDOResource resource2 = transaction2.getResource("/test1"); |
68 |
CDOResource resource2 = transaction2.getResource("/test1"); |
67 |
Company company2 = (Company)resource2.getContents().get(0); |
69 |
Company company2 = (Company)resource2.getContents().get(0); |
68 |
Category category2 = company2.getCategories().get(0); |
70 |
Category category2 = company2.getCategories().get(0); |
|
|
71 |
|
72 |
company2.setName("company2"); |
69 |
category2.setName("client2"); |
73 |
category2.setName("client2"); |
70 |
|
74 |
|
71 |
// Client1 |
75 |
// Client1 |
Lines 90-105
Link Here
|
90 |
assertEquals(false, transaction2.isDirty()); |
94 |
assertEquals(false, transaction2.isDirty()); |
91 |
assertEquals(false, transaction2.hasConflict()); |
95 |
assertEquals(false, transaction2.hasConflict()); |
92 |
assertEquals("client1", category2.getName()); |
96 |
assertEquals("client1", category2.getName()); |
|
|
97 |
assertEquals(null, company2.getName()); |
98 |
{ |
99 |
CDOTransaction transaction3 = createNewTransaction(); |
100 |
CDOResource resource3 = transaction3.getResource("/test1"); |
101 |
Company company3 = (Company)resource3.getContents().get(0); |
102 |
Category category3 = company3.getCategories().get(0); |
103 |
assertEquals(null, company3.getName()); |
104 |
assertEquals("client1", category3.getName()); |
105 |
transaction3.close(); |
106 |
transaction3.getSession().close(); |
107 |
} |
108 |
|
93 |
category2.setName("client2"); |
109 |
category2.setName("client2"); |
|
|
110 |
company2.setName("company2"); |
111 |
|
94 |
transaction2.commit(); |
112 |
transaction2.commit(); |
95 |
assertEquals(false, transaction2.isDirty()); |
113 |
assertEquals(false, transaction2.isDirty()); |
96 |
assertEquals(false, transaction2.hasConflict()); |
114 |
assertEquals(false, transaction2.hasConflict()); |
|
|
115 |
assertEquals("company2", company2.getName()); |
97 |
assertEquals("client2", category2.getName()); |
116 |
assertEquals("client2", category2.getName()); |
98 |
sleep(500); |
117 |
sleep(500); |
99 |
|
118 |
|
|
|
119 |
{ |
120 |
CDOTransaction transaction3 = createNewTransaction(); |
121 |
CDOResource resource3 = transaction3.getResource("/test1"); |
122 |
Company company3 = (Company)resource3.getContents().get(0); |
123 |
Category category3 = company3.getCategories().get(0); |
124 |
assertEquals("company2", company3.getName()); |
125 |
assertEquals("client2", category3.getName()); |
126 |
transaction3.close(); |
127 |
transaction3.getSession().close(); |
128 |
} |
129 |
|
100 |
// Client1 |
130 |
// Client1 |
101 |
assertEquals(false, transaction1.isDirty()); |
131 |
assertEquals(false, transaction1.isDirty()); |
102 |
assertEquals(false, transaction1.hasConflict()); |
132 |
assertEquals(false, transaction1.hasConflict()); |
103 |
assertEquals("client2", category1.getName()); |
133 |
assertEquals("client2", category1.getName()); |
|
|
134 |
assertEquals("company2", company1.getName()); |
135 |
} |
136 |
|
137 |
private CDOTransaction createNewTransaction() |
138 |
{ |
139 |
CDOSession session = CDOUtil.openSession(getConnector(), REPOSITORY_NAME); |
140 |
session.getPackageRegistry().putEPackage(Model1Package.eINSTANCE); |
141 |
return session.openTransaction(); |
104 |
} |
142 |
} |
105 |
} |
143 |
} |