use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNotificationContainer in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testParser.
private void testParser(final String table, final String databaseOperation, final String address, final String moduleId) {
final String notification = table + " " + databaseOperation + " " + moduleId + " " + address;
notifications.add(new MockPGNotification("function_changes", notification));
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
final Collection<FunctionNotificationContainer> result = parser.parse(notifications, provider);
assertNotNull(result);
assertTrue(!result.isEmpty());
assertTrue(result.size() == 1);
final FunctionNotificationContainer container = Iterables.getFirst(result, null);
assertNotNull(container);
assertEquals(databaseOperation, container.getDatabaseOperation());
assertEquals(new CAddress(address, 10), container.getFunctionAddress());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNotificationContainer in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testFunctionInform2Description.
@Test
public void testFunctionInform2Description() throws CouldntLoadDataException {
final String description = "FUNCTION DESCRIPTION CHANGE TEST";
function.setDescriptionInternal(description);
assertEquals(description, function.getDescription());
final FunctionNotificationContainer container = new FunctionNotificationContainer(module.getConfiguration().getId(), module, function.getAddress(), "UPDATE");
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
assertEquals("Mock Description", function.getDescription());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNotificationContainer in project binnavi by google.
the class PostgreSQLFunctionNotificationParser method inform.
@Override
public void inform(final Collection<FunctionNotificationContainer> parsedFunctionNotifications, final SQLProvider provider) throws CouldntLoadDataException {
Preconditions.checkNotNull(parsedFunctionNotifications, "Error: parsedFunctionNotifications argument can not be null");
Preconditions.checkNotNull(provider, "IE02740: provider argument can not be null");
for (final FunctionNotificationContainer container : parsedFunctionNotifications) {
informFunctionNotification(container, provider);
}
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNotificationContainer in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testFunctionInform0.
@Test
public void testFunctionInform0() throws CouldntLoadDataException {
final FunctionNotificationContainer container = new FunctionNotificationContainer(module.getConfiguration().getId(), module, function.getAddress(), "INSERT");
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.FunctionNotificationContainer in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testFunctionInform1Name.
@Test
public void testFunctionInform1Name() throws CouldntLoadDataException {
final String name = "FUNCTION NAME CHANGE TEST";
function.setNameInternal(name);
assertEquals(name, function.getName());
final FunctionNotificationContainer container = new FunctionNotificationContainer(module.getConfiguration().getId(), module, function.getAddress(), "UPDATE");
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
assertEquals("Mock Function", function.getName());
}
Aggregations