use of com.google.security.zynamics.binnavi.disassembly.INaviCodeNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testDeleteGlobalCodeNodeCommentSync.
@Test
public void testDeleteGlobalCodeNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException, CouldntDeleteException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(1);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(1);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getGlobalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getGlobalCodeNodeComment();
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getGlobalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getGlobalCodeNodeComment();
assertEquals(oneBefore, twoBefore);
databaseOnecodeNode.getComments().appendGlobalCodeNodeComment(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL CODE NODE COMMENT) ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getGlobalCodeNodeComment();
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getGlobalCodeNodeComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
final int oneTwoSize = oneAfter.size();
final int twoTwoSize = twoAfter.size();
databaseOnecodeNode.getComments().deleteGlobalCodeNodeComment(Iterables.getLast(databaseOnecodeNode.getComments().getGlobalCodeNodeComment()));
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOnecodeNode.getComments().getGlobalCodeNodeComment();
final List<IComment> twoThree = databaseTwocodeNode.getComments().getGlobalCodeNodeComment();
assertEquals(oneTwoSize - 1, oneThree.size());
assertEquals(twoTwoSize - 1, twoThree.size());
assertEquals(oneThree, twoThree);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviCodeNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testEditGlobalInstructionCommentSync.
@Test
public void testEditGlobalInstructionCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(3);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(3);
final List<IComment> oneBefore = Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).getGlobalComment() == null ? new ArrayList<IComment>() : Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).getGlobalComment();
final List<IComment> twoBefore = Iterables.getFirst(databaseTwocodeNode.getInstructions(), null).getGlobalComment() == null ? new ArrayList<IComment>() : Iterables.getFirst(databaseTwocodeNode.getInstructions(), null).getGlobalComment();
assertEquals(oneBefore, twoBefore);
Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).appendGlobalComment(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT) BEFORE ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).getGlobalComment();
final List<IComment> twoAfter = Iterables.getFirst(databaseTwocodeNode.getInstructions(), null).getGlobalComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
final int oneTwoSize = oneAfter.size();
final int twoTwoSize = twoAfter.size();
Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).editGlobalComment(Iterables.getLast(Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).getGlobalComment()), " TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT) AFTER ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = Iterables.getFirst(databaseOnecodeNode.getInstructions(), null).getGlobalComment();
final List<IComment> twoThree = Iterables.getFirst(databaseTwocodeNode.getInstructions(), null).getGlobalComment();
assertEquals(oneTwoSize, oneThree.size());
assertEquals(twoTwoSize, twoThree.size());
assertEquals(oneThree, twoThree);
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT) AFTER ", Iterables.getLast(oneThree).getComment());
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT) AFTER ", Iterables.getLast(twoThree).getComment());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviCodeNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendLocalCodeNodeCommentSync.
@Test
public void testAppendLocalCodeNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(2);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(2);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getLocalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getLocalCodeNodeComment();
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getLocalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getLocalCodeNodeComment();
assertEquals(oneBefore, twoBefore);
databaseOnecodeNode.getComments().appendLocalCodeNodeComment(" TEST NOTIFICATION PROVIDER TESTS (LOCAL CODE NODE COMMENT)");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getLocalCodeNodeComment();
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getLocalCodeNodeComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviCodeNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testDeleteLocalCodeNodeCommentSync.
@Test
public void testDeleteLocalCodeNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException, CouldntDeleteException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(2);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(2);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getLocalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getLocalCodeNodeComment();
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getLocalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getLocalCodeNodeComment();
assertEquals(oneBefore, twoBefore);
final List<IComment> comments = databaseOnecodeNode.getComments().appendLocalCodeNodeComment(" TEST NOTIFICATION PROVIDER TESTS (LOCAL CODE NODE COMMENT)");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getLocalCodeNodeComment();
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getLocalCodeNodeComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
final int oneTwoSize = oneAfter.size();
final int twoTwoSize = twoAfter.size();
databaseOnecodeNode.getComments().deleteLocalCodeNodeComment(Iterables.getLast(comments));
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOnecodeNode.getComments().getLocalCodeNodeComment();
final List<IComment> twoThree = databaseTwocodeNode.getComments().getLocalCodeNodeComment();
assertEquals(oneTwoSize - 1, oneThree.size());
assertEquals(twoTwoSize - 1, twoThree.size());
assertEquals(oneThree, twoThree);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviCodeNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendGlobalCodeNodeCommentSync.
@Test
public void testAppendGlobalCodeNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(1);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(1);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getGlobalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getGlobalCodeNodeComment();
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getGlobalCodeNodeComment() == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getGlobalCodeNodeComment();
assertEquals(oneBefore, twoBefore);
databaseOnecodeNode.getComments().appendGlobalCodeNodeComment(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL CODE NODE COMMENT) ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getGlobalCodeNodeComment();
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getGlobalCodeNodeComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
}
Aggregations