Search in sources :

Example 1 with TestController

use of jp.ossc.nimbus.service.test.TestController in project nimbus by nimbus-org.

the class TestSwingRunner method main.

public static void main(String[] args) throws Exception {
    if (args.length != 0 && args[0].equals("-help")) {
        usage();
        return;
    }
    final List servicePaths = new ArrayList();
    boolean validate = false;
    for (int i = 0; i < args.length; i++) {
        servicePaths.add(args[i]);
    }
    if (servicePaths.size() == 0) {
        usage();
        return;
    }
    for (int i = 0, max = servicePaths.size(); i < max; i++) {
        if (!ServiceManagerFactory.loadManager((String) servicePaths.get(i), false, validate)) {
            System.exit(-1);
        }
    }
    if (!ServiceManagerFactory.checkLoadManagerCompleted()) {
        System.exit(-1);
    }
    TestController testController = null;
    try {
        String controllerServiceNameStr = null;
        // コントローラーのサービス名は、とりあえずテストで固定値
        if (controllerServiceNameStr == null)
            controllerServiceNameStr = "Nimbus#TestController";
        final ServiceNameEditor editor = new ServiceNameEditor();
        editor.setAsText(controllerServiceNameStr);
        final ServiceName controllerServiceName = (ServiceName) editor.getValue();
        testController = (TestController) ServiceManagerFactory.getServiceObject(controllerServiceName);
    } catch (Exception e) {
        ServiceManagerFactory.getLogger().write("TR___00004", e);
        System.exit(-1);
    }
    // GUI を起動
    final UserIdInputView view = new UserIdInputView(servicePaths);
    view.setTestController(testController);
    view.setVisible(true);
    view.addWindowListener(new WindowAdapter() {

        public void windowClosing(WindowEvent e) {
            view.setWindowClosed(true);
        }
    });
    while (!view.isWindowClosed()) {
        synchronized (view) {
            view.wait(1000);
        }
    }
}
Also used : ServiceNameEditor(jp.ossc.nimbus.beans.ServiceNameEditor) ServiceName(jp.ossc.nimbus.core.ServiceName) WindowEvent(java.awt.event.WindowEvent) TestController(jp.ossc.nimbus.service.test.TestController) WindowAdapter(java.awt.event.WindowAdapter)

Aggregations

WindowAdapter (java.awt.event.WindowAdapter)1 WindowEvent (java.awt.event.WindowEvent)1 ServiceNameEditor (jp.ossc.nimbus.beans.ServiceNameEditor)1 ServiceName (jp.ossc.nimbus.core.ServiceName)1 TestController (jp.ossc.nimbus.service.test.TestController)1