use of com.google.security.zynamics.zylib.general.ListenerProvider in project binnavi by google.
the class CPostgreSQLModuleContentTest method testCModuleContentConstructor.
@Test
public void testCModuleContentConstructor() throws LoadCancelledException, CouldntLoadDataException {
final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
module.load();
final ListenerProvider<IModuleListener> listeners = new ListenerProvider<IModuleListener>();
final CCallgraph callgraph = module.getContent().getNativeCallgraph();
final IFilledList<INaviFunction> functions = new FilledList<INaviFunction>();
functions.add(module.getContent().getFunctionContainer().getFunctions().get(0));
final ICallgraphView nativeCallgraph = module.getContent().getViewContainer().getNativeCallgraphView();
final ImmutableList<IFlowgraphView> nativeFlowgraphs = module.getContent().getViewContainer().getNativeFlowgraphViews();
final List<INaviView> customViews = new ArrayList<INaviView>();
final ImmutableBiMap<INaviView, INaviFunction> viewFunctionMap = new ImmutableBiMap.Builder<INaviView, INaviFunction>().build();
new Pair<HashMap<INaviView, INaviFunction>, HashMap<INaviFunction, INaviView>>(null, null);
final IFilledList<TraceList> traces = new FilledList<TraceList>();
final SectionContainer sections = new SectionContainer(new SectionContainerBackend(getProvider(), module));
final TypeInstanceContainer instances = new TypeInstanceContainer(new TypeInstanceContainerBackend(getProvider(), module, module.getTypeManager(), sections), getProvider());
final CModuleContent moduleContent1 = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, sections, instances);
assertNotNull(moduleContent1);
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(null, null, null, null, null, null, null, null, null, null, sections, instances);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, null, null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), null, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, null, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, null, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, null, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, null, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, null, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, null, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, null, null, null);
fail();
} catch (final NullPointerException e) {
}
try {
@SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, null, null);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.zylib.general.ListenerProvider in project binnavi by google.
the class CDatabaseSettingsPanel method testConnection.
/**
* Tries to establish a connection to the database.
*/
public void testConnection() {
testButton.setEnabled(false);
if (databaseIdentityField.getText().isEmpty() || databaseIdentityField.getText() == null) {
CMessageBox.showInformation(SwingUtilities.getWindowAncestor(CDatabaseSettingsPanel.this), "Could not test the connection to the database because the identity name is not set.");
testButton.setEnabled(true);
return;
}
if (databaseUserField.getText().isEmpty() || databaseUserField.getText() == null) {
CMessageBox.showInformation(SwingUtilities.getWindowAncestor(CDatabaseSettingsPanel.this), "Could not test the connection to the database because the user name is not set.");
testButton.setEnabled(true);
return;
}
if (new String(passwordField.getPassword()).isEmpty()) {
CMessageBox.showInformation(SwingUtilities.getWindowAncestor(CDatabaseSettingsPanel.this), "Could not test the connection to the database because the password is not set.");
testButton.setEnabled(true);
return;
}
new Thread() {
@Override
public void run() {
final CProgressPanel panel = new CProgressPanel("Testing database connection", true, false, false);
final IProgressOperation operation = new IProgressOperation() {
@Override
public String getDescription() {
return "Testing DB Connection";
}
@Override
public CProgressPanel getProgressPanel() {
return panel;
}
};
CGlobalProgressManager.instance().add(operation);
panel.start();
final CDatabaseConfiguration configuration = new CDatabaseConfiguration(database, new ListenerProvider<IDatabaseListener>(), "CONNECTION TEST", database.getConfiguration().getDriver(), databaseHostField.getText(), databaseNameField.getText(), databaseUserField.getText(), new String(passwordField.getPassword()), databaseIdentityField.getText(), false, false);
CDatabaseConnector.testConnection(SwingUtilities.getWindowAncestor(CDatabaseSettingsPanel.this), configuration);
CGlobalProgressManager.instance().remove(operation);
testButton.setEnabled(true);
}
}.start();
}
Aggregations