use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class TraceLoggerTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, InvalidDatabaseVersionException {
final SQLProvider mockProvider = new MockSqlProvider();
// CDatabase("", "", "", "", "", false,
final IDatabase internalDatabase = new MockDatabase();
// false);
final Database database = new Database(internalDatabase);
database.load();
final MockProject mockProject = new MockProject();
final ITreeNode<CTag> nodeRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, mockProvider));
final Tree<CTag> nodeTagTree = new Tree<CTag>(nodeRootNode);
final TagManager nodeTagManager = new TagManager(new CTagManager(nodeTagTree, TagType.NODE_TAG, mockProvider));
final ITreeNode<CTag> viewRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, mockProvider));
final Tree<CTag> viewTagTree = new Tree<CTag>(viewRootNode);
final TagManager viewTagManager = new TagManager(new CTagManager(viewTagTree, TagType.VIEW_TAG, mockProvider));
final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
final Project project = new Project(database, mockProject, nodeTagManager, viewTagManager);
m_mockModule = new Module(database, mockModule, viewTagManager, nodeTagManager);
m_debugSettings = new ModuleTargetSettings(m_mockModule.getNative());
m_mockDebugger = new MockDebugger(m_debugSettings);
m_mockDebugger.setAddressTranslator(mockModule, new CAddress(0), new CAddress(0x1000));
final Debugger debugger = new Debugger(m_mockDebugger);
m_logger = new TraceLogger(debugger, module);
m_projectLogger = new TraceLogger(debugger, project);
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLViewNotificationParserTest method testProjectViewInform2.
@Test(expected = IllegalArgumentException.class)
public void testProjectViewInform2() throws CouldntLoadDataException {
final INaviProject project = new MockProject(provider);
final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "DELETE");
final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLViewNotificationParserTest method testProjectViewInform1.
@Test
public void testProjectViewInform1() throws CouldntLoadDataException {
final INaviProject project = new MockProject(provider);
final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "UPDATE");
final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLProviderTestSetup method testCreateViewProject4.
@Test(expected = CouldntSaveDataException.class)
public void testCreateViewProject4() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CPartialLoadException {
final INaviView view = getKernel32Module().getContent().getViewContainer().getViews().get(223);
view.load();
getProvider().createView(new MockProject(), view, "View Name", null);
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLViewNotificationParserTest method testProjectViewInform3.
@Test
public void testProjectViewInform3() throws CouldntLoadDataException {
final INaviProject project = new MockProject(provider);
final int currentUserViewSize = project.getContent().getViews().size();
final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "INSERT");
final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
assertEquals(currentUserViewSize + 1, project.getContent().getViews().size());
final ViewNotificationContainer container2 = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "DELETE");
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container2), provider);
assertEquals(currentUserViewSize, project.getContent().getViews().size());
}
Aggregations