JBoss Tools SVN: r6807 - trunk/jsf/docs/userguide/en/modules.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2008-03-08 04:10:43 -0500 (Sat, 08 Mar 2008)
New Revision: 6807
Modified:
trunk/jsf/docs/userguide/en/modules/JSFStruts_tools.xml
Log:
http://jira.jboss.com/jira/browse/JBDS-162 - inserting transitional & introductory sentences;
Modified: trunk/jsf/docs/userguide/en/modules/JSFStruts_tools.xml
===================================================================
--- trunk/jsf/docs/userguide/en/modules/JSFStruts_tools.xml 2008-03-08 04:56:00 UTC (rev 6806)
+++ trunk/jsf/docs/userguide/en/modules/JSFStruts_tools.xml 2008-03-08 09:10:43 UTC (rev 6807)
@@ -720,7 +720,9 @@
templating capability for creating new and importing
existing Struts and JSF projects. This templating facility
has a variety of aspects to consider. But, let's
- start with the most straightforward case.</para>
+ start with the most straightforward case and consider the
+ process of creating a template from your existing JSF
+ project.</para>
<para>Let's say you have a project that you want to use as
the basis for a new <property>template</property>. Follow
@@ -806,8 +808,10 @@
<section id="GraphicalEditorAndViewingForJSFConfigurationFiles76331">
<title>Graphical Editor and Viewing for JSF Configuration Files</title>
- <para>JBDS provides a graphical editor for working with JSF configuration
- file (faces-config.xml). The editor has three main viewers (modes):</para>
+ <para><property>JBDS</property> provides a graphical editor for working with
+ JSF configuration file (<emphasis>
+ <property>faces-config.xml</property>
+ </emphasis>). The editor has three main viewers (modes):</para>
<itemizedlist>
<listitem>
@@ -825,7 +829,9 @@
<para>The JSF configuration editor also comes with a very useful <link
linkend="OpenOnSelection4Hyperlinknavigation">OpenOn</link>
- selection feature.</para>
+ selection feature. Now let's dwell on each mode and all
+ specific functionality which they provide for work with JSF
+ configuration file.</para>
<section id="Diagram9553">
@@ -1138,7 +1144,7 @@
<itemizedlist>
<listitem>
- <para>Click on <emphasis>
+ <para>click on <emphasis>
<property>Managed-Bean-Class</property>
</emphasis> link in the editor</para>
</listitem>
@@ -1230,7 +1236,9 @@
</imageobject>
</mediaobject>
</figure>
-
+ <para>Thus, we've discussed everything which comes to
+ creating a new Managed Bean. Further we will show you how to
+ add an existing Bean into a JSF configuration file.</para>
</section>
<section id="AddExistingJavaBeansToAJSFConfigurationFile74332">
@@ -1268,8 +1276,7 @@
</emphasis> dialog where all corresponding properties are
displayed. Check the necessary ones to add them into your
<property>JSF Configuration File</property>.</para>
- <para>If you don't want to add any, just click <emphasis>
- <property>Finish</property>. </emphasis></para>
+
<figure>
<title>Selection of Bean's Properties.</title>
<mediaobject>
@@ -1280,7 +1287,15 @@
</imageobject>
</mediaobject>
</figure>
+
+ <para>If you don't want to add any, just click <emphasis>
+ <property>Finish</property>. </emphasis></para>
</section>
+ <para>Above-listed steps have demonstrated specifying an existing Bean in
+ the JSF configuration file, i.e. <emphasis>
+ <property>faces-config.xml</property>. </emphasis> In the
+ next section you'll know how to organize and register a
+ custom Converter to specify your own converting rules.</para>
</section>
<section id="CreateAndRegisterACustomConverter94230">
@@ -1364,8 +1379,10 @@
<itemizedlist>
<listitem>
- <para>Java class will be created automatically. Leave
- everything without changes and click <emphasis>
+ <para>A usual wizard for creating a Java class will appear.
+ All needed fields here will be adjusted
+ automatically. Just leave everything without changes
+ and click <emphasis>
<property>Finish</property>.
</emphasis></para>
</listitem>
@@ -1399,14 +1416,16 @@
</imageobject>
</mediaobject>
</figure>
+
</section>
<section id="CreateAndRegisterACustomValidator5632">
<title>Create and Register a Custom Validator</title>
- <para>With the help of JBDS you can easy develop your own custom validators.
- Go through the following steps:</para>
+ <para>With the help of JBDS it's also quite easy to develop your
+ own custom Validators. You should perform the actions similar to previous. Go through the
+ following steps:</para>
<itemizedlist>
<listitem>
<para>In the Project Explorer view open<emphasis>
@@ -1628,15 +1647,20 @@
</figure>
</section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>If you don't familiar with <ulink
+ url="http://java.sun.com/javaee/javaserverfaces/">JSF
+ technology</ulink>, we suggest that you walk through the
+ information on the topic.</para>
+ </section>
</section>
<section id="Struts_support">
<title>Struts support</title>
- <para>If you prefer develop web applications using <ulink
- url="http://struts.apache.org/">
- <property>Struts</property>
- </ulink> technology JBoss Developer Studio also meets your needs.</para>
+ <para>If you prefer develop web applications using <property>Struts</property>
+ technology JBoss Developer Studio also meets your needs.</para>
<para>JBDS supports the <property>Struts 1.1</property>, <property>1.2.x</property>
versions.</para>
@@ -2657,6 +2681,12 @@
</figure>
</section>
+ <section>
+ <title>Relevant Resources Links</title>
+ <para>Find out necessary information on <ulink
+ url="http://struts.apache.org/">Struts technology</ulink> if
+ you don't know enough.</para>
+ </section>
</section>
<section id="verif_valid">
16 years, 3 months
JBoss Tools SVN: r6806 - in trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test: model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 23:56:00 -0500 (Fri, 07 Mar 2008)
New Revision: 6806
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
Log:
Committing just so I can work from home this weekend.
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 04:21:26 UTC (rev 6805)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 04:56:00 UTC (rev 6806)
@@ -4,6 +4,7 @@
import junit.framework.TestSuite;
import org.jboss.ide.eclipse.archives.test.core.ArchivesCoreTest;
+import org.jboss.ide.eclipse.archives.test.model.ModelCreationTest;
import org.jboss.ide.eclipse.archives.test.model.XBMarshallTest;
import org.jboss.ide.eclipse.archives.test.model.XBUnmarshallTest;
import org.jboss.ide.eclipse.archives.test.util.TruezipUtilTest;
@@ -16,7 +17,7 @@
suite.addTestSuite(XBUnmarshallTest.class);
suite.addTestSuite(TruezipUtilTest.class);
suite.addTestSuite(ModelUtilTest.class);
-
+ suite.addTestSuite(ModelCreationTest.class);
return suite;
}
Added: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java 2008-03-08 04:56:00 UTC (rev 6806)
@@ -0,0 +1,71 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.test.model;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveBuildListener;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListener;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveModelListenerManager;
+import org.jboss.ide.eclipse.archives.core.model.internal.ArchiveModelNode;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+
+/**
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class ModelCreationTest extends TestCase {
+ public void testModelCreation1() {
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ packs.addChild(pack);
+ ArchiveModelNode model = getModel(packs);
+ ModelUtil.fillArchiveModel(packs, model);
+ // passes for now.
+ }
+
+ protected ArchiveModelNode getModel(XbPackages packs) {
+ IArchiveModelListenerManager manager = new IArchiveModelListenerManager() {
+ public void addBuildListener(IArchiveBuildListener listener) {
+ }
+ public void addModelListener(IArchiveModelListener listener) {
+ }
+ public IArchiveBuildListener[] getBuildListeners() {
+ return new IArchiveBuildListener[] {};
+ }
+ public IArchiveModelListener[] getModelListeners() {
+ return new IArchiveModelListener[] {};
+ }
+ public void removeBuildListener(IArchiveBuildListener listener) {
+ }
+ public void removeModelListener(IArchiveModelListener listener) {
+ }
+ };
+ IPath project = new Path("test").append("two");
+ ArchiveModelNode node = new ArchiveModelNode(project, packs, manager);
+ return node;
+ }
+}
16 years, 3 months
JBoss Tools SVN: r6805 - in trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 23:21:26 -0500 (Fri, 07 Mar 2008)
New Revision: 6805
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
Log:
renamed model creation method, changed signature to void
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-03-08 03:44:21 UTC (rev 6804)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/ArchivesModel.java 2008-03-08 04:21:26 UTC (rev 6805)
@@ -245,7 +245,7 @@
ArchiveModelNode oldRoot = archivesRoot.get(project);
xbPackages.put(project, packages);
archivesRoot.put(project, root);
- ModelUtil.createPackagesNodeImpl(packages, (ArchiveModelNode)getRoot(project));
+ ModelUtil.fillArchiveModel(packages, (ArchiveModelNode)getRoot(project));
root.clearDeltas();
fireRegisterProjectEvent(oldRoot, root);
monitor.worked(1);
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2008-03-08 03:44:21 UTC (rev 6804)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/util/ModelUtil.java 2008-03-08 04:21:26 UTC (rev 6805)
@@ -222,7 +222,7 @@
return projectPath.append(workspacePath.removeFirstSegments(1));
}
- public static ArchiveNodeImpl createPackagesNodeImpl( XbPackages node, IArchiveModelNode modelNode) {
+ public static void fillArchiveModel( XbPackages node, IArchiveModelNode modelNode) {
for (Iterator iter = node.getAllChildren().iterator(); iter.hasNext(); ) {
XbPackageNode child = (XbPackageNode) iter.next();
ArchiveNodeImpl childImpl = (ArchiveNodeImpl)createPackageNodeImpl(child, modelNode);
@@ -233,7 +233,6 @@
modelNode.addChild(childImpl);
}
}
- return null;
}
protected static IArchiveNode createPackageNodeImpl (XbPackageNode node, IArchiveNode parent) {
16 years, 3 months
JBoss Tools SVN: r6804 - in trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test: model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 22:44:21 -0500 (Fri, 07 Mar 2008)
New Revision: 6804
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBMarshallTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBUnmarshallTest.java
Removed:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
Log:
Archives Unit Tests
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 03:43:41 UTC (rev 6803)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 03:44:21 UTC (rev 6804)
@@ -4,16 +4,16 @@
import junit.framework.TestSuite;
import org.jboss.ide.eclipse.archives.test.core.ArchivesCoreTest;
-import org.jboss.ide.eclipse.archives.test.model.MarshallTest;
-import org.jboss.ide.eclipse.archives.test.model.UnmarshallTest;
+import org.jboss.ide.eclipse.archives.test.model.XBMarshallTest;
+import org.jboss.ide.eclipse.archives.test.model.XBUnmarshallTest;
import org.jboss.ide.eclipse.archives.test.util.TruezipUtilTest;
public class ArchivesTestSuite extends TestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("Archives Tests");
suite.addTestSuite(ArchivesCoreTest.class);
- suite.addTestSuite(MarshallTest.class);
- suite.addTestSuite(UnmarshallTest.class);
+ suite.addTestSuite(XBMarshallTest.class);
+ suite.addTestSuite(XBUnmarshallTest.class);
suite.addTestSuite(TruezipUtilTest.class);
suite.addTestSuite(ModelUtilTest.class);
Deleted: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java 2008-03-08 03:43:41 UTC (rev 6803)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java 2008-03-08 03:44:21 UTC (rev 6804)
@@ -1,254 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.archives.test.model;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbAction;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbProperty;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
-import org.jboss.ide.eclipse.archives.test.ArchivesTest;
-import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
-import org.osgi.framework.Bundle;
-
-/**
- *
- * This class tests marshalling each type of xb object,
- * expecting the XMLBinding class (and XB itself) to throw
- * errors if required fields are missing.
- *
- * It also verifies correct models are properly marshalled.
- *
- * @author rob.stryker <rob.stryker(a)redhat.com>
- *
- */
-public class MarshallTest extends TestCase {
- private Bundle bundle;
- private IPath bundlePath;
- private IPath expectedOutputs;
- private IPath outputs;
- protected void setUp() {
- if( bundlePath == null ) {
- try {
- bundle = ArchivesTest.getDefault().getBundle();
- URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
- bundlePath = new Path(bundleURL.getFile());
- expectedOutputs = bundlePath.append("expectedOutputs");
- outputs = bundlePath.append("output");
- } catch( IOException ioe) {
- fail("Failed to set up " + getClass().getName());
- }
- }
- }
-
- public void tearDown() {
- FileIOUtil.clearFolder(outputs.toFile().listFiles());
- }
-
- public void testStringWriter() {
- XbPackages packs = new XbPackages();
- try {
- File expected = expectedOutputs.append("emptyPackages.xml").toFile();
- String expectedContents = FileIOUtil.getFileContents(expected);
- String asString = XMLBinding.serializePackages(packs, new NullProgressMonitor());
- assertEquals(asString, expectedContents);
- } catch( XbException xbe ) {
- fail(xbe.getMessage());
- }
- }
-
- public void testFileWriter() {
- XbPackages packs = new XbPackages();
- IPath out = outputs.append("test.xml");
- try {
- File expected = expectedOutputs.append("emptyPackages.xml").toFile();
- String expectedContents = FileIOUtil.getFileContents(expected);
-
- XMLBinding.marshallToFile(packs, out, new NullProgressMonitor());
- String actualContents = FileIOUtil.getFileContents(out.toFile());
-
- assertEquals(expectedContents, actualContents);
- } catch( XbException xbe ) {
- xbe.printStackTrace();
- fail(xbe.getMessage());
- } catch( IOException ioe ) {
- fail(ioe.getMessage());
- }
- }
-
- protected void write(XbPackages packs, boolean shouldPass) {
- XbException e = null;
- try {
- IPath out = outputs.append("test.xml");
- XMLBinding.marshallToFile(packs, out, new NullProgressMonitor());
- } catch( IOException ioe ) {
- fail("IOException during testWritePackage operation");
- }catch( XbException xbe ) {
- e = xbe;
- } finally {
- if( e == null && !shouldPass) {
- fail("Incomplete Model saved when it should not have been.");
- }
- if( e != null && shouldPass) {
- fail("Model failed to save when it should have saved. " + e.getMessage());
- }
- }
- }
-
- protected void writePackage(String name, String toDir, boolean shouldPass) {
- XbException e = null;
- XbPackages packs = new XbPackages();
- XbPackage pack = new XbPackage();
- pack.setName(name);
- pack.setToDir(toDir);
- packs.addChild(pack);
- write(packs, shouldPass);
- }
-
- public void testWritePackageSuccess() {
- writePackage("someName", "someFile.jar", true);
- }
- public void testWritePackageMissingName() {
- writePackage(null, "someFile.jar", false);
- }
-
- public void testWritePackageMissingDir() {
- writePackage("someName", null, false);
- }
-
- protected void writeProperties(String name, String value, boolean shouldPass) {
- XbPackages packs = new XbPackages();
- XbPackage pack = new XbPackage();
- pack.setName("test");
- pack.setToDir("test2");
- XbProperty property = new XbProperty();
-
- try {
- property.setName(name);
- property.setValue(value);
- pack.getProperties().addProperty(property);
- } catch( NullPointerException npe ) {
- if( shouldPass )
- fail("Model failed to save when it should have saved. - " + npe.getMessage());
- return; // success
- }
-
- packs.addChild(pack);
- write(packs, shouldPass);
- }
-
- public void testWritePropertiesSuccess() {
- writeProperties("name", "val", true);
- }
-
- public void testWritePropertiesMissingName() {
- writeProperties(null, "val", false);
- }
-
- public void testWritePropertiesMissingValue() {
- writeProperties("name", null, false);
- }
-
- public void writeFolder(String name, boolean shouldPass) {
- XbPackages packs = new XbPackages();
- XbPackage pack = new XbPackage();
- pack.setName("name");
- pack.setToDir("todir");
- packs.addChild(pack);
- XbFolder folder = new XbFolder();
- folder.setName(name);
- pack.addChild(folder);
- write(packs, shouldPass);
- }
-
- public void testWriteFolderSuccess() {
- writeFolder("someFolder", true);
- }
-
- public void testWriteFolderMissingName() {
- writeFolder(null, false);
- }
-
- public void writeFileset(String dir, String includes, boolean shouldSucceed) {
- XbPackages packs = new XbPackages();
- XbPackage pack = new XbPackage();
- pack.setName("name");
- pack.setToDir("todir");
- packs.addChild(pack);
- XbFileSet fs = new XbFileSet();
- fs.setDir(dir);
- fs.setIncludes(includes);
- pack.addChild(fs);
- write(packs, shouldSucceed);
- }
-
- public void testWriteFilesetSuccess() {
- writeFileset("folder", "includes", true);
- }
-
- public void testWriteFilesetMissingFolder() {
- writeFileset(null, "includes", false);
- }
-
- public void testWriteFilesetMissingIncludes() {
- writeFileset("path", null, false);
- }
-
-
- protected void writeAction(String time, String type, boolean shouldSucceed) {
- XbPackages packs = new XbPackages();
- XbPackage pack = new XbPackage();
- pack.setName("name");
- pack.setToDir("todir");
- packs.addChild(pack);
- XbAction act = new XbAction();
- act.setTime(time);
- act.setType(type);
- pack.addChild(act);
- write(packs, shouldSucceed);
- }
-
- public void testWriteActionSuccess() {
- writeAction("preBuild", "ant", true);
- }
-
- public void testWriteActionMissingTime() {
- writeAction(null, "ant", false);
- }
-
- public void testWriteActionMissingType() {
- writeAction("preBuild", null, false);
- }
-}
Deleted: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java 2008-03-08 03:43:41 UTC (rev 6803)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java 2008-03-08 03:44:21 UTC (rev 6804)
@@ -1,227 +0,0 @@
-/**
- * JBoss, a Division of Red Hat
- * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
-* This 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 software 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 software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ide.eclipse.archives.test.model;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
-import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
-import org.jboss.ide.eclipse.archives.test.ArchivesTest;
-import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
-import org.osgi.framework.Bundle;
-
-/**
- * Tests unmarshalling and validating packaging files.
- * The tests expect XB to throw exceptions when improper
- * nonconformant files are parsed.
- *
- * @author rob.stryker <rob.stryker(a)redhat.com>
- *
- */
-public class UnmarshallTest extends TestCase {
- private Bundle bundle;
- private IPath bundlePath;
- private IPath archiveDescriptors;
- protected void setUp() {
- if( bundlePath == null ) {
- try {
- bundle = ArchivesTest.getDefault().getBundle();
- URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
- bundlePath = new Path(bundleURL.getFile());
- archiveDescriptors = bundlePath.append("inputs").append("archiveDescriptors").append("validation");
- } catch( IOException ioe) {
- fail("Failed to set up " + getClass().getName());
- }
- }
- }
-
- public void tearDown() {
- FileIOUtil.clearFolder(bundlePath.append("tmp").toFile().listFiles());
- }
-
- /*
- * The tests
- */
-
- public void testAbsoluteSchemaFailure() {
- parse("AbsoluteSchemaFailure.xml", false, "Broken schema successfully parsed.");
- }
-
- public void testAttributeSchemaFailure() {
- parse("AttributeSchemaFailure.xml", false, "Schema with random attribute successfully parsed.");
- }
-
-
- public void testCorrectPackage() {
- parse("CorrectPackage.xml", true, shouldParse("CorrectPackage.xml"));
- }
-
- public void testPackageMissingPackageName() {
- parse("MissingPackageName.xml", false, failedMissingRequiredAtt("name"));
- }
-
- public void testPackageMissingDirectory() {
- parse("MissingPackageDir.xml", false, failedMissingRequiredAtt("todir"));
- }
-
- public void testPackageMissingOptionalType() {
- parse("MissingPackageType.xml", true, failedFalsePositiveRequiredAtt("type"));
- }
-
- public void testPackageMissingOptionalExploded() {
- XbPackages packs = parse("MissingPackageExploded.xml", true, failedFalsePositiveRequiredAtt("exploded"));
- XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
- assertFalse(pack.isExploded());
- }
-
- public void testPackageMissingOptionalInWorkspace() {
- XbPackages packs = parse("MissingPackageInWorkspace.xml", true, failedFalsePositiveRequiredAtt("inWorkspace"));
- XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
- assertTrue(pack.isInWorkspace());
- }
-
- public void testPackageMissingOptionalId() {
- XbPackages packs = parse("MissingPackageID.xml", true, failedMissingRequiredAtt("id"));
- XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
- assertNull(pack.getId());
- }
-
- public void testCorrectFolder() {
- parse("CorrectFolder.xml", true, shouldParse("CorrectFolder.xml"));
- }
-
- public void testFolderMissingName() {
- parse("MissingFolderName.xml", false, failedMissingRequiredAtt("name"));
- }
-
- public void testCorrectProperties() {
- parse("CorrectProperties.xml", true, shouldParse("CorrectProperties.xml"));
- }
-
- public void testPropertiesMissingKey() {
- parse("MissingPropertiesName.xml", false, failedMissingRequiredAtt("name"));
- }
-
- public void testPropertiesMissingValue() {
- parse("MissingPropertiesValue.xml", false, failedMissingRequiredAtt("value"));
- }
-
-
- public void testCorrectFileset() {
- parse("CorrectFileset.xml", true, shouldParse("CorrectFileset.xml"));
- }
-
- public void testFilesetMissingDir() {
- parse("MissingFilesetDir.xml", false, failedMissingRequiredAtt("todir"));
- }
-
- public void testFilesetMissingIncludes() {
- parse("MissingFilesetIncludes.xml", false, failedMissingRequiredAtt("includes"));
- }
-
- public void testFilesetMissingOptionalExcludes() {
- parse("MissingFilesetExcludes.xml", true, failedFalsePositiveRequiredAtt("excludes"));
- // no default
- }
-
- public void testFilesetMissingOptionalInWorkspace() {
- XbPackages packs = parse("MissingFilesetInWorkspace.xml", true, failedFalsePositiveRequiredAtt("inWorkspace"));
- // no default
- XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
- List l = pack.getChildren(XbFileSet.class);
- assertNotNull(l);
- assertEquals(1, l.size());
- XbFileSet fs = (XbFileSet)l.get(0);
- assertTrue(fs.isInWorkspace());
- }
-
- public void testFilesetMissingOptionalFlattened() {
- XbPackages packs = parse("MissingFilesetFlattened.xml", true, failedFalsePositiveRequiredAtt("flattened"));
- // no default
- XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
- List l = pack.getChildren(XbFileSet.class);
- assertNotNull(l);
- assertEquals(1, l.size());
- XbFileSet fs = (XbFileSet)l.get(0);
- assertFalse(fs.isFlattened());
- }
-
-
- public void testCorrectAction() {
- parse("CorrectAction.xml", true, shouldParse("CorrectAction.xml"));
- }
-
- public void testActionMissingTime() {
- parse("MissingActionTime.xml", false, failedMissingRequiredAtt("time"));
- }
-
- public void testActionMissingType() {
- parse("MissingActionType.xml", false, failedMissingRequiredAtt("type"));
- }
-
-
- /*
- * Utility
- */
-
- protected XbPackages parse(String file, boolean shouldSucceed, String failMsg) {
- FileInputStream fis = null;
- XbPackages packs = null;
- try {
- fis = new FileInputStream(archiveDescriptors.append(file).toFile());
- packs = XMLBinding.unmarshal(fis, new NullProgressMonitor());
- } catch( IOException ioe ) {
- fail(ioe.getMessage());
- } catch( XbException e ) {
- if( shouldSucceed )
- fail(failMsg + " - " + e.getMessage());
- return packs;
- }
- if( !shouldSucceed )
- fail(failMsg);
- return packs;
- }
-
- protected String failedMissingRequiredAtt(String att) {
- return "File parsed while missing a required attribute: " + att;
- }
-
- protected String failedFalsePositiveRequiredAtt(String attribute) {
- return "File failed to parse even though \"" + attribute + "\" is not required";
- }
-
- protected String shouldParse(String file) {
- return file + " should parse correctly.";
- }
-}
Copied: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBMarshallTest.java (from rev 6803, trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java)
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBMarshallTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBMarshallTest.java 2008-03-08 03:44:21 UTC (rev 6804)
@@ -0,0 +1,254 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.test.model;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbAction;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFolder;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbProperty;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
+import org.jboss.ide.eclipse.archives.test.ArchivesTest;
+import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * This class tests marshalling each type of xb object,
+ * expecting the XMLBinding class (and XB itself) to throw
+ * errors if required fields are missing.
+ *
+ * It also verifies correct models are properly marshalled.
+ *
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class XBMarshallTest extends TestCase {
+ private Bundle bundle;
+ private IPath bundlePath;
+ private IPath expectedOutputs;
+ private IPath outputs;
+ protected void setUp() {
+ if( bundlePath == null ) {
+ try {
+ bundle = ArchivesTest.getDefault().getBundle();
+ URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
+ bundlePath = new Path(bundleURL.getFile());
+ expectedOutputs = bundlePath.append("expectedOutputs");
+ outputs = bundlePath.append("output");
+ } catch( IOException ioe) {
+ fail("Failed to set up " + getClass().getName());
+ }
+ }
+ }
+
+ public void tearDown() {
+ FileIOUtil.clearFolder(outputs.toFile().listFiles());
+ }
+
+ public void testStringWriter() {
+ XbPackages packs = new XbPackages();
+ try {
+ File expected = expectedOutputs.append("emptyPackages.xml").toFile();
+ String expectedContents = FileIOUtil.getFileContents(expected);
+ String asString = XMLBinding.serializePackages(packs, new NullProgressMonitor());
+ assertEquals(asString, expectedContents);
+ } catch( XbException xbe ) {
+ fail(xbe.getMessage());
+ }
+ }
+
+ public void testFileWriter() {
+ XbPackages packs = new XbPackages();
+ IPath out = outputs.append("test.xml");
+ try {
+ File expected = expectedOutputs.append("emptyPackages.xml").toFile();
+ String expectedContents = FileIOUtil.getFileContents(expected);
+
+ XMLBinding.marshallToFile(packs, out, new NullProgressMonitor());
+ String actualContents = FileIOUtil.getFileContents(out.toFile());
+
+ assertEquals(expectedContents, actualContents);
+ } catch( XbException xbe ) {
+ xbe.printStackTrace();
+ fail(xbe.getMessage());
+ } catch( IOException ioe ) {
+ fail(ioe.getMessage());
+ }
+ }
+
+ protected void write(XbPackages packs, boolean shouldPass) {
+ XbException e = null;
+ try {
+ IPath out = outputs.append("test.xml");
+ XMLBinding.marshallToFile(packs, out, new NullProgressMonitor());
+ } catch( IOException ioe ) {
+ fail("IOException during testWritePackage operation");
+ }catch( XbException xbe ) {
+ e = xbe;
+ } finally {
+ if( e == null && !shouldPass) {
+ fail("Incomplete Model saved when it should not have been.");
+ }
+ if( e != null && shouldPass) {
+ fail("Model failed to save when it should have saved. " + e.getMessage());
+ }
+ }
+ }
+
+ protected void writePackage(String name, String toDir, boolean shouldPass) {
+ XbException e = null;
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ pack.setName(name);
+ pack.setToDir(toDir);
+ packs.addChild(pack);
+ write(packs, shouldPass);
+ }
+
+ public void testWritePackageSuccess() {
+ writePackage("someName", "someFile.jar", true);
+ }
+ public void testWritePackageMissingName() {
+ writePackage(null, "someFile.jar", false);
+ }
+
+ public void testWritePackageMissingDir() {
+ writePackage("someName", null, false);
+ }
+
+ protected void writeProperties(String name, String value, boolean shouldPass) {
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ pack.setName("test");
+ pack.setToDir("test2");
+ XbProperty property = new XbProperty();
+
+ try {
+ property.setName(name);
+ property.setValue(value);
+ pack.getProperties().addProperty(property);
+ } catch( NullPointerException npe ) {
+ if( shouldPass )
+ fail("Model failed to save when it should have saved. - " + npe.getMessage());
+ return; // success
+ }
+
+ packs.addChild(pack);
+ write(packs, shouldPass);
+ }
+
+ public void testWritePropertiesSuccess() {
+ writeProperties("name", "val", true);
+ }
+
+ public void testWritePropertiesMissingName() {
+ writeProperties(null, "val", false);
+ }
+
+ public void testWritePropertiesMissingValue() {
+ writeProperties("name", null, false);
+ }
+
+ public void writeFolder(String name, boolean shouldPass) {
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ pack.setName("name");
+ pack.setToDir("todir");
+ packs.addChild(pack);
+ XbFolder folder = new XbFolder();
+ folder.setName(name);
+ pack.addChild(folder);
+ write(packs, shouldPass);
+ }
+
+ public void testWriteFolderSuccess() {
+ writeFolder("someFolder", true);
+ }
+
+ public void testWriteFolderMissingName() {
+ writeFolder(null, false);
+ }
+
+ public void writeFileset(String dir, String includes, boolean shouldSucceed) {
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ pack.setName("name");
+ pack.setToDir("todir");
+ packs.addChild(pack);
+ XbFileSet fs = new XbFileSet();
+ fs.setDir(dir);
+ fs.setIncludes(includes);
+ pack.addChild(fs);
+ write(packs, shouldSucceed);
+ }
+
+ public void testWriteFilesetSuccess() {
+ writeFileset("folder", "includes", true);
+ }
+
+ public void testWriteFilesetMissingFolder() {
+ writeFileset(null, "includes", false);
+ }
+
+ public void testWriteFilesetMissingIncludes() {
+ writeFileset("path", null, false);
+ }
+
+
+ protected void writeAction(String time, String type, boolean shouldSucceed) {
+ XbPackages packs = new XbPackages();
+ XbPackage pack = new XbPackage();
+ pack.setName("name");
+ pack.setToDir("todir");
+ packs.addChild(pack);
+ XbAction act = new XbAction();
+ act.setTime(time);
+ act.setType(type);
+ pack.addChild(act);
+ write(packs, shouldSucceed);
+ }
+
+ public void testWriteActionSuccess() {
+ writeAction("preBuild", "ant", true);
+ }
+
+ public void testWriteActionMissingTime() {
+ writeAction(null, "ant", false);
+ }
+
+ public void testWriteActionMissingType() {
+ writeAction("preBuild", null, false);
+ }
+}
Copied: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBUnmarshallTest.java (from rev 6803, trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java)
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBUnmarshallTest.java (rev 0)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/XBUnmarshallTest.java 2008-03-08 03:44:21 UTC (rev 6804)
@@ -0,0 +1,227 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This 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 software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.test.model;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbFileSet;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
+import org.jboss.ide.eclipse.archives.core.model.internal.xb.XMLBinding.XbException;
+import org.jboss.ide.eclipse.archives.test.ArchivesTest;
+import org.jboss.ide.eclipse.archives.test.util.FileIOUtil;
+import org.osgi.framework.Bundle;
+
+/**
+ * Tests unmarshalling and validating packaging files.
+ * The tests expect XB to throw exceptions when improper
+ * nonconformant files are parsed.
+ *
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class XBUnmarshallTest extends TestCase {
+ private Bundle bundle;
+ private IPath bundlePath;
+ private IPath archiveDescriptors;
+ protected void setUp() {
+ if( bundlePath == null ) {
+ try {
+ bundle = ArchivesTest.getDefault().getBundle();
+ URL bundleURL = FileLocator.toFileURL(bundle.getEntry(""));
+ bundlePath = new Path(bundleURL.getFile());
+ archiveDescriptors = bundlePath.append("inputs").append("archiveDescriptors").append("validation");
+ } catch( IOException ioe) {
+ fail("Failed to set up " + getClass().getName());
+ }
+ }
+ }
+
+ public void tearDown() {
+ FileIOUtil.clearFolder(bundlePath.append("tmp").toFile().listFiles());
+ }
+
+ /*
+ * The tests
+ */
+
+ public void testAbsoluteSchemaFailure() {
+ parse("AbsoluteSchemaFailure.xml", false, "Broken schema successfully parsed.");
+ }
+
+ public void testAttributeSchemaFailure() {
+ parse("AttributeSchemaFailure.xml", false, "Schema with random attribute successfully parsed.");
+ }
+
+
+ public void testCorrectPackage() {
+ parse("CorrectPackage.xml", true, shouldParse("CorrectPackage.xml"));
+ }
+
+ public void testPackageMissingPackageName() {
+ parse("MissingPackageName.xml", false, failedMissingRequiredAtt("name"));
+ }
+
+ public void testPackageMissingDirectory() {
+ parse("MissingPackageDir.xml", false, failedMissingRequiredAtt("todir"));
+ }
+
+ public void testPackageMissingOptionalType() {
+ parse("MissingPackageType.xml", true, failedFalsePositiveRequiredAtt("type"));
+ }
+
+ public void testPackageMissingOptionalExploded() {
+ XbPackages packs = parse("MissingPackageExploded.xml", true, failedFalsePositiveRequiredAtt("exploded"));
+ XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
+ assertFalse(pack.isExploded());
+ }
+
+ public void testPackageMissingOptionalInWorkspace() {
+ XbPackages packs = parse("MissingPackageInWorkspace.xml", true, failedFalsePositiveRequiredAtt("inWorkspace"));
+ XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
+ assertTrue(pack.isInWorkspace());
+ }
+
+ public void testPackageMissingOptionalId() {
+ XbPackages packs = parse("MissingPackageID.xml", true, failedMissingRequiredAtt("id"));
+ XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
+ assertNull(pack.getId());
+ }
+
+ public void testCorrectFolder() {
+ parse("CorrectFolder.xml", true, shouldParse("CorrectFolder.xml"));
+ }
+
+ public void testFolderMissingName() {
+ parse("MissingFolderName.xml", false, failedMissingRequiredAtt("name"));
+ }
+
+ public void testCorrectProperties() {
+ parse("CorrectProperties.xml", true, shouldParse("CorrectProperties.xml"));
+ }
+
+ public void testPropertiesMissingKey() {
+ parse("MissingPropertiesName.xml", false, failedMissingRequiredAtt("name"));
+ }
+
+ public void testPropertiesMissingValue() {
+ parse("MissingPropertiesValue.xml", false, failedMissingRequiredAtt("value"));
+ }
+
+
+ public void testCorrectFileset() {
+ parse("CorrectFileset.xml", true, shouldParse("CorrectFileset.xml"));
+ }
+
+ public void testFilesetMissingDir() {
+ parse("MissingFilesetDir.xml", false, failedMissingRequiredAtt("todir"));
+ }
+
+ public void testFilesetMissingIncludes() {
+ parse("MissingFilesetIncludes.xml", false, failedMissingRequiredAtt("includes"));
+ }
+
+ public void testFilesetMissingOptionalExcludes() {
+ parse("MissingFilesetExcludes.xml", true, failedFalsePositiveRequiredAtt("excludes"));
+ // no default
+ }
+
+ public void testFilesetMissingOptionalInWorkspace() {
+ XbPackages packs = parse("MissingFilesetInWorkspace.xml", true, failedFalsePositiveRequiredAtt("inWorkspace"));
+ // no default
+ XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
+ List l = pack.getChildren(XbFileSet.class);
+ assertNotNull(l);
+ assertEquals(1, l.size());
+ XbFileSet fs = (XbFileSet)l.get(0);
+ assertTrue(fs.isInWorkspace());
+ }
+
+ public void testFilesetMissingOptionalFlattened() {
+ XbPackages packs = parse("MissingFilesetFlattened.xml", true, failedFalsePositiveRequiredAtt("flattened"));
+ // no default
+ XbPackage pack = (XbPackage)packs.getAllChildren().get(0);
+ List l = pack.getChildren(XbFileSet.class);
+ assertNotNull(l);
+ assertEquals(1, l.size());
+ XbFileSet fs = (XbFileSet)l.get(0);
+ assertFalse(fs.isFlattened());
+ }
+
+
+ public void testCorrectAction() {
+ parse("CorrectAction.xml", true, shouldParse("CorrectAction.xml"));
+ }
+
+ public void testActionMissingTime() {
+ parse("MissingActionTime.xml", false, failedMissingRequiredAtt("time"));
+ }
+
+ public void testActionMissingType() {
+ parse("MissingActionType.xml", false, failedMissingRequiredAtt("type"));
+ }
+
+
+ /*
+ * Utility
+ */
+
+ protected XbPackages parse(String file, boolean shouldSucceed, String failMsg) {
+ FileInputStream fis = null;
+ XbPackages packs = null;
+ try {
+ fis = new FileInputStream(archiveDescriptors.append(file).toFile());
+ packs = XMLBinding.unmarshal(fis, new NullProgressMonitor());
+ } catch( IOException ioe ) {
+ fail(ioe.getMessage());
+ } catch( XbException e ) {
+ if( shouldSucceed )
+ fail(failMsg + " - " + e.getMessage());
+ return packs;
+ }
+ if( !shouldSucceed )
+ fail(failMsg);
+ return packs;
+ }
+
+ protected String failedMissingRequiredAtt(String att) {
+ return "File parsed while missing a required attribute: " + att;
+ }
+
+ protected String failedFalsePositiveRequiredAtt(String attribute) {
+ return "File failed to parse even though \"" + attribute + "\" is not required";
+ }
+
+ protected String shouldParse(String file) {
+ return file + " should parse correctly.";
+ }
+}
16 years, 3 months
JBoss Tools SVN: r6803 - in trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test: model and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 22:43:41 -0500 (Fri, 07 Mar 2008)
New Revision: 6803
Added:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/
Removed:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/xb/
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java
Log:
Archives Unit Tests
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 02:58:30 UTC (rev 6802)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/ArchivesTestSuite.java 2008-03-08 03:43:41 UTC (rev 6803)
@@ -4,9 +4,9 @@
import junit.framework.TestSuite;
import org.jboss.ide.eclipse.archives.test.core.ArchivesCoreTest;
+import org.jboss.ide.eclipse.archives.test.model.MarshallTest;
+import org.jboss.ide.eclipse.archives.test.model.UnmarshallTest;
import org.jboss.ide.eclipse.archives.test.util.TruezipUtilTest;
-import org.jboss.ide.eclipse.archives.test.xb.MarshallTest;
-import org.jboss.ide.eclipse.archives.test.xb.UnmarshallTest;
public class ArchivesTestSuite extends TestSuite {
public static Test suite() {
Copied: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model (from rev 6802, trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/xb)
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/xb/MarshallTest.java 2008-03-08 02:58:30 UTC (rev 6802)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/MarshallTest.java 2008-03-08 03:43:41 UTC (rev 6803)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.archives.test.xb;
+package org.jboss.ide.eclipse.archives.test.model;
import java.io.File;
import java.io.IOException;
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/xb/UnmarshallTest.java 2008-03-08 02:58:30 UTC (rev 6802)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/UnmarshallTest.java 2008-03-08 03:43:41 UTC (rev 6803)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.ide.eclipse.archives.test.xb;
+package org.jboss.ide.eclipse.archives.test.model;
import java.io.FileInputStream;
import java.io.IOException;
16 years, 3 months
JBoss Tools SVN: r6802 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 21:58:30 -0500 (Fri, 07 Mar 2008)
New Revision: 6802
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java
Log:
Publish action should have been executed as a job. damnit.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java 2008-03-08 02:24:15 UTC (rev 6801)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/packages/PublishAction.java 2008-03-08 02:58:30 UTC (rev 6802)
@@ -21,6 +21,10 @@
*/
package org.jboss.ide.eclipse.as.ui.packages;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
@@ -40,13 +44,20 @@
public void run (IArchiveNode node) {
if (node.getNodeType() == IArchiveNode.TYPE_ARCHIVE
&& ((IArchive)node).isTopLevel()) {
- IArchive pkg = (IArchive)node;
+ final IArchive pkg = (IArchive)node;
String servers = node.getProperty(ArchivesBuildListener.DEPLOY_SERVERS);
if( servers == null || "".equals(servers) || anyServerDoesntExist(servers)){
servers = showSelectServersDialog(pkg);
}
- if( servers != null )
- ArchivesBuildListener.publish(pkg, servers, IServer.PUBLISH_FULL);
+ final String servers2 = servers;
+ if( servers != null ) {
+ Job j = new Job("Build Archive") {
+ protected IStatus run(IProgressMonitor monitor) {
+ ArchivesBuildListener.publish(pkg, servers2, IServer.PUBLISH_FULL);
+ return Status.OK_STATUS;
+ } };
+ j.schedule();
+ }
}
}
16 years, 3 months
JBoss Tools SVN: r6801 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: server/internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 21:24:15 -0500 (Fri, 07 Mar 2008)
New Revision: 6801
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JMXModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
Log:
JBIDE-828 - suspend / resume deployment scanner.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JMXModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JMXModel.java 2008-03-08 00:12:32 UTC (rev 6800)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/jmx/JMXModel.java 2008-03-08 02:24:15 UTC (rev 6801)
@@ -422,7 +422,7 @@
}
public interface JMXRunnable {
- public void run(MBeanServerConnection connection);
+ public void run(MBeanServerConnection connection) throws Exception;
}
public static class JMXSafeRunner {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2008-03-08 00:12:32 UTC (rev 6800)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2008-03-08 02:24:15 UTC (rev 6801)
@@ -21,6 +21,16 @@
*/
package org.jboss.ide.eclipse.as.core.server.internal;
+import java.io.IOException;
+
+import javax.management.InstanceNotFoundException;
+import javax.management.IntrospectionException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -31,10 +41,15 @@
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel;
import org.jboss.ide.eclipse.as.core.extensions.events.EventLogModel.EventLogTreeItem;
+import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXModel.JMXRunnable;
+import org.jboss.ide.eclipse.as.core.extensions.jmx.JMXModel.JMXSafeRunner;
+import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger;
+import org.jboss.ide.eclipse.as.core.publishers.PublisherEventLogger.PublishEvent;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.internal.launch.StopLaunchConfiguration;
@@ -174,4 +189,46 @@
pollThread.start();
}
+
+ protected void publishStart(IProgressMonitor monitor) throws CoreException {
+ super.publishStart(monitor);
+ if( shouldSuspendScanner() )
+ suspendDeployment();
+ }
+
+ protected void publishFinish(IProgressMonitor monitor) throws CoreException {
+ if( shouldSuspendScanner() )
+ resumeDeployment();
+ super.publishFinish(monitor);
+ }
+
+ protected boolean shouldSuspendScanner() {
+ if( getServer().getServerType().getId().equals("org.jboss.ide.eclipse.as.50"))
+ return false;
+ if( getServer().getServerState() != IServer.STATE_STARTED)
+ return false;
+ return true;
+ }
+
+ protected void suspendDeployment() {
+ JMXRunnable r = new JMXRunnable() {
+ public void run(MBeanServerConnection connection) throws Exception {
+ ObjectName name = new ObjectName("jboss.deployment:flavor=URL,type=DeploymentScanner");
+ connection.invoke(name, "stop", new Object[] { }, new String[] {});
+ }
+ };
+ JMXSafeRunner.run(getServer(), r);
+ }
+
+ protected void resumeDeployment() {
+ JMXRunnable r = new JMXRunnable() {
+ public void run(MBeanServerConnection connection) throws Exception {
+ ObjectName name = new ObjectName("jboss.deployment:flavor=URL,type=DeploymentScanner");
+ connection.invoke(name, "start", new Object[] { }, new String[] {});
+ }
+ };
+ JMXSafeRunner.run(getServer(), r);
+ }
+
+
}
16 years, 3 months
JBoss Tools SVN: r6800 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 19:12:32 -0500 (Fri, 07 Mar 2008)
New Revision: 6800
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
Log:
egregious bug for stopping with pw protection. ugh.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2008-03-07 23:56:21 UTC (rev 6799)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2008-03-08 00:12:32 UTC (rev 6800)
@@ -100,7 +100,7 @@
public static String getDefaultArgs(JBossServer jbs) throws CoreException {
String args = "-S ";
- args += "-s " + jbs.getServer().getHost() + ":" + jbs.getJNDIPort();
+ args += "-s " + jbs.getServer().getHost() + ":" + jbs.getJNDIPort() + " ";
if( jbs.getUsername() != null && !jbs.getUsername().equals(""))
args += "-u " + jbs.getUsername() + " ";
if( jbs.getPassword() != null && !jbs.getUsername().equals(""))
16 years, 3 months
JBoss Tools SVN: r6799 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui: launch and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 18:56:21 -0500 (Fri, 07 Mar 2008)
New Revision: 6799
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
Log:
incremental fix to the dialog. Saves by default, text boxes start with the text of the saved username and password.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2008-03-07 23:15:05 UTC (rev 6798)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2008-03-07 23:56:21 UTC (rev 6799)
@@ -37,6 +37,7 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.ui.Messages;
/**
@@ -47,10 +48,12 @@
private String user, pass;
private boolean save;
+ private JBossServer jbs;
- public RequiredCredentialsDialog(Shell parentShell) {
+ public RequiredCredentialsDialog(Shell parentShell, JBossServer jbs) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.jbs = jbs;
}
protected void configureShell(Shell newShell) {
@@ -106,6 +109,13 @@
userText.addModifyListener(listener);
passText.addModifyListener(listener);
saveCredentials.addSelectionListener(listener2);
+
+ // defaults
+ userText.setText(jbs.getUsername());
+ userText.setSelection(0, jbs.getUsername() == null ? 0 : jbs.getUsername().length());
+ passText.setText(jbs.getPassword());
+ // save by default
+ saveCredentials.setSelection(true);
return c;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-03-07 23:15:05 UTC (rev 6798)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-03-07 23:56:21 UTC (rev 6799)
@@ -33,12 +33,12 @@
public void handle(final IServerStatePoller poller, String action, List requiredProperties) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- RequiredCredentialsDialog d = new RequiredCredentialsDialog(new Shell());
+ IServer server = poller.getServer();
+ IServerWorkingCopy copy = server.createWorkingCopy();
+ JBossServer jbs = ServerConverter.getJBossServer(copy);
+ RequiredCredentialsDialog d = new RequiredCredentialsDialog(new Shell(), jbs);
if( d.open() == Window.OK) {
if( d.getSave() ) {
- IServer server = poller.getServer();
- IServerWorkingCopy copy = server.createWorkingCopy();
- JBossServer jbs = ServerConverter.getJBossServer(copy);
jbs.setPassword(d.getPass());
jbs.setUsername(d.getUser());
try {
16 years, 3 months
JBoss Tools SVN: r6798 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui: launch and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-07 18:15:05 -0500 (Fri, 07 Mar 2008)
New Revision: 6798
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
Log:
allows saving of credentials so the stop doesnt fail.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2008-03-07 23:14:47 UTC (rev 6797)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/dialogs/RequiredCredentialsDialog.java 2008-03-07 23:15:05 UTC (rev 6798)
@@ -25,10 +25,13 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -43,7 +46,8 @@
public class RequiredCredentialsDialog extends Dialog {
private String user, pass;
-
+ private boolean save;
+
public RequiredCredentialsDialog(Shell parentShell) {
super(parentShell);
setShellStyle(getShellStyle() | SWT.RESIZE);
@@ -68,31 +72,43 @@
final Text passText = new Text(main, SWT.DEFAULT);
userText.setEditable(true);
passText.setEditable(true);
+ final Button saveCredentials = new Button(main, SWT.CHECK);
-
top.setLayoutData(createFormData(0,5,null,0,0,5,100,-5));
userLabel.setLayoutData(createFormData(top, 10, null, 0, 0,5, 100, -5));
userText.setLayoutData(createFormData(userLabel, 5, null, 0, 0,5, 100, -5));
passLabel.setLayoutData(createFormData(userText, 10, null, 0, 0,5, 100, -5));
passText.setLayoutData(createFormData(passLabel, 5, null, 0, 0,5, 100, -5));
+ saveCredentials.setLayoutData(createFormData(passText, 10, null, 0, 0,5, 100, -5));
top.setText("Your server is throwing a security exception.\nYou should make sure to open the server\neditor and save the jmx username and password there.");
userLabel.setText(Messages.swf_Username);
passLabel.setText(Messages.swf_Password);
+ saveCredentials.setText("Save these credentials?");
ModifyListener listener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
user = userText.getText();
pass = passText.getText();
+ save = saveCredentials.getSelection();
}
};
+ SelectionListener listener2 = new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ user = userText.getText();
+ pass = passText.getText();
+ save = saveCredentials.getSelection();
+ }
+ };
userText.addModifyListener(listener);
passText.addModifyListener(listener);
+ saveCredentials.addSelectionListener(listener2);
return c;
}
-
-
private FormData createFormData(Object topStart, int topOffset, Object bottomStart, int bottomOffset,
Object leftStart, int leftOffset, Object rightStart, int rightOffset) {
FormData data = new FormData();
@@ -133,4 +149,11 @@
public String getPass() {
return pass;
}
+
+ /**
+ * @return whether to save
+ */
+ public boolean getSave() {
+ return save;
+ }
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-03-07 23:14:47 UTC (rev 6797)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/launch/SecurityFailureHandler.java 2008-03-07 23:15:05 UTC (rev 6798)
@@ -3,12 +3,17 @@
import java.util.List;
import java.util.Properties;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.extensions.polling.JMXPoller;
import org.jboss.ide.eclipse.as.core.server.IPollerFailureHandler;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.ui.dialogs.RequiredCredentialsDialog;
/**
@@ -30,6 +35,19 @@
public void run() {
RequiredCredentialsDialog d = new RequiredCredentialsDialog(new Shell());
if( d.open() == Window.OK) {
+ if( d.getSave() ) {
+ IServer server = poller.getServer();
+ IServerWorkingCopy copy = server.createWorkingCopy();
+ JBossServer jbs = ServerConverter.getJBossServer(copy);
+ jbs.setPassword(d.getPass());
+ jbs.setUsername(d.getUser());
+ try {
+ copy.save(false, null);
+ } catch( CoreException ce ) {
+ // TODO log
+ }
+ }
+
Properties p = new Properties();
p.put(JMXPoller.REQUIRED_USER, d.getUser());
p.put(JMXPoller.REQUIRED_PASS, d.getPass());
16 years, 3 months