Author: scabanovich
Date: 2008-02-29 12:09:40 -0500 (Fri, 29 Feb 2008)
New Revision: 6654
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ObjectDecoratorTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
Log:
JBIDE-1433 Test added.
Modified: trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF 2008-02-29
17:09:39 UTC (rev 6653)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/META-INF/MANIFEST.MF 2008-02-29
17:09:40 UTC (rev 6654)
@@ -8,5 +8,7 @@
org.jboss.tools.tests,
org.eclipse.ui,
org.jboss.tools.common,
- org.jboss.tools.common.model.ui
+ org.jboss.tools.common.model.ui,
+ org.jboss.tools.jst.web,
+ org.jboss.tools.jst.web.ui
Export-Package: org.jboss.tools.common.model.ui.test
Modified:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2008-02-29
17:09:39 UTC (rev 6653)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ModelUiAllTests.java 2008-02-29
17:09:40 UTC (rev 6654)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.common.model.ui.test;
+import junit.framework.Test;
import junit.framework.TestSuite;
/**
@@ -17,9 +18,14 @@
*
*/
public class ModelUiAllTests {
- public static TestSuite suite() {
+ public static final String PLUGIN_ID = "org.jboss.tools.common.model.ui";
+
+ public static Test suite() {
TestSuite suite = new TestSuite();
+ suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(ModelUiPreferencesPageTest.class);
+ suite.addTestSuite(ObjectDecoratorTest.class);
return suite;
}
+
}
Added:
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ObjectDecoratorTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ObjectDecoratorTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.model.ui.test/src/org/jboss/tools/common/model/ui/test/ObjectDecoratorTest.java 2008-02-29
17:09:40 UTC (rev 6654)
@@ -0,0 +1,44 @@
+package org.jboss.tools.common.model.ui.test;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.options.PreferenceModelUtilities;
+import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
+import org.jboss.tools.common.model.ui.navigator.decorator.XModelObjectDecorator;
+
+import junit.framework.TestCase;
+
+public class ObjectDecoratorTest extends TestCase {
+ static String ENTITY = "FileTLD_1_2";
+ static String ATTR_NAME = "name";
+ static String ATTR_DISPLAY = "display-name";
+ static String ATTR_URI = "uri";
+ static String ATTR_SHORTNAME = "shortname";
+
+ String[][] tests = {
+ {"{display-name}", "Taglib File"},
+ {"{name} - {uri}", "taglibFile.tld - http:/a.b.c/d"},
+ {"{name} : {shortname}", "taglibFile.tld : s"},
+ {"{name} -> {short-name}", "taglibFile.tld ->
{short-name}"},
+ };
+
+ public void testObjectDecorator() {
+ XModelObject o =
PreferenceModelUtilities.getPreferenceModel().createModelObject(ENTITY, new
Properties());
+ assertNotNull("Cannot create object for entity " + ENTITY, o);
+ o.setAttributeValue(ATTR_NAME, "taglibFile");
+ o.setAttributeValue(ATTR_DISPLAY, "Taglib File");
+ o.setAttributeValue(ATTR_URI, "http:/a.b.c/d");
+ o.setAttributeValue(ATTR_SHORTNAME, "s");
+
+ XModelObjectDecorator d = DecoratorManager.getInstance().getDecoratorByEntity(ENTITY);
+ assertNotNull("Cannot find decorator for " + ENTITY, d);
+
+ for (int i = 0; i < tests.length; i++) {
+ d.setValue(tests[i][0]);
+ String label = d.getLabel(o);
+ assertEquals("Unexpected label for format " + tests[i][0], tests[i][1],
label);
+ }
+ }
+
+}
Show replies by date