Search in sources :

Example 6 with CProject

use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.

the class PostgreSQLProvider method createProject.

@Override
public CProject createProject(final String name) throws CouldntSaveDataException {
    final CProject project = PostgreSQLProjectCreator.createProject(this, name);
    projects.add(project);
    return project;
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject)

Example 7 with CProject

use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.

the class PostgreSQLTypeInstanceFunctionsTests method setUp.

@Before
public void setUp() throws IOException, CouldntLoadDriverException, CouldntConnectException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, CouldntInitializeDatabaseException, CouldntSaveDataException, InvalidExporterDatabaseFormatException, InvalidDatabaseVersionException, LoadCancelledException, FileReadException {
    final String[] parts = CConfigLoader.loadPostgreSQL();
    database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
    database.connect();
    database.load();
    try {
        final Field privateProviderField = CDatabase.class.getDeclaredField("provider");
        privateProviderField.setAccessible(true);
        provider = (SQLProvider) privateProviderField.get(database);
    } catch (final Exception exception) {
        throw new RuntimeException(exception);
    }
    provider.createDebuggerTemplate("Test Debugger", "localhost", 2222);
    final CProject project = provider.createProject("Test Project");
    provider.createAddressSpace(project, "Test Address Space");
    ConfigManager.instance().read();
    module = database.getContent().getModules().get(0);
}
Also used : Field(java.lang.reflect.Field) CProject(com.google.security.zynamics.binnavi.disassembly.CProject) CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CouldntInitializeDatabaseException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException) CouldntLoadDriverException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException) InvalidExporterDatabaseFormatException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidExporterDatabaseFormatException) FileReadException(com.google.security.zynamics.binnavi.config.FileReadException) InvalidDatabaseException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseException) CouldntConnectException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) IOException(java.io.IOException) InvalidDatabaseVersionException(com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseVersionException) CPartialLoadException(com.google.security.zynamics.binnavi.Database.Exceptions.CPartialLoadException) CouldntDeleteException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException) Before(org.junit.Before)

Example 8 with CProject

use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.

the class PostgreSQLProviderTest method testSetImageBase1.

@Test
public void testSetImageBase1() throws CouldntSaveDataException, CouldntLoadDataException {
    final CProject project = getProvider().createProject("SOME_TEST_PROJECT");
    getProvider().createAddressSpace(project, "SOME_ADDRESS_SPACE");
    final CAddressSpace addressSpace = getProvider().loadAddressSpaces(project).get(0);
    final INaviModule module = getProvider().loadModules().get(0);
    getProvider().setImageBase(addressSpace, module, new CAddress(BigInteger.valueOf(0)));
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 9 with CProject

use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.

the class PostgreSQLProviderTest method testAddModule1.

@Test
public void testAddModule1() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException {
    final INaviModule module = getProvider().loadModules().get(0);
    final CProject project = getProvider().createProject("FOOBAR_PROJECT");
    getProvider().createAddressSpace(project, "FOOBAR_ADDRESS_SPACE");
    final CAddressSpace as = getProvider().loadAddressSpaces(project).get(0);
    getProvider().addModule(as, module);
    try {
        getProvider().addModule(as, module);
        fail();
    } catch (final CouldntSaveDataException exception) {
        getProvider().removeModule(as, module);
    }
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 10 with CProject

use of com.google.security.zynamics.binnavi.disassembly.CProject in project binnavi by google.

the class PostgreSQLProviderTest method testCProjectCreatorCreateProject1.

@Test
public void testCProjectCreatorCreateProject1() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final CProject project = PostgreSQLProjectCreator.createProject((AbstractSQLProvider) getProvider(), "new project 010");
    project.load();
    assertNotNull(project.getConfiguration().getId());
    module.close();
    project.close();
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

CProject (com.google.security.zynamics.binnavi.disassembly.CProject)28 Test (org.junit.Test)15 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)12 Date (java.util.Date)10 ArrayList (java.util.ArrayList)9 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)8 DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)8 Before (org.junit.Before)8 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)5 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)4 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)4 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)3 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)3 CProjectTreeModel (com.google.security.zynamics.binnavi.Gui.MainWindow.ProjectTree.CProjectTreeModel)3 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)3 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)2 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)2