use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class DebuggerTemplateManagerTest method testLifeCycle.
@Test
public void testLifeCycle() throws CouldntSaveDataException, CouldntDeleteException {
final MockDebuggerTemplateManagerListener listener = new MockDebuggerTemplateManagerListener();
final com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager internalManager = new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager(new MockSqlProvider());
final DebuggerTemplateManager manager = new DebuggerTemplateManager(internalManager);
manager.addListener(listener);
final DebuggerTemplate template = manager.createDebuggerTemplate("Hannes", "Host", 123);
assertEquals(1, internalManager.debuggerCount());
assertEquals(1, manager.getDebuggerTemplateCount());
assertEquals(1, manager.getDebuggerTemplates().size());
assertEquals("Hannes", internalManager.getDebugger(0).getName());
assertEquals("Host", internalManager.getDebugger(0).getHost());
assertEquals(123, internalManager.getDebugger(0).getPort());
assertEquals("Hannes", manager.getDebuggerTemplate(0).getName());
assertEquals("Host", manager.getDebuggerTemplate(0).getHost());
assertEquals(123, manager.getDebuggerTemplate(0).getPort());
manager.deleteDebugger(template);
assertEquals(0, internalManager.debuggerCount());
assertEquals(0, manager.getDebuggerTemplateCount());
assertEquals("addedDebuggerTemplate;deletedDebuggerTemplate;", listener.events);
manager.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class DebuggerTemplateManagerTest method testConstructor.
@Test
public void testConstructor() {
final com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager internalManager = new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplateManager(new MockSqlProvider());
final DebuggerTemplateManager manager = new DebuggerTemplateManager(internalManager);
assertEquals("Debugger Template Manager (0 templates)", manager.toString());
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class DebuggerTemplateTest method testSetPort.
@Test
public void testSetPort() throws CouldntSaveDataException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException {
final MockDebuggerTemplateListener listener = new MockDebuggerTemplateListener();
final com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate internalTemplate = new com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate(1, "Name", "Host", 123, new MockSqlProvider());
final DebuggerTemplate template = new DebuggerTemplate(internalTemplate);
template.addListener(listener);
template.setPort(222);
assertEquals(222, template.getPort());
assertEquals(222, internalTemplate.getPort());
assertEquals("changedPort;", listener.events);
internalTemplate.setPort(223);
assertEquals(223, template.getPort());
assertEquals(223, internalTemplate.getPort());
assertEquals("changedPort;changedPort;", listener.events);
template.removeListener(listener);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class FunctionBlockTest method testConstructor.
@Test
public void testConstructor() {
final MockSqlProvider provider = new MockSqlProvider();
final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
final Function function = new Function(ModuleFactory.get(), parentFunction);
final FunctionBlock block = new FunctionBlock(function);
assertEquals(function, block.getFunction());
assertEquals("Function Block ['123 Mock Function']", block.toString());
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class FunctionEdgeTest method testConstructor.
@Test
public void testConstructor() {
final MockSqlProvider provider = new MockSqlProvider();
final CModule internalModule = new CModule(1, "", "", new Date(), new Date(), "00000000000000000000000000000000", "0000000000000000000000000000000000000000", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, provider);
final CFunction parentFunction = new CFunction(internalModule, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, provider);
final Function function = new Function(ModuleFactory.get(), parentFunction);
final FunctionBlock block = new FunctionBlock(function);
final FunctionBlock childBlock = new FunctionBlock(function);
final FunctionEdge edge = new FunctionEdge(block, childBlock);
assertEquals("Function Edge [Mock Function -> Mock Function]", edge.toString());
assertEquals(block, edge.getSource());
assertEquals(childBlock, edge.getTarget());
assertEquals(0, block.getParents().size());
assertEquals(1, block.getChildren().size());
assertEquals(childBlock, block.getChildren().get(0));
assertEquals(0, childBlock.getChildren().size());
assertEquals(1, childBlock.getParents().size());
assertEquals(block, childBlock.getParents().get(0));
}
Aggregations