/*
* Copyright (C) 2004 TiongHiang Lee
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Email: thlee@onemindsoft.org
*/
package org.onemind.swingweb;
import java.io.PrintWriter;
import java.util.*;
import java.util.logging.Logger;
import junit.framework.TestCase;
import org.onemind.swingweb.demo.*;
import org.onemind.swingweb.session.SwingWebSession;
/**
* The toolkit test
* @author TiongHiang Lee (thlee@onemindsoft.org)
* @version $Id: SwingWebToolkitTest.java,v 1.4 2006/07/29 00:23:27 thlee Exp $ $Name: BR_1_x $
*/
public class SwingWebToolkitTest extends TestCase
{
/** the logger **/
private static final Logger _logger = Logger.getLogger(SwingWebToolkitTest.class.getName());
private SwingWebSession _session;
public void setUp() throws Exception
{
Properties prop = System.getProperties();
prop.put("awt.toolkit", "org.onemind.swingweb.SwingWebToolkit");
prop.put("swingweb.render.template.resource", "common.prop");
}
public void testAwtWidgetExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
SwingWebComponentManager comManager = new SwingWebComponentManager();
_session = new SwingWebSession(comManager);
manager.setCurrentSession(_session);
try
{
manager.startApp(AwtWidgetExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testLayoutExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.startApp(LayoutExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.setCurrentSession(_session);
try
{
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingBorderExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingBorderExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingContainerExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingContainerExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingOtherWidgetExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingOtherWidgetExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingTableExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingTableExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingTreeExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingTreeExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
public void testSwingWidgetExample() throws Exception
{
SwingWebAppManager manager = new SwingWebAppManager(getClass().getResourceAsStream("/swingweb-demo-config.xml"));
manager.setCurrentSession(_session);
try
{
manager.startApp(SwingWidgetExample.class, null);
PrintWriter writer = new PrintWriter(System.out);
manager.renderOutput(writer);
Map input = new HashMap();
manager.handleInput(input);
} finally
{
manager.setCurrentSession(null);
}
}
/*
public static void main(String args[]) throws Exception
{
TkBridgeToolkitTest test = new TkBridgeToolkitTest();
test.setUp();
test.testAwtWidgetExample();
test.testLayoutExample();
test.testSwingBorderExample();
test.testSwingContainerExample();
test.testSwingTableExample();
test.testSwingTreeExample();
test.testSwingWidgetExample();
}
*/
}