package UnitTests.notepad;
import org.junit.Assert;
import vg.configuration.SimpleConfiguration;
import vg.core.VisualGraph;
import vg.core.plugin.PluginParameter;
import vg.logging.FileLog;
import vg.logging.SimpleLog;
import vg.logging.WindowMessage;
import vg.model.SQLite4JavaModel;
import vg.modules.notepad.NotepadPlugin;
import vg.progress.SimpleProgressManager;
import vg.userInterface.SwingUserInterface;
import vg.userInterface.utilPlugins.GraphLayoutManager;
import junit.framework.TestCase;
public class TestSuite1 extends TestCase {
public TestSuite1(String s) {
super(s);
// set all system services------------
try {
VisualGraph.setLog(new FileLog());
} catch (Throwable ex) {
ex.printStackTrace();
VisualGraph.setLog(new SimpleLog());
}
VisualGraph.setWindowMessage(new WindowMessage());
VisualGraph.setConfiguration(SimpleConfiguration.getInstance());
VisualGraph.setProgressManager(new SimpleProgressManager());
}
public void createNotepadInNotEDT() {
System.out.println("\n[notepad.TestSuite1.createNotepadInNotEDT]");
Thread t = new Thread(new Runnable() {
public void run() {
try {
SQLite4JavaModel model = new SQLite4JavaModel();
GraphLayoutManager layoutManager = new GraphLayoutManager();
SwingUserInterface view = new SwingUserInterface(model, "Welcome to Visual Graph", layoutManager);
PluginParameter param = new PluginParameter(model, view);
// adding system functions--------
System.out.println("Before creation of notepad plugin");
new NotepadPlugin().install(param);
System.out.println("After creation of notepad plugin");
view.quit();
} catch (Throwable ex) {
Assert.assertTrue(ex.getMessage(), false);
}
}
});
t.start();
try {
Thread.sleep(5000);
} catch (InterruptedException ex) {
Assert.assertTrue(ex.getMessage(), false);
}
System.out.println("Successfully");
Assert.assertTrue(true);
}
}