Search in sources :

Example 6 with PostgreSQLViewNotificationParser

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser 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)

Example 7 with PostgreSQLViewNotificationParser

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testViewInform4.

@Test
public void testViewInform4() throws CouldntLoadDataException {
    final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.<Integer>absent(), Optional.<INaviModule>absent(), Optional.<INaviProject>absent(), "DELETE");
    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 PostgreSQLViewNotificationParser

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testViewInform3.

@Test
public void testViewInform3() throws CouldntLoadDataException {
    final boolean starState2 = true;
    view.getConfiguration().setStaredInternal(starState2);
    assertEquals(starState2, view.getConfiguration().isStared());
    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(false, view.getConfiguration().isStared());
}
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 9 with PostgreSQLViewNotificationParser

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testViewInform2.

@Test
public void testViewInform2() throws CouldntLoadDataException {
    final String name2 = "TEST NAME STATE CHANGE";
    view.getConfiguration().setNameInternal(name2);
    assertEquals(name2, view.getConfiguration().getName());
    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 NAME", view.getConfiguration().getName());
}
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 10 with PostgreSQLViewNotificationParser

use of com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.parsers.PostgreSQLViewNotificationParser in project binnavi by google.

the class PostgreSQLViewNotificationParserTest method testModuleViewInform0.

@Test
public void testModuleViewInform0() 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());
}
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)

Aggregations

ViewNotificationContainer (com.google.security.zynamics.binnavi.Database.PostgreSQL.Notifications.containers.ViewNotificationContainer)14 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)4 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)4 MockProject (com.google.security.zynamics.binnavi.disassembly.MockProject)4 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)4