use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.
the class CProjectContentTest method testRemoveAddressSpace.
@Test
public void testRemoveAddressSpace() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException, CouldntDeleteException {
final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
@SuppressWarnings("unused") final INaviView view = new MockView(m_provider);
@SuppressWarnings("unused") final INaviView view2 = projectContent.createView("Name", "description");
assertNotNull(CViewFilter.getTaggedViews(projectContent.getViews(), new CTag(4, "foo", "bar", TagType.VIEW_TAG, m_provider)));
final CAddressSpace spaceOne = projectContent.createAddressSpace("Address Space 1");
spaceOne.load();
final CAddressSpace spaceTwo = projectContent.createAddressSpace("Address Space 2");
spaceTwo.load();
final CAddressSpace spaceThree = projectContent.createAddressSpace("Address Space 3");
spaceThree.load();
final CAddressSpace spaceFour = projectContent.createAddressSpace("Address Space 4");
spaceFour.load();
m_project.load();
try {
assertFalse(projectContent.removeAddressSpace(spaceThree));
fail();
} catch (final IllegalStateException e) {
}
spaceThree.close();
assertTrue(projectContent.removeAddressSpace(spaceThree));
try {
assertFalse(projectContent.removeAddressSpace(spaceThree));
fail();
} catch (final IllegalArgumentException e) {
}
try {
assertFalse(projectContent.removeAddressSpace(null));
fail();
} catch (final NullPointerException e) {
}
m_project.close();
try {
assertFalse(projectContent.removeAddressSpace(spaceFour));
fail();
} catch (final IllegalStateException e) {
}
}
use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace in project binnavi by google.
the class CProjectContentTest method testCreateAddressSpace.
@Test
public void testCreateAddressSpace() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
final CAddressSpace spaceOne = projectContent.createAddressSpace("Address Space 1");
spaceOne.load();
try {
projectContent.createAddressSpace(null);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace 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());
}
use of com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace 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.AddressSpaces.CAddressSpace 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());
}
Aggregations