use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLTypeInstancesNotificationParser in project binnavi by google.
the class PostgreSQLTypeInstancesNotificationParserTest method testParser.
private void testParser(final String table, final String databaseOperation, final String moduleId, final String address, final String position, final String expressionId, final String typeInstanceId) {
final StringBuilder builder = new StringBuilder();
builder.append(table);
builder.append(' ');
builder.append(databaseOperation);
builder.append(' ');
builder.append(moduleId);
builder.append(' ');
if (address != null) {
builder.append(address);
builder.append(' ');
}
if (position != null) {
builder.append(position);
builder.append(' ');
}
if (expressionId != null) {
builder.append(expressionId);
builder.append(' ');
}
builder.append(typeInstanceId);
final String notification = builder.toString();
notifications.add(new MockPGNotification("type_instances_changes", notification));
final PostgreSQLTypeInstancesNotificationParser parser = new PostgreSQLTypeInstancesNotificationParser();
final Collection<TypeInstancesNotificationContainer> result = parser.parse(notifications, provider);
assertNotNull(result);
assertTrue(!result.isEmpty());
assertTrue(result.size() == 1);
final TypeInstancesNotificationContainer container = Iterables.getFirst(result, null);
assertNotNull(container);
assertEquals(databaseOperation, container.getDatabaseOperation());
}
use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLTypeInstancesNotificationParser in project binnavi by google.
the class PostgreSQLTypeInstancesNotificationParserTest method testTypeInstanceInform1.
@Test
public void testTypeInstanceInform1() throws CouldntLoadDataException {
final TypeInstancesNotificationContainer container = new TypeInstancesNotificationContainer("INSERT", module.getConfiguration().getId(), instance.getId(), Optional.<BigInteger>absent(), Optional.<Integer>absent(), Optional.<Integer>absent());
final PostgreSQLTypeInstancesNotificationParser parser = new PostgreSQLTypeInstancesNotificationParser();
parser.inform(Lists.newArrayList(container), provider);
}
Aggregations