Search in sources :

Example 6 with ViewNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testModuleViewInform3.

@Test
public void testModuleViewInform3() throws CouldntLoadDataException {
    final INaviModule module = new MockModule(provider);
    final int currentUserViewSize = module.getContent().getViewContainer().getUserViews().size();
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(module.getConfiguration().getId()), Optional.of(module), Optional.<INaviProject>absent(), "INSERT");
    final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
    assertEquals(currentUserViewSize + 1, module.getContent().getViewContainer().getUserViews().size());
    final ViewNotificationContainer container2 = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(module.getConfiguration().getId()), Optional.of(module), Optional.<INaviProject>absent(), "DELETE");
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container2), provider);
    assertEquals(currentUserViewSize, module.getContent().getViewContainer().getUserViews().size());
}
Also used : PostgreSQLViewNotificationParser(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer) Test(org.junit.Test)

Example 7 with ViewNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testViewInform0.

@Test
public void testViewInform0() throws CouldntLoadDataException {
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.<Integer>absent(), Optional.<INaviModule>absent(), Optional.<INaviProject>absent(), "INSERT");
    final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
}
Also used : PostgreSQLViewNotificationParser(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer) Test(org.junit.Test)

Example 8 with ViewNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testProjectViewInform2.

@Test(expected = IllegalArgumentException.class)
public void testProjectViewInform2() throws CouldntLoadDataException {
    final INaviProject project = new MockProject(provider);
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "DELETE");
    final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
}
Also used : MockProject(com.google.security.zynamics.binnavi.disassembly.MockProject) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) PostgreSQLViewNotificationParser(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer) Test(org.junit.Test)

Example 9 with ViewNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testProjectViewInform1.

@Test
public void testProjectViewInform1() throws CouldntLoadDataException {
    final INaviProject project = new MockProject(provider);
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "UPDATE");
    final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
}
Also used : MockProject(com.google.security.zynamics.binnavi.disassembly.MockProject) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) PostgreSQLViewNotificationParser(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer) Test(org.junit.Test)

Example 10 with ViewNotificationContainer

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testViewInform1.

@Test
public void testViewInform1() throws CouldntLoadDataException {
    final String description2 = "TEST DESCRIPTION STATE CHANGE";
    view.getConfiguration().setDescriptionInternal(description2);
    assertEquals(description2, view.getConfiguration().getDescription());
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.<Integer>absent(), Optional.<INaviModule>absent(), Optional.<INaviProject>absent(), "UPDATE");
    final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
    parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
    assertEquals("DB PROJECT VIEW DESCRIPTION", view.getConfiguration().getDescription());
}
Also used : PostgreSQLViewNotificationParser(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser) ViewNotificationContainer(com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer) Test(org.junit.Test)

Aggregations

ViewNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer)19 PostgreSQLViewNotificationParser (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser)14 Test (org.junit.Test)13 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)5 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)5 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)4 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)4 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)3 Matcher (java.util.regex.Matcher)3 PGNotification (org.postgresql.PGNotification)1