use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment 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.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testEditGlobalEdgeCommentSync.
@Test
public void testEditGlobalEdgeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviEdge databaseOneEdge = databaseOneView.getContent().getGraph().getEdges().get(3);
final INaviEdge databaseTwoEdge = databaseTwoView.getContent().getGraph().getEdges().get(3);
final List<IComment> oneBefore = databaseOneEdge.getGlobalComment() == null ? new ArrayList<IComment>() : databaseOneEdge.getGlobalComment();
final List<IComment> twoBefore = databaseTwoEdge.getGlobalComment() == null ? new ArrayList<IComment>() : databaseTwoEdge.getGlobalComment();
assertEquals(oneBefore, twoBefore);
databaseOneEdge.appendGlobalComment(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL EDGE COMMENT) BEFORE ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneEdge.getGlobalComment();
final List<IComment> twoAfter = databaseTwoEdge.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();
databaseOneEdge.editGlobalComment(Iterables.getLast(databaseOneEdge.getGlobalComment()), " TEST NOTIFICATION PROVIDER TESTS (GLOBAL EDGE COMMENT) AFTER ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOneEdge.getGlobalComment();
final List<IComment> twoThree = databaseTwoEdge.getGlobalComment();
assertEquals(oneTwoSize, oneThree.size());
assertEquals(twoTwoSize, twoThree.size());
assertEquals(oneThree, twoThree);
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL EDGE COMMENT) AFTER ", Iterables.getLast(oneThree).getComment());
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (GLOBAL EDGE COMMENT) AFTER ", Iterables.getLast(twoThree).getComment());
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testDeleteGroupNodeComment.
@Test
public void testDeleteGroupNodeComment() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CPartialLoadException, InterruptedException, CouldntDeleteException {
final CView databaseOneGroupNodeView = databaseOneModuleTwo.getContent().getViewContainer().createView(" GROUP NODE TESTING VIEW ", "");
CViewInserter.insertView(databaseOneView, databaseOneGroupNodeView);
final INaviGroupNode databaseOneGroupNode = databaseOneGroupNodeView.getContent().createGroupNode(databaseOneGroupNodeView.getGraph().getNodes());
databaseOneGroupNodeView.save();
databaseTwoModuleTwo.close();
databaseTwoModuleTwo.load();
databaseTwoView.load();
final INaviView databaseTwoGroupNodeView = Iterables.getLast(databaseTwoModuleTwo.getContent().getViewContainer().getUserViews());
INaviGroupNode databaseTwoGroupNode = null;
assertEquals(databaseOneGroupNodeView.getName(), databaseTwoGroupNodeView.getName());
databaseTwoGroupNodeView.load();
for (final INaviViewNode node : databaseTwoGroupNodeView.getContent().getGraph().getNodes()) {
if (node instanceof INaviGroupNode) {
databaseTwoGroupNode = (INaviGroupNode) node;
}
}
assertNotNull(databaseTwoGroupNode);
assertEquals(databaseTwoGroupNode.getId(), databaseOneGroupNode.getId());
final List<IComment> comments = databaseOneGroupNode.appendComment(" TEST NOTIFICATION PROVIDER TESTS (GROUP NODE COMMENT) ");
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneGroupNode.getComments();
final List<IComment> twoAfter = databaseTwoGroupNode.getComments();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(1, oneAfter.size());
assertEquals(1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
final int oneTwoSize = oneAfter.size();
final int twoTwoSize = twoAfter.size();
databaseOneGroupNode.deleteComment(Iterables.getLast(comments));
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOneGroupNode.getComments();
final List<IComment> twoThree = databaseTwoGroupNode.getComments();
assertEquals(oneTwoSize - 1, oneThree.size());
assertEquals(twoTwoSize - 1, twoThree.size());
assertEquals(oneThree, twoThree);
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment 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.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendGlobalEdgeCommentSync.
@Test
public void testAppendGlobalEdgeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviEdge databaseOneEdge = databaseOneView.getContent().getGraph().getEdges().get(3);
final INaviEdge databaseTwoEdge = databaseTwoView.getContent().getGraph().getEdges().get(3);
final List<IComment> oneBefore = databaseOneEdge.getGlobalComment() == null ? new ArrayList<IComment>() : databaseOneEdge.getGlobalComment();
final List<IComment> twoBefore = databaseTwoEdge.getGlobalComment() == null ? new ArrayList<IComment>() : databaseTwoEdge.getGlobalComment();
assertEquals(oneBefore, twoBefore);
databaseOneEdge.appendGlobalComment(" 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 = databaseOneEdge.getGlobalComment();
final List<IComment> twoAfter = databaseTwoEdge.getGlobalComment();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
}
Aggregations