use of au.gov.asd.tac.constellation.graph.WritableGraph in project constellation by constellation-app.
the class NestedLockingNGTest method unmodifiedRollbackControlTest.
@Test
public void unmodifiedRollbackControlTest() {
final DualGraph g = new DualGraph(null);
try {
// Get the first write lock, modify the graph, then commit
final WritableGraph wg2 = g.getWritableGraph("2", true);
wg2.addVertex();
wg2.commit();
// Get the second write lock and immediately rollback
final WritableGraph wg3 = g.getWritableGraph("3", true);
final long modCount = wg3.getGlobalModificationCounter();
wg3.rollBack();
// Check that the modcount prior to rollingback the second write lock is the same as the current modcount in a new lock.
final WritableGraph wg4 = g.getWritableGraph("4", true);
assertEquals(modCount, wg4.getGlobalModificationCounter());
wg4.commit();
} catch (InterruptedException ex) {
}
}
use of au.gov.asd.tac.constellation.graph.WritableGraph in project constellation by constellation-app.
the class NestedLockingNGTest method unmodifiedCommitNestedTest.
@Test
public void unmodifiedCommitNestedTest() {
final DualGraph g = new DualGraph(null);
try {
// Get an outer write lock
final WritableGraph wg1 = g.getWritableGraph("1", true);
// Get the first inner write lock, modify the graph, then commit
final WritableGraph wg2 = g.getWritableGraph("2", true);
wg2.addVertex();
wg2.commit();
// Get the second inner write lock and immediately commit
final WritableGraph wg3 = g.getWritableGraph("3", true);
final long modCount = wg3.getGlobalModificationCounter();
wg3.commit();
// Commit the outer write lock
wg1.commit();
// Check that the modcount prior to commiting the second inner write lock is the same as the current modcount in a new lock.
final WritableGraph wg4 = g.getWritableGraph("4", true);
assertEquals(modCount, wg4.getGlobalModificationCounter());
wg4.commit();
} catch (InterruptedException ex) {
assertTrue("Locking Interrupted", false);
}
}
use of au.gov.asd.tac.constellation.graph.WritableGraph in project constellation by constellation-app.
the class NestedLockingNGTest method modifiedRollbackNestedTest.
@Test
public void modifiedRollbackNestedTest() {
final DualGraph g = new DualGraph(null);
try {
// Get an outer write lock
final WritableGraph wg1 = g.getWritableGraph("1", true);
// Get the first inner write lock, modify the graph, then commit
final WritableGraph wg2 = g.getWritableGraph("2", true);
wg2.addVertex();
wg2.commit();
// Get the second inner write lock, modify the graph, then rollback
final WritableGraph wg3 = g.getWritableGraph("3", true);
final long modCount = wg3.getGlobalModificationCounter();
wg3.addVertex();
wg3.rollBack();
// Commit the outer write lock
wg1.commit();
// Check that the modcount prior to modifying the second inner write lock is the same as the current modcount in a new lock.
final WritableGraph wg4 = g.getWritableGraph("4", true);
assertEquals(modCount, wg4.getGlobalModificationCounter());
wg4.commit();
} catch (InterruptedException ex) {
assertTrue("Locking Interrupted", false);
}
}
use of au.gov.asd.tac.constellation.graph.WritableGraph in project constellation by constellation-app.
the class NestedLockingNGTest method modifiedCommitNestedTest.
@Test
public void modifiedCommitNestedTest() {
final DualGraph g = new DualGraph(null);
try {
// Get an outer write lock
final WritableGraph wg1 = g.getWritableGraph("1", true);
// Get the first inner write lock, modify the graph, then commit
final WritableGraph wg2 = g.getWritableGraph("2", true);
wg2.addVertex();
wg2.commit();
// Get the second inner write lock, modify the graph, then commit
final WritableGraph wg3 = g.getWritableGraph("3", true);
wg3.addVertex();
final long modCount = wg3.getGlobalModificationCounter();
wg3.commit();
// Commit the outer write lock
wg1.commit();
// Check that the modcount prior to commiting the second inner write lock is the same as the current modcount in a new lock.
final WritableGraph wg4 = g.getWritableGraph("4", true);
assertEquals(modCount, wg4.getGlobalModificationCounter());
wg4.commit();
} catch (InterruptedException ex) {
assertTrue("Locking Interrupted", false);
}
}
use of au.gov.asd.tac.constellation.graph.WritableGraph in project constellation by constellation-app.
the class NestedLockingNGTest method unmodifiedRollbackNestedTest.
@Test
public void unmodifiedRollbackNestedTest() {
final DualGraph g = new DualGraph(null);
try {
// Get an outer write lock
final WritableGraph wg1 = g.getWritableGraph("1", true);
// Get the first inner write lock, modify the graph, then commit
final WritableGraph wg2 = g.getWritableGraph("2", true);
wg2.addVertex();
wg2.commit();
// Get the second inner write lock and immediately rollback
final WritableGraph wg3 = g.getWritableGraph("3", true);
final long modCount = wg3.getGlobalModificationCounter();
wg3.rollBack();
// Commit the outer write lock
wg1.commit();
// Check that the modcount prior to rollingback the second inner write lock is the same as the current modcount in a new lock.
final WritableGraph wg4 = g.getWritableGraph("4", true);
assertEquals(modCount, wg4.getGlobalModificationCounter());
wg4.commit();
} catch (InterruptedException ex) {
assertTrue("Locking Interrupted", false);
}
}
Aggregations