use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class CAddressSpaceNodeTest method setUp.
@Before
public void setUp() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, FileReadException, CouldntLoadDataException, CouldntSaveDataException, LoadCancelledException {
ConfigManager.instance().read();
m_database = new MockDatabase(m_provider);
m_project = new CProject(1, "Mock Project", "Mock Project Description", new Date(), new Date(), 0, new ArrayList<DebuggerTemplate>(), m_provider);
m_project.load();
m_addressSpace = m_project.getContent().createAddressSpace("Address Space");
final CProjectTreeModel model = new CProjectTreeModel(m_tree);
model.setRoot(new DefaultMutableTreeNode());
m_tree.setModel(model);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_project, "m_listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_addressSpace, "m_listeners"), "m_listeners")) == null);
assertTrue(((LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(ZyGraphBuilderManager.instance(), "m_listeners"), "m_listeners")) == null);
m_container = new CProjectContainer(m_database, m_project, m_addressSpace);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class CAddressSpaceNodeComponentTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, CouldntSaveDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, LoadCancelledException {
final JTree tree = new JTree();
m_database = new MockDatabase(m_provider);
m_project = new CProject(1, "Mock Project", "Mock Project Description", new Date(), new Date(), 0, new ArrayList<DebuggerTemplate>(), m_provider);
m_project.load();
m_addressSpace = m_project.getContent().createAddressSpace("Address Space");
m_component = new CAddressSpaceNodeComponent(tree, m_database, m_project, m_addressSpace);
m_saveButton = (JButton) ReflectionHelpers.getField(m_component, "m_saveButton");
m_editPanel = (CStandardEditPanel) ReflectionHelpers.getField(m_component, "m_stdEditPanel");
m_titledBorder = (TitledBorder) ReflectionHelpers.getField(m_component, "m_titledBorder");
m_debuggerCombo = (CDebuggerComboBox) ReflectionHelpers.getField(m_component, "m_debuggerCombo");
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class CModuleTest method testInSameDatabase.
@Test
public void testInSameDatabase() throws CouldntLoadDataException, LoadCancelledException {
m_module.load();
assertFalse(m_module.inSameDatabase(new MockSqlProvider()));
assertTrue(m_module.inSameDatabase(m_sql));
try {
m_module.inSameDatabase((SQLProvider) null);
fail();
} catch (final NullPointerException e) {
}
final MockDatabase database = new MockDatabase();
assertFalse(m_module.inSameDatabase(database));
try {
m_module.inSameDatabase((IDatabaseObject) null);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class CProjectContainerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
m_provider = new MockSqlProvider();
m_module = new MockModule(m_provider);
m_database = new MockDatabase(m_provider);
m_function = new MockFunction(m_provider);
m_project = new CProject(123, "Name", "Comment", new Date(), new Date(), 55, new FilledList<DebuggerTemplate>(), m_provider);
m_project.load();
m_space = m_project.getContent().createAddressSpace("space");
m_space.load();
m_space.getContent().addModule(m_module);
m_debugger = new DebuggerTemplate(2, "gdb", "local", 2222, m_provider);
m_space.getConfiguration().setDebuggerTemplate(m_debugger);
m_listener = new MockAddressSpaceListener();
m_space.addListener(m_listener);
m_module.load();
CFunctionContainerHelper.addFunction(m_module.getContent().getFunctionContainer(), m_function);
final CView view = m_module.getContent().getViewContainer().createView("foo", "bar");
@SuppressWarnings("unused") final MockViewContainer mockViewContainer = new MockViewContainer();
final MockViewListener listener = new MockViewListener();
view.addListener(listener);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase in project binnavi by google.
the class TextNodeTest method setUp.
@Before
public void setUp() throws IllegalArgumentException {
final INaviTextNode internalNode = CTextNodeFactory.getWithComment("Fark");
final TagManager tagManager = new TagManager(new MockTagManager(TagType.NODE_TAG));
final TagManager viewTagManager = new TagManager(new MockTagManager(TagType.VIEW_TAG));
final Database database = new Database(new MockDatabase());
final INaviModule internalModule = new MockModule();
final Module module = new Module(database, internalModule, tagManager, viewTagManager);
final INaviView internalView = new MockView();
final View view = new View(module, internalView, tagManager, viewTagManager);
m_node = new TextNode(view, internalNode, tagManager);
}
Aggregations