Search in sources :

Example 1 with AbstractSQLProvider

use of com.google.security.zynamics.binnavi.Database.AbstractSQLProvider in project binnavi by google.

the class PostgreSQLProviderTest method testCGenericSQLHelpersDeleteByID3.

@Test(expected = NullPointerException.class)
public void testCGenericSQLHelpersDeleteByID3() throws CouldntDeleteException {
    final AbstractSQLProvider connectionProvider = (AbstractSQLProvider) getProvider();
    final CConnection connection = connectionProvider.getConnection();
    PostgreSQLHelpers.deleteById(connection, null, 0);
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) CConnection(com.google.security.zynamics.binnavi.Database.CConnection) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 2 with AbstractSQLProvider

use of com.google.security.zynamics.binnavi.Database.AbstractSQLProvider in project binnavi by google.

the class PostgreSQLProviderTest method testCGenericSQLHelpersDeleteByID1.

@Test
public void testCGenericSQLHelpersDeleteByID1() throws CouldntDeleteException {
    final AbstractSQLProvider connectionProvider = (AbstractSQLProvider) getProvider();
    final CConnection connection = connectionProvider.getConnection();
    final String tableName = CTableNames.ADDRESS_SPACES_TABLE;
    PostgreSQLHelpers.deleteById(connection, tableName, 1);
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) CConnection(com.google.security.zynamics.binnavi.Database.CConnection) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 3 with AbstractSQLProvider

use of com.google.security.zynamics.binnavi.Database.AbstractSQLProvider in project binnavi by google.

the class PostgreSQLProviderTest method testCGenericSQLHelpersDeleteByID4.

@Test(expected = IllegalArgumentException.class)
public void testCGenericSQLHelpersDeleteByID4() throws CouldntDeleteException {
    final AbstractSQLProvider connectionProvider = (AbstractSQLProvider) getProvider();
    final CConnection connection = connectionProvider.getConnection();
    final String tableName = CTableNames.ADDRESS_SPACES_TABLE;
    PostgreSQLHelpers.deleteById(connection, tableName, 0);
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) CConnection(com.google.security.zynamics.binnavi.Database.CConnection) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 4 with AbstractSQLProvider

use of com.google.security.zynamics.binnavi.Database.AbstractSQLProvider in project binnavi by google.

the class PostgreSQLProviderTest method testCGenericSQLHelpersRollBack1.

@Test
public void testCGenericSQLHelpersRollBack1() throws SQLException {
    final AbstractSQLProvider connectionProvider = (AbstractSQLProvider) getProvider();
    final CConnection connection = connectionProvider.getConnection();
    PostgreSQLHelpers.beginTransaction(connection);
    PostgreSQLHelpers.rollback(connection);
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) CConnection(com.google.security.zynamics.binnavi.Database.CConnection) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 5 with AbstractSQLProvider

use of com.google.security.zynamics.binnavi.Database.AbstractSQLProvider in project binnavi by google.

the class PostgreSQLProviderTest method testCModuleFunctionsgetViewsWithAddresses1.

@Test
public void testCModuleFunctionsgetViewsWithAddresses1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getProvider().loadModules().get(0);
    module.load();
    final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    List<INaviView> views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x10033DCL)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(1, views.size());
    addresses.add(new UnrelocatedAddress(new CAddress(0x1003429)));
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, true);
    assertEquals(0, views.size());
    views = PostgreSQLModuleFunctions.getViewsWithAddresses((AbstractSQLProvider) getProvider(), module, addresses, false);
    assertEquals(2, views.size());
}
Also used : AbstractSQLProvider(com.google.security.zynamics.binnavi.Database.AbstractSQLProvider) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

AbstractSQLProvider (com.google.security.zynamics.binnavi.Database.AbstractSQLProvider)6 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)6 Test (org.junit.Test)6 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)4 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)2 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)2 IFilledList (com.google.security.zynamics.zylib.types.lists.IFilledList)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)1