use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendFunctionNodeCommentSync.
@Test
public void testAppendFunctionNodeCommentSync() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException, CouldntSaveDataException, InterruptedException {
databaseOneCallGraph = databaseOneModuleTwo.getContent().getViewContainer().getNativeCallgraphView();
databaseOneCallGraph.load();
final INaviFunctionNode databaseOneFunctionNode = (INaviFunctionNode) databaseOneCallGraph.getGraph().getNodes().get(1);
databaseTwoCallGraph = databaseTwoModuleTwo.getContent().getViewContainer().getNativeCallgraphView();
databaseTwoCallGraph.load();
final INaviFunctionNode databaseTwoFunctionNode = (INaviFunctionNode) databaseTwoCallGraph.getGraph().getNodes().get(1);
final List<IComment> oneBefore = databaseOneFunctionNode.getLocalFunctionComment() == null ? new ArrayList<IComment>() : databaseOneFunctionNode.getLocalFunctionComment();
final List<IComment> twoBefore = databaseTwoFunctionNode.getLocalFunctionComment() == null ? new ArrayList<IComment>() : databaseTwoFunctionNode.getLocalFunctionComment();
assertEquals(oneBefore, twoBefore);
databaseOneFunctionNode.appendLocalFunctionComment(" TEST NOTIFICATION PROVIDER TESTS (LOCAL FUNCTION NODE COMMENT) ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneFunctionNode.getLocalFunctionComment();
final List<IComment> twoAfter = databaseTwoFunctionNode.getLocalFunctionComment();
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.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendGlobalInstructionCommentSync.
@Test
public void testAppendGlobalInstructionCommentSync() 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)");
// 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);
}
use of com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testDeleteLocalInstructionCommentSync.
@Test
public void testDeleteLocalInstructionCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException, CouldntDeleteException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(3);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(3);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction()) == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction());
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction()) == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction());
assertEquals(oneBefore, twoBefore);
final List<IComment> comments = databaseOnecodeNode.getComments().appendLocalInstructionComment(databaseOnecodeNode.getLastInstruction(), " TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT)");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction());
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction());
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().deleteLocalInstructionComment(databaseOnecodeNode.getLastInstruction(), 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().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction());
final List<IComment> twoThree = databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction());
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 testDeleteLocalEdgeCommentSync.
@Test
public void testDeleteLocalEdgeCommentSync() throws CouldntDeleteException, InterruptedException, CouldntSaveDataException, CouldntLoadDataException {
final INaviEdge databaseOneEdge = databaseOneView.getContent().getGraph().getEdges().get(3);
final INaviEdge databaseTwoEdge = databaseTwoView.getContent().getGraph().getEdges().get(3);
final List<IComment> oneBefore = databaseOneEdge.getLocalComment() == null ? new ArrayList<IComment>() : databaseOneEdge.getLocalComment();
final List<IComment> twoBefore = databaseTwoEdge.getLocalComment() == null ? new ArrayList<IComment>() : databaseTwoEdge.getLocalComment();
assertEquals(oneBefore, twoBefore);
final List<IComment> comments = databaseOneEdge.appendLocalComment(" 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 = databaseOneEdge.getLocalComment();
final List<IComment> twoAfter = databaseTwoEdge.getLocalComment();
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.deleteLocalComment(Iterables.getLast(comments));
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOneEdge.getLocalComment();
final List<IComment> twoThree = databaseTwoEdge.getLocalComment();
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 testAppendLocalInstructionCommentSync.
@Test
public void testAppendLocalInstructionCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, InterruptedException {
final INaviCodeNode databaseOnecodeNode = databaseOneView.getContent().getBasicBlocks().get(3);
final INaviCodeNode databaseTwocodeNode = databaseTwoView.getContent().getBasicBlocks().get(3);
final List<IComment> oneBefore = databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction()) == null ? new ArrayList<IComment>() : databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction());
final List<IComment> twoBefore = databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction()) == null ? new ArrayList<IComment>() : databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction());
assertEquals(oneBefore, twoBefore);
databaseOnecodeNode.getComments().appendLocalInstructionComment(databaseOnecodeNode.getLastInstruction(), " TEST NOTIFICATION PROVIDER TESTS (GLOBAL INSTRUCTION COMMENT)");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOnecodeNode.getComments().getLocalInstructionComment(databaseOnecodeNode.getLastInstruction());
final List<IComment> twoAfter = databaseTwocodeNode.getComments().getLocalInstructionComment(databaseTwocodeNode.getLastInstruction());
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(oneBefore.size() + 1, oneAfter.size());
assertEquals(twoBefore.size() + 1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
}
Aggregations