use of com.google.security.zynamics.binnavi.disassembly.INaviProject in project binnavi by google.
the class PostgreSQLProviderTest method testSetNameAddressSpace3.
@Test(expected = NullPointerException.class)
public void testSetNameAddressSpace3() throws CouldntSaveDataException, CouldntLoadDataException {
final INaviProject project = getProvider().loadProjects().get(0);
getProvider().setName(getProvider().loadAddressSpaces(project).get(0), null);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviProject in project binnavi by google.
the class PostgreSQLProviderTest method testTraceFunctionsCreateTrace2.
@Test
public void testTraceFunctionsCreateTrace2() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final CProject project = getProvider().createProject("SOME_NEW_PROJECT");
getProvider().createTrace(project, "SOME_TRACE_NAME", "SOME_TRACE_DESCRIPTION");
project.load();
final String name = "Very new name";
final String description = "Super cool description";
final int projectTraceCount = project.getContent().getTraceCount();
PostgreSQLTraceFunctions.createTrace((AbstractSQLProvider) getProvider(), project, name, description);
project.close();
final List<INaviProject> projects = getProvider().loadProjects();
INaviProject project2 = null;
for (final INaviProject cProject : projects) {
if (project.getConfiguration().getId() == cProject.getConfiguration().getId()) {
project2 = cProject;
}
}
project2.load();
assertEquals(projectTraceCount + 1, project2.getContent().getTraceCount());
assertEquals(description, project2.getContent().getTraces().get(project2.getContent().getTraces().size() - 1).getDescription());
}
use of com.google.security.zynamics.binnavi.disassembly.INaviProject in project binnavi by google.
the class PostgreSQLProviderTest method testCSettingsFunctionsWriteSettings23.
@Test(expected = NullPointerException.class)
public void testCSettingsFunctionsWriteSettings23() throws CouldntLoadDataException, CouldntSaveDataException {
final INaviProject project = getProvider().loadProjects().get(0);
PostgreSQLSettingsFunctions.writeSetting((AbstractSQLProvider) getProvider(), project, null, null);
}
use of com.google.security.zynamics.binnavi.disassembly.INaviProject in project binnavi by google.
the class PostgreSQLProviderTest method testSetDescription1.
@Test
public void testSetDescription1() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviProject project = getProvider().loadProjects().get(0);
final CAddressSpace addressSpace = getProvider().createAddressSpace(project, "SOME_OTHER_ADDRESS_SPACE");
final INaviModule module = getProvider().loadModules().get(0);
module.load();
final CFunction function = (CFunction) module.getContent().getFunctionContainer().getFunctions().get(0);
final CView view = (CView) module.getContent().getViewContainer().getViews().get(0);
final CTagManager tagManager = getProvider().loadTagManager(TagType.VIEW_TAG);
final ITreeNode<CTag> tag = tagManager.getRootTag().getChildren().get(0);
getProvider().setDescription(addressSpace, "New Description");
getProvider().setDescription(function, "New Description");
getProvider().setDescription(module, "New Description");
getProvider().setDescription(project, "New Description");
getProvider().setDescription(tag.getObject(), "New Description");
getProvider().setDescription(module.getContent().getTraceContainer().getTraces().get(0), "New Description");
getProvider().setDescription(view, "New Description");
}
use of com.google.security.zynamics.binnavi.disassembly.INaviProject in project binnavi by google.
the class CDatabase method load.
@Override
public void load() throws CouldntLoadDataException, InvalidDatabaseVersionException, LoadCancelledException {
Preconditions.checkArgument(isConnected(), "IE00686: Not connected to the database");
try {
if (!loadReporter.report(LoadEvents.LOADING_DATABASE)) {
throw new LoadCancelledException();
}
if (!loadReporter.report(LoadEvents.DETERMINING_DATABASE_VERSION)) {
throw new LoadCancelledException();
}
final DatabaseVersion databaseVersion = provider.getDatabaseVersion();
final DatabaseVersion currentVersion = new DatabaseVersion(Constants.PROJECT_VERSION);
if ((databaseVersion.compareTo(currentVersion) != 0) && currentVersion.needsUpgrading(databaseVersion)) {
throw new InvalidDatabaseVersionException(databaseVersion);
}
if (!loadReporter.report(LoadEvents.LOADING_USERS)) {
throw new LoadCancelledException();
}
loadUserManager();
if (!loadReporter.report(LoadEvents.LOADING_VIEW_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager viewTagManager = loadViewTagManager();
if (!loadReporter.report(LoadEvents.LOADING_NODE_TAGS)) {
throw new LoadCancelledException();
}
final CTagManager nodeTagManager = loadNodeTagManager();
if (!loadReporter.report(LoadEvents.LOADING_DEBUGGERS)) {
throw new LoadCancelledException();
}
final DebuggerTemplateManager debuggerDescriptionManager = provider.loadDebuggers();
if (!loadReporter.report(LoadEvents.LOADING_PROJECTS)) {
throw new LoadCancelledException();
}
final List<INaviProject> projects = provider.loadProjects();
if (!loadReporter.report(LoadEvents.LOADING_RAW_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviRawModule> rawModules = provider.loadRawModules();
if (!loadReporter.report(LoadEvents.LOADING_MODULES)) {
throw new LoadCancelledException();
}
final List<INaviModule> modules = provider.loadModules();
debuggerDescriptionManager.addListener(internalDebuggerTemplateListener);
content = new CDatabaseContent(provider, this, listeners, projects, modules, rawModules, viewTagManager, nodeTagManager, debuggerDescriptionManager);
} catch (final CouldntLoadDataException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} catch (final InvalidDatabaseVersionException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
throw exception;
} catch (final LoadCancelledException exception) {
loadReporter.report(LoadEvents.LOADING_FINISHED);
close();
throw exception;
} finally {
isLoading = false;
}
content.initializeRawModules(content.getModules(), content.getRawModules());
for (final IDatabaseListener listener : listeners) {
try {
listener.loadedDatabase(this);
} catch (final Exception exception) {
CUtilityFunctions.logException(exception);
}
}
loadReporter.report(LoadEvents.LOADING_FINISHED);
}
Aggregations