use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CTagTest method test_C_Constructor.
@Test
public void test_C_Constructor() {
try {
new CTag(-1, "Tag Name", "Tag Description", TagType.NODE_TAG, new MockSqlProvider());
fail();
} catch (final IllegalArgumentException exception) {
}
try {
new CTag(0, null, "Tag Description", TagType.NODE_TAG, new MockSqlProvider());
fail();
} catch (final NullPointerException exception) {
}
try {
new CTag(0, "Tag Name", null, TagType.NODE_TAG, new MockSqlProvider());
fail();
} catch (final NullPointerException exception) {
}
try {
new CTag(0, "Tag Name", "Tag Description", null, new MockSqlProvider());
fail();
} catch (final NullPointerException exception) {
}
try {
new CTag(0, "Tag Name", "Tag Description", TagType.NODE_TAG, null);
fail();
} catch (final NullPointerException exception) {
}
assertEquals(1, m_tag.getId());
assertEquals("Tag Name", m_tag.getName());
assertEquals("Tag Description", m_tag.getDescription());
assertEquals(TagType.NODE_TAG, m_tag.getType());
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CProjectContentTest method testRemoveTrace.
@Test
public void testRemoveTrace() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, CouldntDeleteException {
final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
@SuppressWarnings("unused") final INaviView view = new MockView(m_provider);
@SuppressWarnings("unused") final INaviView view2 = projectContent.createView("Name", "description");
assertNotNull(CViewFilter.getTaggedViews(projectContent.getViews(), new CTag(4, "foo", "bar", TagType.VIEW_TAG, m_provider)));
final CAddressSpace spaceOne = projectContent.createAddressSpace("Address Space 1");
spaceOne.load();
final CAddressSpace spaceTwo = projectContent.createAddressSpace("Address Space 2");
spaceTwo.load();
final CAddressSpace spaceThree = projectContent.createAddressSpace("Address Space 3");
spaceThree.load();
final CAddressSpace spaceFour = projectContent.createAddressSpace("Address Space 4");
spaceFour.load();
m_project.load();
final TraceList trace = new TraceList(3, "name", "desc", m_provider);
projectContent.removeTrace(trace);
try {
projectContent.removeTrace(null);
fail();
} catch (final NullPointerException e) {
}
final TraceList trace2 = new TraceList(3, "name", "desc", new MockSqlProvider());
try {
projectContent.removeTrace(trace2);
fail();
} catch (final Exception e) {
}
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CViewTest method testConstructor2.
@Test
public void testConstructor2() {
try {
new CView(new BigInteger(31, random).intValue(), (INaviProject) null, "Foo", "Bar", ViewType.Native, new Date(1234), new Date(12345), new MutableDirectedGraph<INaviViewNode, INaviEdge>(new ArrayList<INaviViewNode>(), new ArrayList<INaviEdge>()), new HashSet<CTag>(), false, new MockSqlProvider());
fail();
} catch (final NullPointerException e) {
}
final int viewId = new BigInteger(31, random).intValue();
final CView view = new CView(viewId, new MockProject(), "Foo", "Bar", ViewType.Native, new Date(1234), new Date(12345), new MutableDirectedGraph<INaviViewNode, INaviEdge>(new ArrayList<INaviViewNode>(), new ArrayList<INaviEdge>()), new HashSet<CTag>(), false, new MockSqlProvider());
assertEquals(viewId, view.getConfiguration().getId());
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CViewTest method testLifeCycle.
@Test
public void testLifeCycle() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException {
final MockSqlProvider sql = new MockSqlProvider();
final Set<CTag> tags = new HashSet<CTag>();
tags.add(new CTag(1, "", "", TagType.VIEW_TAG, sql));
final CModuleViewGenerator generator = new CModuleViewGenerator(sql, m_module);
final CView view = generator.generate(1, "New View", "New View Description", ViewType.Native, GraphType.FLOWGRAPH, new Date(), new Date(), 33, 44, tags, new HashSet<CTag>(), false);
final MockViewListener listener = new MockViewListener();
view.addListener(listener);
view.load();
listener.m_closing = false;
view.close();
assertTrue(view.isLoaded());
listener.m_closing = true;
view.close();
assertFalse(view.isLoaded());
}
use of com.google.security.zynamics.binnavi.Tagging.CTag in project binnavi by google.
the class CViewTest method testSomeOverwrittenMethods.
@Test
public void testSomeOverwrittenMethods() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException, CouldntSaveDataException {
final CProjectViewGenerator generator = new CProjectViewGenerator(m_sql, new MockProject());
final CView view = generator.generate(6, "Blub", "Bla", ViewType.Native, GraphType.FLOWGRAPH, new Date(1234), new Date(12345), 123, 700, new HashSet<CTag>(), new HashSet<CTag>(), false);
assertEquals(6, view.getConfiguration().getId());
view.load();
assertNotNull(view.getBasicBlockEdges());
assertNotNull(view.getBasicBlocks());
assertNotNull(view.getClass());
assertNotNull(view.getConfiguration());
assertNotNull(view.getContent());
assertNotNull(view.getDerivedViews());
assertEquals(0, view.getEdgeCount());
assertNotNull(view.getGraph());
assertEquals(GraphType.MIXED_GRAPH, view.getGraphType());
assertEquals(-1, view.getLoadState());
assertEquals("Blub", view.getName());
assertEquals(0, view.getNodeCount());
assertNotNull(view.getNodeTags());
assertEquals(ViewType.Native, view.getType());
assertTrue(view.isLoaded());
assertFalse(view.isStared());
try {
view.save();
fail();
} catch (final IllegalArgumentException e) {
}
assertFalse(view.wasModified());
view.close();
}
Aggregations