[izpack-changes] r188 - in izpack-frontend/trunk/src: . izpack/frontend/controller izpack/frontend/model/shortcut izpack/frontend/model/stages izpack/frontend/view/mode izpack/frontend/view/stages/configure/panels tests tests/izpack tests/izpack/frontend tests/izpack/frontend/view tests/izpack/frontend/view/stages tests/izpack/frontend/view/stages/configure tests/izpack/frontend/view/stages/configure/panels utils
gumbo at BerliOS
gumbo at berlios.de
Fri Apr 7 02:16:25 CEST 2006
Author: gumbo
Date: 2006-04-07 02:16:07 +0200 (Fri, 07 Apr 2006)
New Revision: 188
Added:
izpack-frontend/trunk/src/tests/
izpack-frontend/trunk/src/tests/izpack/
izpack-frontend/trunk/src/tests/izpack/frontend/
izpack-frontend/trunk/src/tests/izpack/frontend/view/
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/AllTests.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLInfoTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLLicenseTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/InfoTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/JDKPathTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/LicenseTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/ShortcutPanelTest.java
izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/XInfoTest.java
Modified:
izpack-frontend/trunk/src/izpack/frontend/controller/XMLCreator.java
izpack-frontend/trunk/src/izpack/frontend/model/shortcut/ShortcutSet.java
izpack-frontend/trunk/src/izpack/frontend/model/stages/GeneralInformationModel.java
izpack-frontend/trunk/src/izpack/frontend/view/mode/WizardMode.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLInfo.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLLicense.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/Info.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/License.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/ShortcutPanel.java
izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/XInfo.java
izpack-frontend/trunk/src/utils/XML.java
Log:
Finished the editors. Shortcuts should be fully functional, but not very configurable. Wrote some unit tests to make sure I was creating XML - next to validate it.
Modified: izpack-frontend/trunk/src/izpack/frontend/controller/XMLCreator.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/controller/XMLCreator.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/controller/XMLCreator.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -36,7 +36,7 @@
{
/**
* Create an aggregator that can create a valid XML install file based on the data from
- * stages. Manages order, asking the stages to create thier XML, merging all the elements together, etc.
+ * stages. Manages order, asking the stages to create their XML, merging all the elements together, etc.
*
* @param stageList List of stages to ask to generate XML
*/
Modified: izpack-frontend/trunk/src/izpack/frontend/model/shortcut/ShortcutSet.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/model/shortcut/ShortcutSet.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/model/shortcut/ShortcutSet.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -66,10 +66,35 @@
}
// XML input/output stuff
- public Document writeXML()
+ /**
+ * Return a document for each OS type selected
+ */
+ public Document[] writeXML()
{
- Document doc = XML.createDocument();
+ Document winDoc = XML.createDocument();
+ Document unixDoc = XML.createDocument();
+ Element winRoot = writeShortcutHeader(winDoc);
+ Element unixRoot = writeShortcutHeader(unixDoc);
+
+ //Add each shortcut in the set to the file
+ ArrayList<Shortcut> shortcuts = getShortcuts();
+
+ for (Shortcut shortcut : shortcuts)
+ {
+ if (shortcut.getModelledOS() == Shortcut.OS.Windows)
+ winRoot.appendChild(shortcut.writeXML(winDoc));
+ else if (shortcut.getModelledOS() == Shortcut.OS.Unix)
+ unixRoot.appendChild(shortcut.writeXML(unixDoc));
+
+ //TODO Mac support when IzPack gets it
+ }
+
+ return new Document[] {winDoc, unixDoc};
+ }
+
+ private Element writeShortcutHeader(Document doc)
+ {
Element shortcutsRoot = XML.createElement("shortcuts", doc);
doc.appendChild(shortcutsRoot);
@@ -88,16 +113,7 @@
programGroup.setAttribute("location", location.toString());
shortcutsRoot.appendChild(programGroup);
-
- //Add each shortcut in the set to the file
- ArrayList<Shortcut> shortcuts = getShortcuts();
-
- for (Shortcut shortcut : shortcuts)
- {
- shortcutsRoot.appendChild(shortcut.writeXML(doc));
- }
-
- return doc;
+ return shortcutsRoot;
}
public void initXML(Document doc)
Modified: izpack-frontend/trunk/src/izpack/frontend/model/stages/GeneralInformationModel.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/model/stages/GeneralInformationModel.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/model/stages/GeneralInformationModel.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -314,7 +314,10 @@
info.appendChild(appname);
info.appendChild(appversion);
- info.appendChild(url);
+
+ if (homepage != null && !homepage.equals(""))
+ info.appendChild(url);
+
info.appendChild(authorsElem);
return info;
Modified: izpack-frontend/trunk/src/izpack/frontend/view/mode/WizardMode.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/mode/WizardMode.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/mode/WizardMode.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -23,7 +23,6 @@
import izpack.frontend.controller.StageChangeEvent;
import izpack.frontend.controller.StageChangeListener;
-import izpack.frontend.controller.XMLCreator;
import izpack.frontend.view.stages.IzPackStage;
import izpack.frontend.view.stages.compile.Compile;
import izpack.frontend.view.stages.configure.PanelConfigurator;
@@ -36,6 +35,7 @@
import java.awt.Dimension;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+import java.io.File;
import java.util.ArrayList;
import javax.swing.Box;
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLInfo.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLInfo.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLInfo.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -38,6 +38,7 @@
import utils.IO;
import utils.UI;
+import utils.XML;
/** Implement the information panel. This allows the user to select or create
* a README type file - plain text that is
@@ -61,6 +62,8 @@
try
{
editor.loadDocument(filename);
+
+ this.filename = filename;
}
catch (IOException ioe)
{
@@ -73,16 +76,20 @@
}
public Element createXML(Document doc)
- {
- // TODO Auto-generated method stub
- return null;
+ {
+ Element root = XML.createResourceTree("HTMLInfoPanel.info", filename, doc);
+
+ return root;
}
public void initFromXML(Document xmlFile)
{
- // TODO Auto-generated method stub
+ String info = XML.getResourceValueAsPath(xmlFile, "HTMLInfoPanel.info");
+ if (info != null)
+ updateEditorDisplay(info);
}
+ private String filename;
private HTMLEditor editor;
}
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLLicense.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLLicense.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/HTMLLicense.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -25,19 +25,16 @@
import izpack.frontend.view.components.HTMLEditor;
-import java.awt.Dimension;
import java.io.File;
import java.io.IOException;
-import javax.swing.JScrollPane;
-import javax.swing.JTextArea;
import javax.swing.text.BadLocationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import utils.IO;
import utils.UI;
+import utils.XML;
/** Implement the information panel. This allows the user to select or create
* a README type file - plain text that is
@@ -61,6 +58,8 @@
try
{
editor.loadDocument(filename);
+
+ this.filename = filename;
}
catch (IOException ioe)
{
@@ -73,16 +72,20 @@
}
public Element createXML(Document doc)
- {
- // TODO Auto-generated method stub
- return null;
+ {
+ Element root = XML.createResourceTree("HTMLLicencePanel.licence", filename, doc);
+
+ return root;
}
public void initFromXML(Document xmlFile)
{
- // TODO Auto-generated method stub
+ String license = XML.getResourceValueAsPath(xmlFile, "HTMLLicencePanel.licence");
+ if (license != null)
+ updateEditorDisplay(license);
}
+ private String filename;
private HTMLEditor editor;
}
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/Info.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/Info.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/Info.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -33,6 +33,7 @@
import org.w3c.dom.Element;
import utils.IO;
+import utils.XML;
/** Implement the information panel. This allows the user to select or create
* a README type file - plain text that is
@@ -59,20 +60,29 @@
protected void updateEditorDisplay(String filename)
{
editor.setText(IO.loadFileIntoString(new File(filename)));
+
+ this.filename = filename;
}
public Element createXML(Document doc)
- {
- // TODO Auto-generated method stub
- return null;
+ {
+ Element root = XML.createResourceTree("InfoPanel.info", filename, doc);
+
+ return root;
}
public void initFromXML(Document xmlFile)
{
- // TODO Auto-generated method stub
+ String info = XML.getResourceValueAsPath(xmlFile, "InfoPanel.info");
+ if (xmlFile.getDocumentURI() != null)
+ info = new File(xmlFile.getDocumentURI()).getParent() + System.getProperty("file.separator") + info;
+
+ if (info != null)
+ updateEditorDisplay(info);
}
+ private String filename;
private JTextArea editor;
}
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/License.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/License.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/License.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -33,6 +33,7 @@
import org.w3c.dom.Element;
import utils.IO;
+import utils.XML;
/** Implement the license panel. This allows the user to select or create
* a README type file - plain text that is
@@ -59,20 +60,29 @@
protected void updateEditorDisplay(String filename)
{
editor.setText(IO.loadFileIntoString(new File(filename)));
+
+ this.filename = filename;
}
public Element createXML(Document doc)
- {
- // TODO Auto-generated method stub
- return null;
+ {
+ Element root = XML.createResourceTree("LicencePanel.licence", filename, doc);
+
+ return root;
}
public void initFromXML(Document xmlFile)
{
- // TODO Auto-generated method stub
+ String license = XML.getResourceValueAsPath(xmlFile, "LicencePanel.licence");
+
+ if (xmlFile.getDocumentURI() != null)
+ license = new File(xmlFile.getDocumentURI()).getParent() + System.getProperty("file.separator") + license;
+ if (license != null)
+ updateEditorDisplay(license);
}
+ private String filename;
private JTextArea editor;
}
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/ShortcutPanel.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/ShortcutPanel.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/ShortcutPanel.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -205,8 +205,34 @@
public Element createXML(Document doc)
{
- // TODO Auto-generated method stub
- return null;
+ //Windows, Unix, Mac when implemented
+ Document[] docs = model.writeXML();
+
+ //TODO make these configurable somehow
+ XML.writeXML("shortcutSpec_Windows.xml", docs[0]);
+ XML.writeXML("shortcutSpec_Unix.xml", docs[1]);
+
+ //Create the resources specs, and native library stuff
+
+
+ Element root = XML.createElement("installation", doc);
+ root.setAttribute("version", "1.0");
+
+ Element winResources = XML.createResourceTree("shortcutSpec.xml", "shortcutSpec_Windows.xml", doc);
+ Element unixResources = XML.createResourceTree("Unix_shortcutSpec.xml", "shortcutSpec_Unix.xml", doc);
+
+ root.appendChild(winResources);
+ root.appendChild(unixResources);
+
+ Element nativeLib = XML.createElement("native", doc);
+ nativeLib.setAttribute("type", "izpack");
+ nativeLib.setAttribute("name", "ShellLink.dll");
+
+ nativeLib.appendChild(XML.createElement("test", doc));
+
+ root.appendChild(nativeLib);
+
+ return root;
}
public void initFromXML(Document xmlFile)
@@ -216,8 +242,8 @@
long start = System.currentTimeMillis();
- String winSpec = XML.getResourceValue(xmlFile, "shortcutSpec.xml");
- String unixSpec = XML.getResourceValue(xmlFile, "Unix_shortcutSpec.xml");
+ String winSpec = XML.getResourceValueAsPath(xmlFile, "shortcutSpec.xml");
+ String unixSpec = XML.getResourceValueAsPath(xmlFile, "Unix_shortcutSpec.xml");
//Have the model import the Windows shortcuts
try
Modified: izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/XInfo.java
===================================================================
--- izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/XInfo.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/izpack/frontend/view/stages/configure/panels/XInfo.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -54,45 +54,22 @@
{
public XInfo()
{
- xinfo = new JTextArea();
- filebox = new JTextField("Text file to be parsed: ");
-
- JScrollPane scrollPane = new JScrollPane();
- scrollPane.getViewport().add(xinfo);
- scrollPane.setPreferredSize(new Dimension(500, 350));
- xinfo.setWrapStyleWord(true);
-
- setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
-
- JButton browse = new JButton("Browse");
- browse.addActionListener(this);
+ super();
- add(filebox);
- add(Box.createVerticalStrut(5));
- add(browse);
- add(Box.createVerticalStrut(15));
- add(scrollPane);
+ JScrollPane scrollPane = new JScrollPane();
+ editor = new JTextArea();
+
+ scrollPane.getViewport().add(editor);
+ scrollPane.setPreferredSize(new Dimension(500, 350));
+ editor.setWrapStyleWord(true);
+
+ setTextEditor(scrollPane);
}
- JTextArea xinfo;
- JTextField filebox;
+ private JTextArea editor;
+ private String filename;
/* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e)
- {
- File textFile = UI.getFile(this, "text");
- loadFile(textFile);
- }
-
- private void loadFile(File textFile)
- {
- filebox.setText(textFile.getAbsolutePath());
- xinfo.setText(IO.loadFileIntoString(textFile));
- }
-
- /* (non-Javadoc)
* @see izpack.frontend.view.pages.configure.ConfigurePage#createXML()
*
* Structure:
@@ -102,7 +79,7 @@
*/
public Element createXML(Document doc)
{
- return XML.createResourceTree("XInfoPanel.info", filebox.getText(), doc);
+ return XML.createResourceTree("XInfoPanel.info", filename, doc);
}
/* (non-Javadoc)
@@ -115,20 +92,20 @@
*/
public void initFromXML(Document document)
{
- String filename = XML.getResourceValue(document, "XInfoPanel.info");
+ String filename = XML.getResourceValueAsPath(document, "XInfoPanel.info");
//Check to see if there's anything to load from
if (filename != null)
{
- loadFile(new File(filename));
+ updateEditorDisplay(filename);
}
}
- /* (non-Javadoc)
- * @see izpack.frontend.view.pages.configure.ConfigurePage#validatePage()
- */
- public ValidationResult validatePanel()
- {
- return null;
+ @Override
+ protected void updateEditorDisplay(String filename)
+ {
+ editor.setText(IO.loadFileIntoString(new File(filename)));
+
+ this.filename = filename;
}
}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/AllTests.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/AllTests.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/AllTests.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,53 @@
+/*
+ * Created on Apr 6, 2006
+ *
+ * $Id: AllTests.java Feb 8, 2004 izpack-frontend
+ * Copyright (C) 2005 Andy Gombos
+ *
+ * File : AllTests.java
+ * Description : TODO Add description
+ * Author's email : gumbo at users.berlios.de
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests
+{
+
+ public static void main(String[] args)
+ {
+ junit.swingui.TestRunner.run(AllTests.class);
+ }
+
+ public static Test suite()
+ {
+ TestSuite suite = new TestSuite(
+ "Test for test.izpack.frontend.view.stages.configure.panels");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(HTMLInfoTest.class);
+ suite.addTestSuite(LicenseTest.class);
+ suite.addTestSuite(HTMLLicenseTest.class);
+ suite.addTestSuite(InfoTest.class);
+ suite.addTestSuite(ShortcutPanelTest.class);
+ suite.addTestSuite(XInfoTest.class);
+ suite.addTestSuite(JDKPathTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLInfoTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLInfoTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLInfoTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,85 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Element;
+
+import utils.XML;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class HTMLInfoTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.HTMLInfo htmlinfo = null;
+ // JUnitDoclet end class
+
+ public HTMLInfoTest(String name) {
+ // JUnitDoclet begin method HTMLInfoTest
+ super(name);
+ // JUnitDoclet end method HTMLInfoTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.HTMLInfo createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.HTMLInfo();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ htmlinfo = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ htmlinfo = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+
+ assertNotNull(htmlinfo.createXML(XML.createDocument()));
+
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(HTMLInfoTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLLicenseTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLLicenseTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/HTMLLicenseTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,82 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.HTMLLicense;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class HTMLLicenseTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.HTMLLicense htmllicense = null;
+ // JUnitDoclet end class
+
+ public HTMLLicenseTest(String name) {
+ // JUnitDoclet begin method HTMLLicenseTest
+ super(name);
+ // JUnitDoclet end method HTMLLicenseTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.HTMLLicense createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.HTMLLicense();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ htmllicense = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ htmllicense = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+ assertNotNull(htmllicense.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(HTMLLicenseTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/InfoTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/InfoTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/InfoTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,83 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.Info;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class InfoTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.Info info = null;
+ // JUnitDoclet end class
+
+ public InfoTest(String name) {
+ // JUnitDoclet begin method InfoTest
+ super(name);
+ // JUnitDoclet end method InfoTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.Info createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.Info();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ info = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ info = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+
+ assertNotNull(info.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(InfoTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/JDKPathTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/JDKPathTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/JDKPathTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,82 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.JDKPath;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class JDKPathTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.JDKPath jdkpath = null;
+ // JUnitDoclet end class
+
+ public JDKPathTest(String name) {
+ // JUnitDoclet begin method JDKPathTest
+ super(name);
+ // JUnitDoclet end method JDKPathTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.JDKPath createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.JDKPath();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ jdkpath = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ jdkpath = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+ assertNotNull(jdkpath.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(JDKPathTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/LicenseTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/LicenseTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/LicenseTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,82 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.License;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class LicenseTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.License license = null;
+ // JUnitDoclet end class
+
+ public LicenseTest(String name) {
+ // JUnitDoclet begin method LicenseTest
+ super(name);
+ // JUnitDoclet end method LicenseTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.License createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.License();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ license = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ license = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+ assertNotNull(license.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(LicenseTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/ShortcutPanelTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/ShortcutPanelTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/ShortcutPanelTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,82 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.ShortcutPanel;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class ShortcutPanelTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.ShortcutPanel shortcutpanel = null;
+ // JUnitDoclet end class
+
+ public ShortcutPanelTest(String name) {
+ // JUnitDoclet begin method ShortcutPanelTest
+ super(name);
+ // JUnitDoclet end method ShortcutPanelTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.ShortcutPanel createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.ShortcutPanel();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ shortcutpanel = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ shortcutpanel = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+ assertNotNull(shortcutpanel.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(ShortcutPanelTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Added: izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/XInfoTest.java
===================================================================
--- izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/XInfoTest.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/tests/izpack/frontend/view/stages/configure/panels/XInfoTest.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -0,0 +1,92 @@
+package tests.izpack.frontend.view.stages.configure.panels;
+
+import utils.XML;
+import junit.framework.TestCase;
+// JUnitDoclet begin import
+import izpack.frontend.view.stages.configure.panels.XInfo;
+// JUnitDoclet end import
+
+/**
+* Generated by JUnitDoclet, a tool provided by
+* ObjectFab GmbH under LGPL.
+* Please see www.junitdoclet.org, www.gnu.org
+* and www.objectfab.de for informations about
+* the tool, the licence and the authors.
+*/
+
+
+public class XInfoTest
+// JUnitDoclet begin extends_implements
+extends TestCase
+// JUnitDoclet end extends_implements
+{
+ // JUnitDoclet begin class
+ izpack.frontend.view.stages.configure.panels.XInfo xinfo = null;
+ // JUnitDoclet end class
+
+ public XInfoTest(String name) {
+ // JUnitDoclet begin method XInfoTest
+ super(name);
+ // JUnitDoclet end method XInfoTest
+ }
+
+ public izpack.frontend.view.stages.configure.panels.XInfo createInstance() throws Exception {
+ // JUnitDoclet begin method testcase.createInstance
+ return new izpack.frontend.view.stages.configure.panels.XInfo();
+ // JUnitDoclet end method testcase.createInstance
+ }
+
+ protected void setUp() throws Exception {
+ // JUnitDoclet begin method testcase.setUp
+ super.setUp();
+ xinfo = createInstance();
+ // JUnitDoclet end method testcase.setUp
+ }
+
+ protected void tearDown() throws Exception {
+ // JUnitDoclet begin method testcase.tearDown
+ xinfo = null;
+ super.tearDown();
+ // JUnitDoclet end method testcase.tearDown
+ }
+
+ public void testActionPerformed() throws Exception {
+ // JUnitDoclet begin method actionPerformed
+ // JUnitDoclet end method actionPerformed
+ }
+
+ public void testCreateXML() throws Exception {
+ // JUnitDoclet begin method createXML
+ assertNotNull(xinfo.createXML(XML.createDocument()));
+ // JUnitDoclet end method createXML
+ }
+
+ public void testInitFromXML() throws Exception {
+ // JUnitDoclet begin method initFromXML
+ // JUnitDoclet end method initFromXML
+ }
+
+ public void testValidatePanel() throws Exception {
+ // JUnitDoclet begin method validatePanel
+ // JUnitDoclet end method validatePanel
+ }
+
+
+
+ /**
+ * JUnitDoclet moves marker to this method, if there is not match
+ * for them in the regenerated code and if the marker is not empty.
+ * This way, no test gets lost when regenerating after renaming.
+ * Method testVault is supposed to be empty.
+ */
+ public void testVault() throws Exception {
+ // JUnitDoclet begin method testcase.testVault
+ // JUnitDoclet end method testcase.testVault
+ }
+
+ public static void main(String[] args) {
+ // JUnitDoclet begin method testcase.main
+ junit.textui.TestRunner.run(XInfoTest.class);
+ // JUnitDoclet end method testcase.main
+ }
+}
Modified: izpack-frontend/trunk/src/utils/XML.java
===================================================================
--- izpack-frontend/trunk/src/utils/XML.java 2006-04-05 02:10:36 UTC (rev 187)
+++ izpack-frontend/trunk/src/utils/XML.java 2006-04-07 00:16:07 UTC (rev 188)
@@ -87,7 +87,16 @@
try
{
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- document = builder.parse(new File(filename));
+ document = builder.parse(new File(filename));
+
+ String URI = new File(filename).getParent();
+
+ if (URI == null)
+ URI = "";
+ else
+ URI = URI + System.getProperty("file.separator");
+
+ document.setDocumentURI(URI);
}
catch (ParserConfigurationException pce)
{
@@ -205,6 +214,22 @@
return null;
}
+ public static String getResourceValueAsPath(Document document, String id)
+ {
+ //TODO make this better - just to catch myself if I create a document badly
+ if (document.getDocumentURI() == null)
+ throw new RuntimeException("Error: Document URI does not exist");
+
+ String resource = getResourceValue(document, id);
+
+ if (resource != null)
+ {
+ resource = document.getDocumentURI() + resource;
+ }
+
+ return resource;
+ }
+
/**
* Structure:
* <resources>
More information about the izpack-changes
mailing list