use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLViewNotificationParserTest method testProjectViewInform3.
@Test
public void testProjectViewInform3() throws CouldntLoadDataException {
final INaviProject project = new MockProject(provider);
final int currentUserViewSize = project.getContent().getViews().size();
final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "INSERT");
final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
assertEquals(currentUserViewSize + 1, project.getContent().getViews().size());
final ViewNotificationContainer container2 = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "DELETE");
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container2), provider);
assertEquals(currentUserViewSize, project.getContent().getViews().size());
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class PostgreSQLViewNotificationParserTest method testProjectViewInform0.
@Test
public void testProjectViewInform0() throws CouldntLoadDataException {
final INaviProject project = new MockProject(provider);
final int currentUserViewSize = project.getContent().getViews().size();
final ViewNotificationContainer container = new ViewNotificationContainer(view.getConfiguration().getId(), Optional.fromNullable(view), Optional.of(project.getConfiguration().getId()), Optional.<INaviModule>absent(), Optional.of(project), "INSERT");
final PostgreSQLViewNotificationParser parser = new PostgreSQLViewNotificationParser();
parser.inform(Lists.<ViewNotificationContainer>newArrayList(container), provider);
assertEquals(currentUserViewSize + 1, project.getContent().getViews().size());
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class AddressSpaceTest method setUp.
@Before
public void setUp() {
final MockSqlProvider provider = new MockSqlProvider();
creationDate = new Date();
modificationDate = new Date();
final MockDatabase mockDb = new MockDatabase();
database = new Database(mockDb);
internalAddressSpace = new CAddressSpace(1, "Mock Space", "Mock Space Description", creationDate, modificationDate, new LinkedHashMap<INaviModule, IAddress>(), null, provider, new MockProject());
addressSpace = new AddressSpace(database, null, internalAddressSpace);
final Date creationDate = new Date();
final Date modificationDate = new Date();
final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
mockDb.getContent().addModule(internalModule);
final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
module = new Module(database, internalModule, nodeTagManager, viewTagManager);
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class AddressSpaceTest method testConstructorAlternative.
@Test
public void testConstructorAlternative() throws com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException, LoadCancelledException {
final MockSqlProvider provider = new MockSqlProvider();
final MockDatabase mockDb = new MockDatabase(provider);
final Database database = new Database(mockDb);
final com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate template = new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "", "", 0, provider);
mockDb.getContent().getDebuggerTemplateManager().addDebugger(template);
final CModule internalModule = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, provider);
mockDb.getContent().addModule(internalModule);
final CAddressSpace internalAddressSpace = new CAddressSpace(1, "Mock Space", "Mock Space Description", new Date(), new Date(), new LinkedHashMap<INaviModule, IAddress>(), null, provider, new MockProject());
internalAddressSpace.load();
internalAddressSpace.getConfiguration().setDebuggerTemplate(template);
internalAddressSpace.getContent().addModule(internalModule);
final Project project = ProjectFactory.get();
final AddressSpace addressSpace = new AddressSpace(database, project, internalAddressSpace);
assertEquals(1, addressSpace.getModules().size());
assertNotNull(addressSpace.getDebuggerTemplate());
assertNotNull(addressSpace.getDebugger());
}
use of com.google.security.zynamics.binnavi.disassembly.MockProject in project binnavi by google.
the class CAddressSpaceTest method test_C_Constructors.
@Test
public void test_C_Constructors() {
final MockSqlProvider sql = new MockSqlProvider();
try {
new CAddressSpace(0, "AS Name", "AS Description", new Date(), new Date(), new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, null, "AS Description", new Date(), new Date(), new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, "AS Name", null, new Date(), new Date(), new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, "AS Name", "AS Description", null, new Date(), new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, "AS Name", "AS Description", new Date(), null, new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, "AS Name", "AS Description", new Date(), new Date(), null, null, sql, new MockProject());
fail();
} catch (final Exception exception) {
}
try {
new CAddressSpace(1, "AS Name", "AS Description", new Date(), new Date(), new HashMap<INaviModule, IAddress>(), null, null, new MockProject());
fail();
} catch (final Exception exception) {
}
final CAddressSpace addressSpace = new CAddressSpace(1, "AS Name", "AS Description", new Date(), new Date(), new HashMap<INaviModule, IAddress>(), null, sql, new MockProject());
assertEquals(1, addressSpace.getConfiguration().getId());
assertEquals("AS Name", addressSpace.getConfiguration().getName());
assertEquals("AS Description", addressSpace.getConfiguration().getDescription());
}
Aggregations