use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testDeleteTextNodeCommentSync.
@Test
public void testDeleteTextNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CPartialLoadException, InterruptedException, CouldntDeleteException {
final CView databaseOneTextNodeView = databaseOneModuleTwo.getContent().getViewContainer().createView(" TEXT NODE TESTING VIEW ", "");
CViewInserter.insertView(databaseOneView, databaseOneTextNodeView);
final INaviTextNode databaseOneTextNode = databaseOneTextNodeView.getContent().createTextNode(new ArrayList<IComment>());
databaseOneTextNodeView.save();
databaseTwoModuleTwo.close();
databaseTwoModuleTwo.load();
databaseTwoView.load();
final INaviView databaseTwoTextNodeView = Iterables.getLast(databaseTwoModuleTwo.getContent().getViewContainer().getUserViews());
INaviTextNode databaseTwoTextNode = null;
assertEquals(databaseOneTextNodeView.getName(), databaseTwoTextNodeView.getName());
databaseTwoTextNodeView.load();
for (final INaviViewNode node : databaseTwoTextNodeView.getContent().getGraph().getNodes()) {
if (node instanceof INaviTextNode) {
databaseTwoTextNode = (INaviTextNode) node;
}
}
assertNotNull(databaseTwoTextNode);
assertEquals(databaseTwoTextNode.getId(), databaseOneTextNode.getId());
final List<IComment> comments = databaseOneTextNode.appendComment(" TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) ");
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneTextNode.getComments();
final List<IComment> twoAfter = databaseTwoTextNode.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();
databaseOneTextNode.deleteComment(Iterables.getLast(comments));
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOneTextNode.getComments();
final List<IComment> twoThree = databaseTwoTextNode.getComments();
assertEquals(oneTwoSize - 1, oneThree.size());
assertEquals(twoTwoSize - 1, twoThree.size());
assertEquals(oneThree, twoThree);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendTextNodeCommentSync.
@Test
public void testAppendTextNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, CPartialLoadException, LoadCancelledException, InterruptedException {
final CView databaseOneTextNodeView = databaseOneModuleTwo.getContent().getViewContainer().createView(" TEXT NODE TESTING VIEW ", "");
CViewInserter.insertView(databaseOneView, databaseOneTextNodeView);
final INaviTextNode databaseOneTextNode = databaseOneTextNodeView.getContent().createTextNode(new ArrayList<IComment>());
databaseOneTextNodeView.save();
databaseTwoModuleTwo.close();
databaseTwoModuleTwo.load();
databaseTwoView.load();
final INaviView databaseTwoTextNodeView = Iterables.getLast(databaseTwoModuleTwo.getContent().getViewContainer().getUserViews());
INaviTextNode databaseTwoTextNode = null;
assertEquals(databaseOneTextNodeView.getName(), databaseTwoTextNodeView.getName());
databaseTwoTextNodeView.load();
for (final INaviViewNode node : databaseTwoTextNodeView.getContent().getGraph().getNodes()) {
if (node instanceof INaviTextNode) {
databaseTwoTextNode = (INaviTextNode) node;
}
}
assertNotNull(databaseTwoTextNode);
assertEquals(databaseTwoTextNode.getId(), databaseOneTextNode.getId());
databaseOneTextNode.appendComment(" TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) ");
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneTextNode.getComments();
final List<IComment> twoAfter = databaseTwoTextNode.getComments();
assertNotNull(oneAfter);
assertNotNull(twoAfter);
assertEquals(1, oneAfter.size());
assertEquals(1, twoAfter.size());
assertEquals(oneAfter, twoAfter);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode 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.disassembly.INaviViewNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testAppendGroupNodeCommentSync.
@Test
public void testAppendGroupNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, CPartialLoadException, LoadCancelledException, InterruptedException {
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());
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);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviViewNode in project binnavi by google.
the class PostgreSQLNotificationProviderTest method testEditTextNodeCommentSync.
@Test
public void testEditTextNodeCommentSync() throws CouldntSaveDataException, CouldntLoadDataException, CPartialLoadException, LoadCancelledException, InterruptedException {
final CView databaseOneTextNodeView = databaseOneModuleTwo.getContent().getViewContainer().createView(" TEXT NODE TESTING VIEW ", "");
CViewInserter.insertView(databaseOneView, databaseOneTextNodeView);
final INaviTextNode databaseOneTextNode = databaseOneTextNodeView.getContent().createTextNode(new ArrayList<IComment>());
databaseOneTextNodeView.save();
databaseTwoModuleTwo.close();
databaseTwoModuleTwo.load();
databaseTwoView.load();
final INaviView databaseTwoTextNodeView = Iterables.getLast(databaseTwoModuleTwo.getContent().getViewContainer().getUserViews());
INaviTextNode databaseTwoTextNode = null;
assertEquals(databaseOneTextNodeView.getName(), databaseTwoTextNodeView.getName());
databaseTwoTextNodeView.load();
for (final INaviViewNode node : databaseTwoTextNodeView.getContent().getGraph().getNodes()) {
if (node instanceof INaviTextNode) {
databaseTwoTextNode = (INaviTextNode) node;
}
}
assertNotNull(databaseTwoTextNode);
assertEquals(databaseTwoTextNode.getId(), databaseOneTextNode.getId());
final List<IComment> comments = databaseOneTextNode.appendComment(" TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) BEFORE ");
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneAfter = databaseOneTextNode.getComments();
final List<IComment> twoAfter = databaseTwoTextNode.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();
databaseOneTextNode.editComment(Iterables.getLast(comments), " TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) AFTER ");
// database one to two over the PostgreSQL back end.
synchronized (lock) {
lock.await(1000, TimeUnit.MILLISECONDS);
}
final List<IComment> oneThree = databaseOneTextNode.getComments();
final List<IComment> twoThree = databaseTwoTextNode.getComments();
assertEquals(oneTwoSize, oneThree.size());
assertEquals(twoTwoSize, twoThree.size());
assertEquals(oneThree, twoThree);
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) AFTER ", Iterables.getLast(oneThree).getComment());
assertEquals(" TEST NOTIFICATION PROVIDER TESTS (TEXT NODE COMMENT) AFTER ", Iterables.getLast(twoThree).getComment());
}
Aggregations