use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLFunctionNotificationParser 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.parsers.PostgreSQLFunctionNotificationParser 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.parsers.PostgreSQLFunctionNotificationParser 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.parsers.PostgreSQLFunctionNotificationParser 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());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLFunctionNotificationParser in project binnavi by google.
the class PostgreSQLFunctionNotificationParserTest method testFunctionInform3Resolve.
@Test
public void testFunctionInform3Resolve() throws CouldntLoadDataException {
final INaviFunction forwardFunction = new MockFunction(provider);
function.setForwardedFunctionInternal(forwardFunction);
assertTrue(function.isForwarded());
assertEquals(forwardFunction.getAddress(), function.getForwardedFunctionAddress());
assertEquals(forwardFunction.getModule().getConfiguration().getId(), function.getForwardedFunctionModuleId());
final FunctionNotificationContainer container = new FunctionNotificationContainer(module.getConfiguration().getId(), module, function.getAddress(), "UPDATE");
final PostgreSQLFunctionNotificationParser parser = new PostgreSQLFunctionNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
assertFalse(function.isForwarded());
assertNull(function.getForwardedFunctionAddress());
assertEquals(0, function.getForwardedFunctionModuleId());
}
Aggregations