Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2006-12-20 19:15:11 +0000
committercbateman2006-12-20 19:15:11 +0000
commit623bbd8d47c78a3350dbb21a634bd631e5ec2f1b (patch)
tree61e67460dfc65bf90877d913799ea9fe01f25818
parent4c0c5397676e86bdbf252ebf7b63dd2cea26735e (diff)
downloadwebtools.jsf.tests-623bbd8d47c78a3350dbb21a634bd631e5ec2f1b.tar.gz
webtools.jsf.tests-623bbd8d47c78a3350dbb21a634bd631e5ec2f1b.tar.xz
webtools.jsf.tests-623bbd8d47c78a3350dbb21a634bd631e5ec2f1b.zip
First round of model changes:
- re-wrote JUnit tests for coverage - added translation for xml:lang attribute on descriptionGroup elements - added dynamic support for extension ANY data -- textContent not fully working yet.
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF3
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties5
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java9
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigApplicationTest.java31
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java282
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeComponent.java301
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeConverter.java308
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeValidator.java346
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadEmptyNavigationRule.java55
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadManagedBeanManagedProperty.java222
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadRenderer.java290
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationCase.java280
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationRule.java175
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleComponent.java255
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleConverter.java261
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleFactory.java195
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleManagedBean.java221
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleReferencedBean.java193
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleRenderKit.java222
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleValidator.java240
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplication.java403
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplicationTwoFiles.java763
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponent.java177
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponentTwoFiles.java453
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverter.java153
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverterTwoFiles.java859
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactory.java292
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactoryTwoFiles.java531
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycle.java146
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycleTwoFiles.java146
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBean.java159
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBeanTwoFiles.java507
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRule.java134
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.java595
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBean.java178
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.java321
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKit.java197
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKitTwoFiles.java1171
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidator.java537
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidatorTwoFiles.java652
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplTestForRead.java133
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryTest.java139
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigSingleTests.java32
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTests.java122
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWrite.java64
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWriteMultipleFiles.java77
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/MultipleFacesConfigFilesTest.java136
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/AllReadTests.java99
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadApplicationTestCase.java326
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeComponentTestCase.java276
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeConverterTestCase.java274
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeRendererTestCase.java267
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeValidatorTestCase.java274
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadComponentTestCase.java271
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadConverterTestCase.java194
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadExtensionDataTestCase.java86
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacesConfigElementsTestCase.java (renamed from jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigElementsTest.java)97
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetComponentTestCase.java185
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetRendererTestCase.java183
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFactoryTestCase.java179
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadLifecycleTestCase.java (renamed from jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleLifecycle.java)48
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanManagedPropertyTestCase.java293
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanTestCase.java246
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadNavigationRuleTestCase.java320
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyComponentTestCase.java267
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyConverterTestCase.java267
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyValidatorTestCase.java261
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadReferencedBeanTestCase.java139
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRenderKitTestCase.java159
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRendererTestCase.java228
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadValidatorTestCase.java176
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/CommonStructuresUtil.java654
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/FacesConfigModelUtil.java264
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/WizardUtil.java (renamed from jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/WizardUtil.java)53
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/AllWriteTests.java66
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteApplicationTestCase.java208
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentExtensionDataTestCase.java108
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentTestCase.java185
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteConverterTestCase.java160
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteFactoryTestCase.java171
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteLifecycleTestCase.java101
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteManagedBeanTestCase.java412
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteNavigationRuleTestCase.java210
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteReferencedBeanTestCase.java147
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteRenderKitTestCase.java241
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteValidatorTestCase.java161
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config-ext-data1.xml26
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml399
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml4
-rw-r--r--jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml4
90 files changed, 8493 insertions, 13167 deletions
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
index 93ac61d..768428d 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
@@ -28,5 +28,6 @@ Require-Bundle: org.eclipse.core.resources;visibility:=reexport,
org.eclipse.wst.xml.core,
org.junit,
org.eclipse.jst.jsf.facesconfig,
- org.eclipse.wst.common.tests.collector
+ org.eclipse.wst.common.tests.collector,
+ org.eclipse.jst.jsf.test.util
Eclipse-LazyStart: true
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties
index 34d2e4d..9601298 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties
@@ -1,4 +1,7 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .
+ .,\
+ plugin.xml,\
+ template/,\
+ _readme.txt
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java
index 8348bd8..363d702 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java
@@ -10,6 +10,9 @@
**************************************************************************************************/
package org.eclipse.jst.jsf.facesconfig.tests;
+import org.eclipse.jst.jsf.facesconfig.tests.read.AllReadTests;
+import org.eclipse.jst.jsf.facesconfig.tests.write.AllWriteTests;
+
import junit.framework.Test;
import junit.framework.TestSuite;
import junit.textui.TestRunner;
@@ -32,9 +35,7 @@ public class AllFacesConfigTests extends TestSuite {
public AllFacesConfigTests() {
super();
- addTest(FacesConfigTests.suite());
- addTest(FacesConfigTestsForWrite.suite());
- //FacesConfigTestsForWriteMultipleFiles
- addTest(FacesConfigTestsForWriteMultipleFiles.suite());
+ addTest(AllReadTests.suite());
+ addTest(AllWriteTests.suite());
}
}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigApplicationTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigApplicationTest.java
deleted file mode 100644
index 3ee9fb8..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigApplicationTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper suite for all the tests against the .util package.
- *
- * @author spaxton
- */
-public class FacesConfigApplicationTest {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Single Application tests ");
- //The following tests for single elements of the navigation-rule
- //(description, display-name, icon, from-action, to-view-id, redirect)
- suite.addTest(new TestSuite(FacesConfigFactoryImplForReadApplication.class));
-
- return suite;
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java
deleted file mode 100644
index 89b5dc6..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- *
- */
-public class FacesConfigFactoryImplForReadApplication extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadApplication(String name) {
- super(name);
- }
-
-
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the empty navigation rule. Since
- * I am supplying a single faces-config.xml file as a testing file, I had to
- * testcases fit in to it by controlling the conditions
- *
- */
- public void testSingleApplication() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(!app.isEmpty());
- assertTrue(app.size()!=0);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Testing for action-listener
- *
- */
- public void testActionListener() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList actionListener = appType.getActionListener();
- assertTrue(!actionListener.isEmpty());
- assertEquals(1, actionListener.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for default-render-kit-id
- *
- */
- public void testRenderKitId() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList renderKit = appType.getDefaultRenderKitId();
- assertTrue(!renderKit.isEmpty());
- assertEquals(1, renderKit.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for a single entry of message-bundle
- *
- */
- public void testMessageBundle() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList messageBundle = appType.getMessageBundle();
- assertTrue(!messageBundle.isEmpty());
- assertEquals(1, messageBundle.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for a single entry of navigation-handler
- *
- */
- public void testNavigationHandler() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList navigationHandler = appType.getNavigationHandler();
- assertTrue(!navigationHandler.isEmpty());
- assertEquals(1, navigationHandler.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for a single entry of view-handler
- *
- */
- public void testViewHandler() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList viewHandler = appType.getViewHandler();
- assertTrue(!viewHandler.isEmpty());
- assertEquals(1, viewHandler.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for a single entry of state-manager
- *
- */
- public void testStateManager() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- ApplicationType appType = (ApplicationType) app.get(0);
- EList stateManager = appType.getStateManager();
- assertTrue(!stateManager.isEmpty());
- assertEquals(1, stateManager.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Testing for the variable-resolver
- */
-
- public void testSingleVariableResolver() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- for (int i = 0; i < app.size(); i++) {
- ApplicationType appType = (ApplicationType) app.get(i);
- EList variableResolver = appType.getVariableResolver();
- assertTrue(!variableResolver.isEmpty());
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for the property-resolver
- */
- public void testSinglePropertyResolver() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- for (int i = 0; i < app.size(); i++) {
- ApplicationType appType = (ApplicationType) app.get(i);
- EList propertyResolver = appType.getVariableResolver();
- assertTrue(!propertyResolver.isEmpty());
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Testing for the local-config within an application
- */
- public void testLocalConfig() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(app.size() == 1);
- for (int i = 0; i < app.size(); i++) {
- ApplicationType appType = (ApplicationType) app.get(i);
- EList localConfig = appType.getLocaleConfig();
- assertTrue(!localConfig.isEmpty());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeComponent.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeComponent.java
deleted file mode 100644
index f0c9585..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeComponent.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This clas is used to test the Attribute inside Component Element
- *
- */
-public class FacesConfigFactoryImplForReadAttributeComponent extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadAttributeComponent(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the existence of a single
- * attribute in the Compoenent Element. While testing I had just one with
- * everything (all children) inside it
- */
- public void testSingleAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- //check to see it is empty which should not
- assertTrue(!compType.getAttribute().isEmpty());
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- //extract the name and confirm that it is the same was what is in
- // the xml file used as input.
- String name = attrType.getAttributeName().getTextContent();
- System.out.println("Attribute name is ****> " + name);
- assertTrue(!attrType.getAttributeName().equals(null));
- assertEquals("attribute-name", name);
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * This is to test the description child inside of Attribute
- *
- */
-
- public void testDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList desc = attrType.getDescription();
- assertTrue(desc.size()!=0);
- }
-
- }
-
- }
- }
- finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * A simple test to check if the Display Name is present
- * within the faces-config.xml file
- */
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- // System.out.println("Renderer Component is = = ==>" +
- // rendererType.getComponentFamily() );
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList disp = attrType.getDisplayName();
- assertTrue(disp.size()!=0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Checks to see if there is an icon defined
- *
- */
- public void testIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList icon = attrType.getIcon();
-
- //I dont know why the following is a Problem!!!!!
- //assertTrue(icon.size()!=0);
- System.out.println("The icon size is " + icon.size());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * This one tests for the existence of two items.
- * They are the required items by all renderers
- * They are : attribute-name and attribute-class.
- * It thought it was better to put them together instead of
- * writing single -separate methods for each of them.
- *Simply, extract the names and check if same the one
- *in faces-config.xml
- */
- public void testAttributeNameAndClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
-
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- String attributeClass = attrType.getAttributeClass().getTextContent();
- assertEquals("attribute-class", attributeClass);
- assertEquals("attribute-name", attrType.getAttributeName().getTextContent());
- // for testing purposes only please REMOVE this ASAP.
- System.out.println("attribute class is " + attributeClass);
- System.out.println("attribute name is " + attrType.getAttributeName().getTextContent());
-
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-/*
- * Checks for the item suggested-value within attribute
- *
- */
- public void testSuggestedValue() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- assertEquals("attribute-suggested-value", attrType.getSuggestedValue().getTextContent());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Checks for the item attribute-extension within attribute
- *
- */
- public void testAttributeExtension() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType compType = (ComponentType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList ext= attrType.getAttributeExtension();
- assertTrue(ext.size()!=0);
- System.out.println("The size of attribute-extension is >>?? " + ext.size() );
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeConverter.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeConverter.java
deleted file mode 100644
index a824d08..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeConverter.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test for the existence of all
- * items with in attribute of the Converter Element
- *
- */
-public class FacesConfigFactoryImplForReadAttributeConverter extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadAttributeConverter(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the existence of an attribute
- * with in Converter
- */
- public void testSingleAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- String name = attrType.getAttributeName().getTextContent();
- //System.out.println("Attribute name is ****> " + name);
- assertTrue(!attrType.getAttributeName().getTextContent().equals(null));
- assertEquals("attribute-name", name);
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Get the Description. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList desc = attrType.getDescription();
- assertTrue(desc.size()!=0);
- }
-
- }
-
- }
- }
- finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Display-name. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- // System.out.println("Renderer Component is = = ==>" +
- // rendererType.getComponentFamily() );
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList disp = attrType.getDisplayName();
- assertTrue(disp.size()!=0);
-
- for(int z=0; z< disp.size(); z++){
- DisplayNameType dispT = (DisplayNameType)disp.get(z);
- String dispNameStr =dispT.getTextContent();
- System.out.println("INSIDE CONVERTER [DISPLAY NAME GET IS ]" + dispNameStr);
-
- }
-
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Get the Icon. It simply checks to see if there is at least
- * one such item
- *
- */
-
-
- public void testIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList icon = attrType.getIcon();
-
- //assertTrue(icon.size()!=0);
- System.out.println("The icon size is " + icon.size());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * This one tests for the existence of three items
- * They are the required items by all renderers
- * They are : attribute-name and attribute-class .
- * It just asserts if the names are the same as
- * refered to in the input xml file
- */
- public void testAttributeNameAndClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
-
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- String attributeClass = attrType.getAttributeClass().getTextContent();
- assertEquals("attribute-class", attributeClass);
- assertEquals("attribute-name", attrType.getAttributeName().getTextContent());
- // for testing purposes only please REMOVE this ASAP.
- //System.out.println("attribute class is " + attributeClass);
- //System.out.println("attribute name is " + attrType.getAttributeName().getTextContent());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-/*
- * Check on for the suggested-value in the attribute
- *
- */
-
- public void testSuggestedValue() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- assertEquals("attribute-suggested-value", attrType.getSuggestedValue().getTextContent());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Checks for attribute-extension
- */
-
- public void testAttributeExtension() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType compType = (ConverterType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList ext= attrType.getAttributeExtension();
- assertTrue(ext.size()!=0);
- System.out.println("The size of attribute-extension is >>?? " + ext.size() );
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeValidator.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeValidator.java
deleted file mode 100644
index bb9a81f..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeValidator.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeExtensionType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test Attibute part in the Validator Element
- *
- */
-public class FacesConfigFactoryImplForReadAttributeValidator extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadAttributeValidator(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * checks to see if there exists an atribute in the first place
- *
- */
- public void testSingleAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- String name = attrType.getAttributeName().getTextContent();
- //System.out.println("Attriute name is ****> " + name);
- assertTrue(!name.equals(null));
- //assertEquals("validator-attribute-name", name);
-
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Description. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList desc = attrType.getDescription();
-
- for(int z=0; z<desc.size(); z++){
- DescriptionType descT = (DescriptionType)desc.get(z);
- String name = descT.getLang();
- System.out.println("The DDDDESCRIP IS ::: " + name);
-
-
- }
-
-
- assertTrue(desc.size()!=0);
- }
-
- }
-
- }
- }
- finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Get the Display Name . It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
-
-
- /*
- ValidatorType newApplication = facesConfigFactory.createValidatorType();
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setValue(dispName);
-
- *
- */
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList disp = attrType.getDisplayName();
- assertTrue(disp.size()!=0);
- for(int z=0; z< disp.size(); z++){
- DisplayNameType dispT = (DisplayNameType)disp.get(z);
- String dispNameStr =dispT.getTextContent();
- System.out.println("INSIDE VALIDATOR [DISPLAY NAME GET IS ]" + dispNameStr);
-
- }
-
- }
-
- /*
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
- ValidatorType newApplication = facesConfigFactory.createValidatorType();
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- dispName = actionList.getValue();
- System.out.println("The display name is [READING IN ATTRIBUTE VALIDATOR]" + dispName );
- */
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Get the Icon. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList icon = attrType.getIcon();
- System.out.println("The icon size is " + icon.size());
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * This one tests for the existence of three items
- * They are the required items by all renderers
- * They are : attribute-name and attribute-class .
- * It just asserts if the names are the same as
- * refered to in the input xml file
- */
- public void testAttributeNameAndClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
-
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- String attributeClass = attrType.getAttributeClass().getTextContent();
- assertEquals("validator-attribute-class", attributeClass);
- assertEquals("validator-attribute-name", attrType.getAttributeName().getTextContent());
- // for testing purposes only please REMOVE this ASAP.
- System.out.println("validator-attribute class is " + attributeClass);
- System.out.println("validator-attribute name is " + attrType.getAttributeName().getTextContent());
-
- String attValue = attrType.getDefaultValue().getTextContent();
- System.out.println("ATTRIBUTE VALUE IS ::" + attValue);
-
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Suggested-value. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testSuggestedValue() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- assertEquals("attribute-suggested-value", attrType.getSuggestedValue().getTextContent());
- String suggestedValue = attrType.getSuggestedValue().getTextContent();
- System.out.println("SUGGESTED VALUE IS ::" + suggestedValue);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-
- /*
- * Get the Attribute-Extension. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testAttributeExtension() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getValidator();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ValidatorType compType = (ValidatorType) comp
- .get(i);
- assertTrue(!compType.getAttribute().isEmpty());
-
- EList attr = compType.getAttribute();
- for (int k = 0; k < attr.size(); k++) {
- AttributeType attrType = (AttributeType) attr.get(k);
- EList ext= attrType.getAttributeExtension();
- assertTrue(ext.size()!=0);
- System.out.println("The size of attribute-extension is >>?? " + ext.size() );
-
- for(int z=0; z<ext.size(); z++){
- AttributeExtensionType attExtType = (AttributeExtensionType) ext.get(z);
-
- System.out.println("EXTENSION is ext:::: " + attExtType.getAny().toString());
-
- }
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadEmptyNavigationRule.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadEmptyNavigationRule.java
deleted file mode 100644
index 3d4b9a0..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadEmptyNavigationRule.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
-* This Junit class is used to test the existence of a navigation rule
-*
-*/
-public class FacesConfigFactoryImplForReadEmptyNavigationRule extends TestCase
-{
- IProject project = null;
-
- public FacesConfigFactoryImplForReadEmptyNavigationRule(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-/*
-* The following method is used to test for the empty
-* navigation rule. Since I am supplying a single
-* faces-config.xml file as a testing file,
-*/
- public void testEmptyNavigationRule(){
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- //assert that it is not empty
- assertTrue(!navRules.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadManagedBeanManagedProperty.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadManagedBeanManagedProperty.java
deleted file mode 100644
index 6d2e23e..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadManagedBeanManagedProperty.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the Managed-Property
- * of the Managed-Bean Element
- *
- */
-public class FacesConfigFactoryImplForReadManagedBeanManagedProperty extends
- TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadManagedBeanManagedProperty(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
-/*
- * Check to see there is at least one property that exists within attribute
- *
- */
- public void testSingeleManagedProperty() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType compType = (ManagedBeanType) managedBean.get(i);
-
- assertTrue(!compType.getManagedProperty().isEmpty());
- EList attr = compType.getManagedProperty();
- for (int k = 0; k < attr.size(); k++) {
- ManagedPropertyType attrType = (ManagedPropertyType) attr.get(k);
- String name = attrType.getPropertyName().getTextContent();
- System.out.println("Attriute name is ****> " + name);
- assertTrue(attrType.getPropertyName().getTextContent().length()!=0);
- assertEquals("property-name", name);
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Description. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testManagedBeanPropertyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType compType = (ManagedBeanType) managedBean.get(i);
-
- assertTrue(!compType.getManagedProperty().isEmpty());
- EList attr = compType.getManagedProperty();
- for (int k = 0; k < attr.size(); k++) {
- ManagedPropertyType attrType = (ManagedPropertyType) attr.get(k);
- EList desc = attrType.getDescription();
- assertTrue(!desc.isEmpty()&& desc.size()>0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Display-name. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testManagedBeanPropertyDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType compType = (ManagedBeanType) managedBean.get(i);
- // System.out.println("Renderer Component is = = ==>" +
- // rendererType.getComponentFamily() );
- assertTrue(!compType.getManagedProperty().isEmpty());
- EList attr = compType.getManagedProperty();
- for (int k = 0; k < attr.size(); k++) {
- ManagedPropertyType attrType = (ManagedPropertyType) attr.get(k);
- EList displayName = attrType.getDisplayName();
- assertTrue(!displayName.isEmpty()&& displayName.size()>0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get the Icon. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testManagedBeanPropertyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType compType = (ManagedBeanType) managedBean.get(i);
- // System.out.println("Renderer Component is = = ==>" +
- // rendererType.getComponentFamily() );
- assertTrue(!compType.getManagedProperty().isEmpty());
- EList attr = compType.getManagedProperty();
- for (int k = 0; k < attr.size(); k++) {
- ManagedPropertyType attrType = (ManagedPropertyType) attr.get(k);
- EList icon = attrType.getIcon();
- assertTrue(!icon.isEmpty()&& icon.size()>0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Get both the Property-name and Property-class. It simply checks to see if
- * there is at least one each items and check if the names are identical
- * as given in the input xml file.
- *
- */
- public void testManagedPropertyNameAndClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType compType = (ManagedBeanType) managedBean.get(i);
-
- assertTrue(!compType.getManagedProperty().isEmpty());
- EList attr = compType.getManagedProperty();
- for (int k = 0; k < attr.size(); k++) {
- ManagedPropertyType attrType = (ManagedPropertyType) attr.get(k);
- String name = attrType.getPropertyName().getTextContent();
- System.out.println("Attriute name is ****> " + name);
- assertTrue(attrType.getPropertyName().getTextContent().length()!=0);
- assertEquals("property-name", name);
-
- String propertyClass = attrType.getPropertyClass().getTextContent();
- assertTrue(attrType.getPropertyClass().getTextContent().length()!=0 && propertyClass.equals("property-class"));
-
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadRenderer.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadRenderer.java
deleted file mode 100644
index 6fa21fc..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadRenderer.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the for the existence of
- * renderer
- */
-public class FacesConfigFactoryImplForReadRenderer extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadRenderer(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * Check to see if there at least one Renderer in place
- */
- public void testSingleRenderer() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- String type = rendType.getRendererType().getTextContent();
- System.out.println("Renderer Type is ****> " + type);
- assertTrue(!type.equals(null));
- assertTrue(!rendType.getRendererClass().getTextContent().equals(null));
- assertTrue(!rendType.getComponentFamily().getTextContent()
- .equals(null));
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * check for Description. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- // System.out.println("Renderer Component is = = ==>" +
- // rendererType.getComponentFamily() );
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- EList desc = rendType.getDescription();
- assertTrue(desc.size()!=0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Check for Display-name. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- EList disp= rendType.getDisplayName();
- assertTrue(disp.size()!=0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Test for Icons.. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- EList icon= rendType.getIcon();
- assertTrue(icon.size()!=0);
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * This one tests for the existence of three items
- * They are the required items by all renderers
- * They are : renderer-type, renderer-class and component-family.
- * It thought it was better to put them together instead of
- * writing single -separate methods for all of them.
- */
- public void testStringForRequiredEntries() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- //String desc = rendType.getRendererType();
- //System.out.println("Renderer Type is ****> " + desc);
- assertTrue(!rendType.getRendererType().getTextContent().equals(null));
- assertEquals("renderer-type" , rendType.getRendererType().getTextContent());
- assertTrue(!rendType.getRendererClass().getTextContent().equals(null));
- assertEquals("renderer-class",rendType.getRendererClass().getTextContent());
- assertTrue(!rendType.getComponentFamily().getTextContent().equals(null));
- assertEquals("component-family",rendType.getComponentFamily().getTextContent());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * check for attribute. It simply checks to see if there is at least
- * one such item
- *
- */
- public void testAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- EList disp= rendType.getAttribute();
- assertTrue(disp.size()!=0);
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * check for Renderer-Extension. It simply checks to see if there is at least
- * one such item
- *
- */
-
- public void testRendererExtension() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType rendererType = (RenderKitType) renderKit
- .get(i);
- assertTrue(!rendererType.getRenderer().isEmpty());
- EList rend = rendererType.getRenderer();
- for (int k = 0; k < rend.size(); k++) {
- RendererType rendType = (RendererType) rend.get(k);
- EList ext= rendType.getRendererExtension();
- assertTrue(ext.size()!=0);
- System.out.println("The size of this object is ==>> " + ext.size());
- }
-
- }
-
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationCase.java
deleted file mode 100644
index 7fc99a0..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationCase.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the navigation-case
- *
- */
-public class FacesConfigFactoryImplForReadSingeNavigationCase extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingeNavigationCase(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * check to see if there is one navigation-case in existence
- *
- */
- public void testEmptyNavigationCase() {
- System.out.println("TESTING EMPTY NAV - CASE");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- // assertTrue(navRules.isEmpty());
-
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
-
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * Check for the Description. There should be at least one of such kind
- * in the xml file to be used as input for this to behave correctly.
- */
- public void testDescription() {
- System.out.println("TESTING NAV - CASE - Description");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
-
- // assertEquals("/Page1.jsp",sFromTreeId);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- System.out.println(" navCases size " + navCases.size());
- for (int j = 0; j < navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases
- .get(j);
- EList desc = navCase.getDescription();
- assertTrue(!desc.isEmpty());
- //System.out.println("size of Decription under navigation-case is ==> " + desc.size() );
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-
- /*
- * Check for the Display-name. There should be at least one of such kind
- */
- public void tetsDisplayName() {
- System.out.println("TESTING NAV - CASE - Display-name");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
- // assertEquals("/Page1.jsp",sFromTreeId);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- System.out.println(" navCases size " + navCases.size());
- for (int j = 0; j < navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases
- .get(j);
- EList caseNames = navCase.getDisplayName();
- assertTrue(!caseNames.isEmpty());
- System.out.println("CLASS = " + caseNames.getClass());
- }
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-
- /*
- * Test for the existence of icon within the navigation-case
- *
- */
- public void testIcon() {
- System.out.println("TESTING NAV - CASE - Description");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
-
- // assertEquals("/Page1.jsp",sFromTreeId);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- System.out.println(" navCases size " + navCases.size());
- for (int j = 0; j < navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases
- .get(j);
- EList icon = navCase.getIcon();
- assertTrue(!icon.isEmpty());
- System.out.println("size of Decription under navigation-case is ==> " + icon.size() );
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-
-
- /*
- * Test for the from-action of the navigation-case rule
- *
- */
- public void testFromAction() {
- System.out.println("TESTING NAV - CASE - from-action");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules.get(i);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- for(int j=0;j<navCases.size(); j++){
- NavigationCaseType navCase = (NavigationCaseType)navCases.get(j);
- String fromAction = navCase.getFromAction().getTextContent();
- System.out.println("from Action should be : : :>>> " + fromAction);
- assertTrue(!fromAction.equals(null) );
- assertEquals("from-action", fromAction);
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * testing for the from-outcome? in navigation-case
- *
- */
-
- public void testFromOutcome() {
- System.out.println("TESTING NAV - CASE - from-outcome");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules.get(i);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- for(int j=0;j<navCases.size(); j++){
- NavigationCaseType navCase = (NavigationCaseType)navCases.get(j);
- String fromOutcome = navCase.getFromOutcome().getTextContent();
- System.out.println("from Outocome should be : : :>>> " + fromOutcome);
- assertTrue(!fromOutcome.equals(null) );
- //assertEquals("from-outcome", fromOutcome);
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Check for the to-view-id. There should be at least one of such kind
- */
- public void testToViewId() {
- System.out.println("TESTING NAV - CASE - to-view-id");
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules.get(i);
- EList navCases = navRule.getNavigationCase();
- assertTrue(!navCases.isEmpty());
- for(int j=0;j<navCases.size(); j++){
- NavigationCaseType navCase = (NavigationCaseType)navCases.get(j);
- String toViewId = navCase.getToViewId().getTextContent();
- System.out.println("to-view-id should be : : :>>> " + toViewId);
- assertTrue(!toViewId.equals(null) );
- assertEquals("/edit.jsp", toViewId);
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationRule.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationRule.java
deleted file mode 100644
index fab6e7c..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationRule.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- *
- */
-
-
-public class FacesConfigFactoryImplForReadSingeNavigationRule extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingeNavigationRule(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the existence of at least
- * one navigation-rule
- */
- public void testSingleNavigationRule() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
-
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
- String navRulesDisName = navRule.getDisplayName()
- .toString();
- System.out.println("navRule names " + navRulesDisName);
-
- // String sFromTreeId = navRule.getFromViewId().getTextContent();
- // assertEquals("/Page1.jsp",sFromTreeId);
- EList desc = navRule.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Check for Sisplay-name. There should be at least one item of such kind
- */
- public void testNonEmptyDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
- EList disp = navRule.getDescription();
- assertTrue(!disp.isEmpty());
- System.out.println(" size of display name is : "
- + disp.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Test for the exisence of navigation-cases
- */
-
- public void testNonEmptyNavigationCases() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
-
- EList navCases = navRule.getNavigationCase();
-
- // just check that from-View-id is not empty and that
- assertTrue(!navCases.isEmpty());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * assert the existence of icon
- */
-
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(0);
-
- EList icon = navRule.getIcon();
- assertTrue(!icon.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleComponent.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleComponent.java
deleted file mode 100644
index 195280e..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleComponent.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test for Component with in faces-config
- * root Element.
- *
- */
-public class FacesConfigFactoryImplForReadSingleComponent extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleComponent(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * assert there is at least one Component listed
- */
- public void testSingleComponent() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navComponent = edit.getFacesConfig().getComponent() ;
- assertTrue(!navComponent.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList component = edit.getFacesConfig().getComponent();
- assertTrue(!component.isEmpty());
- for (int i = 0; i < component.size(); i++) {
- ComponentType navRule = (ComponentType) component
- .get(i);
-
- EList desc = navRule.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- *Check for the Display name
- *
- */
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType navRule = (ComponentType) comp
- .get(i);
-
- EList disp = navRule.getDisplayName();
-
- assertTrue(!disp.isEmpty());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * get the icon of a compnent
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- ComponentType navRule = (ComponentType) comp
- .get(0);
-
- EList icon = navRule.getIcon();
- assertTrue(!icon.isEmpty());
-
- // HOW COME THE SIZE IS 0 FOR ICON????
- System.out.println(" total number of icons is : "
- + icon.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * check to see there is the Component-type and the Component-class
- */
- public void testNonEmptyComponentTypeAndClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getComponent();
- assertTrue(!navRules.isEmpty());
- for (int i = 0; i < navRules.size(); i++) {
- ComponentType navRule = (ComponentType) navRules
- .get(i);
-
- String compType = navRule.getComponentType().getTextContent();
- String compClass = navRule.getComponentClass().getTextContent();
- System.out.println("Compoonent type is : " + compType);
- System.out.println("Compoonent class is : " + compClass);
- assertTrue(!compType.equals(null));
- assertEquals("component-type", compType);
- assertEquals("ComponentClass", compClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * check for the attribute part of the Component
- */
- public void testAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType navRule = (ComponentType) comp
- .get(i);
-
- EList attr = navRule.getAttribute();
- assertTrue(!attr.isEmpty());
- assertEquals(1, attr.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-/*
- * check to see there is property listed in the input file
- */
- public void testProperty() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType navRule = (ComponentType) comp
- .get(i);
-
- EList attr = navRule.getProperty();
- assertTrue(!attr.isEmpty());
- assertEquals(1, attr.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Check for hte Component-Extension inside Component
- */
-
- public void testComponentExtension() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getComponent();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ComponentType navRule = (ComponentType) comp
- .get(i);
-
- EList ext = navRule.getComponentExtension();
- assertTrue(!ext.isEmpty());
- assertEquals(1, ext.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleConverter.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleConverter.java
deleted file mode 100644
index 69b808e..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleConverter.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the Converter which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleConverter extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleConverter(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * Check to see if this element exists. There sould be at least one
- * of such kind listed in the file.
- */
- public void testSingleConverter() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- for (int i = 0; i < converter.size(); i++) {
- ConverterType item = (ConverterType) converter
- .get(i);
-
- EList desc = item.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * Check for the display-name
- */
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- for (int i = 0; i < converter.size(); i++) {
- ConverterType item = (ConverterType) converter
- .get(i);
-
- EList disp = item.getDisplayName();
- assertTrue(!disp.isEmpty()&& disp.size()==1);
-
-
- for(int z=0; z< disp.size(); z++){
- DisplayNameType dispT = (DisplayNameType)disp.get(z);
- String dispNameStr =dispT.getTextContent();
- System.out.println("INSIDE CONVERTER [DISPLAY NAME IS ]" + dispNameStr);
-
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * get the icon of a converter
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- ConverterType item = (ConverterType) converter
- .get(0);
-
- EList icon = item.getIcon();
- assertTrue(!icon.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * check for the class name in converter
- */
- public void testNonEmptyConverterForClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- for (int i = 0; i < converter.size(); i++) {
- ConverterType item = (ConverterType) converter
- .get(i);
- String converterforClass = item.getConverterForClass().getTextContent();
-
- System.out.println("Converter-for-class is : " + converterforClass);
- assertEquals("converter-for-class", converterforClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-/*
- * Check for the converter-class item
- */
- public void testNonEmptyConverterClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- for (int i = 0; i < converter.size(); i++) {
- ConverterType item = (ConverterType) converter
- .get(i);
- String converterClass = item.getConverterClass().getTextContent();
- System.out.println("Converter-class is : " + converterClass);
- assertEquals("converter-class", converterClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-/*
- * Checks for the existence of attribute with in Converter
- */
- public void testAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList comp = edit.getFacesConfig().getConverter();
- assertTrue(!comp.isEmpty());
- for (int i = 0; i < comp.size(); i++) {
- ConverterType navRule = (ConverterType)comp.get(i);
- EList attr = navRule.getAttribute();
- assertTrue(!attr.isEmpty());
- assertEquals(1, attr.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * checks for the property
- */
- public void testProperty() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty());
- for (int i = 0; i < converter.size(); i++) {
- ConverterType item = (ConverterType)converter.get(i);
- EList property = item.getProperty();
- assertTrue(!property.isEmpty());
- assertEquals(1, property.size());
-
- for(int z=0; z<property.size(); z++){
- PropertyType pType = (PropertyType) property.get(z);
- String str = pType.getPropertyName().getTextContent();
- System.out.println("PROPERTY NAME IN CONVERTER IS ::" + str);
- }
-
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleFactory.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleFactory.java
deleted file mode 100644
index c7187b8..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleFactory.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
- * This Junit class is used to test the factory which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleFactory extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleFactory(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the at least one
- * factory with in the faces-config.xml for reading
- */
- public void testSingleFactory() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory = edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyApplicationFactory() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory = edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty());
- for (int i = 0; i < factory.size(); i++) {
- FactoryType item = (FactoryType) factory
- .get(i);
- EList appFactory = item.getApplicationFactory();
- assertTrue(!appFactory.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "+ appFactory.size());
-
-
-
-
- for(int z=0; z<appFactory.size(); z++){
-
- ApplicationFactoryType appType = (ApplicationFactoryType) appFactory.get(z);
- String value = appType.getTextContent();
- System.out.println("iNSIDE [factory], APPLICATION-VALUS IS : " + value );
- }
-
-
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * check for the faces-context-factory element
- */
- public void testFacesContextFactory() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory= edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty());
- for (int i = 0; i < factory.size(); i++) {
- FactoryType item = (FactoryType) factory
- .get(i);
-
- EList facesContext = item.getFacesContextFactory();
- assertTrue(!facesContext.isEmpty()&& facesContext.size()==1);
-
-
- for(int z=0; z<facesContext.size(); z++){
-
- FacesContextFactoryType ctxType = (FacesContextFactoryType) facesContext.get(z);
- String value = ctxType.getTextContent();
- System.out.println("iNSIDE [factory], FACESCONTEXT-VALUS IS : " + value );
- }
-
-
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * check for the lifecycle-factotry with in factory
- */
-
- public void testLifectycleFactory() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory= edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty());
- for (int i = 0; i < factory.size(); i++) {
- FactoryType item = (FactoryType) factory
- .get(i);
-
- EList lifectycle = item.getLifecycleFactory();
- assertTrue(!lifectycle.isEmpty()&& lifectycle.size()==1);
-
- for(int z=0; z<lifectycle.size(); z++){
-
- LifecycleFactoryType ctxType = (LifecycleFactoryType) lifectycle.get(z);
- String value = ctxType.getTextContent();
- System.out.println("iNSIDE [factory], LIFECYCLE-VALUS IS : " + value );
- }
-
-
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * check for the Rendert-kit-factory with in the factory
- */
- public void testRenderKitFactory() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory= edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty());
- for (int i = 0; i < factory.size(); i++) {
- FactoryType item = (FactoryType) factory
- .get(i);
-
- EList renderKit = item.getRenderKitFactory();
- assertTrue(!renderKit.isEmpty()&& renderKit.size()==1);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleManagedBean.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleManagedBean.java
deleted file mode 100644
index 5aa67e5..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleManagedBean.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the managed-bean which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleManagedBean extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleManagedBean(String name) {
- super(name);
- }
-
-
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- *Test to see if there is at least one managed-bean.
- *This should be specified in the file for reading (faces-config)
- */
- public void testSingleManagedBean() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(i);
-
- EList desc = item.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * Test for the display-name
- */
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean= edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(i);
-
- EList disp = item.getDisplayName();
- assertTrue(!disp.isEmpty()&& disp.size()==1);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * get the icon
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(0);
- EList icon = item.getIcon();
- assertTrue(!icon.isEmpty());
- //check on the size of the icons on outpu ******
- System.out.println(" total number of icons is : "
- + icon.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * check to see if there is managed-bean-name and check if it
- * is as expected
- */
- public void testNonEmptyManagedBeanName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(i);
- String name = item.getManagedBeanName().getTextContent();
- System.out.println("Managed-bean-class is : " + name);
- assertEquals("managed-bean-name", name);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Check for a managed-bean-class
- */
- public void testNonEmptyManagedBeanClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(i);
- String managedBeanClass = item.getManagedBeanClass().getTextContent();
- System.out.println("Managed-bean-class is : " + managedBeanClass);
- assertEquals("managed-bean-class", managedBeanClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * check for the managed-bean-scope
- */
- public void testNonEmptyManagedBeanScope() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList managedBean = edit.getFacesConfig().getManagedBean();
- assertTrue(!managedBean.isEmpty());
- for (int i = 0; i < managedBean.size(); i++) {
- ManagedBeanType item = (ManagedBeanType) managedBean
- .get(i);
- String scope = item.getManagedBeanScope().getTextContent();
- System.out.println("Managed-bean-class is : " + scope);
- assertEquals("managed-bean-scope", scope);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleReferencedBean.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleReferencedBean.java
deleted file mode 100644
index 63dadb8..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleReferencedBean.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
- * This Junit class is used to test the referenced-bean which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleReferencedBean extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleReferencedBean(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * check for the existence of referenced-bean with in
- * the root element - faces-config. There should be at least
- * one of such kind (item)
- */
- public void testSingleReferncedBean() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- for (int i = 0; i < referencedBean.size(); i++) {
- ReferencedBeanType item = (ReferencedBeanType) referencedBean
- .get(i);
-
- EList desc = item.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Check for the Display-name
- */
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- for (int i = 0; i < referencedBean.size(); i++) {
- ReferencedBeanType item = (ReferencedBeanType) referencedBean
- .get(i);
-
- EList disp = item.getDisplayName();
- assertTrue(!disp.isEmpty()&& disp.size()==1);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * get the icon
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- ReferencedBeanType item = (ReferencedBeanType) referencedBean
- .get(0);
-
- EList icon = item.getIcon();
- assertTrue(!icon.isEmpty());
-
- // HOW COME THE SIZE IS 0 FOR ICON????
- System.out.println(" total number of icons is : "
- + icon.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * check for refrenced-bean-name
- */
- public void testReferencedBeaName(){
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- for (int i = 0; i < referencedBean.size(); i++) {
- ReferencedBeanType item = (ReferencedBeanType) referencedBean
- .get(i);
- String referencedBeanName = item.getReferencedBeanName().getTextContent();
- System.out.println(" referenced-bean-name is : " + referencedBeanName);
- assertEquals("referenced-bean-name", referencedBeanName);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-/*
- * check for the referenced-bean-for-class item
- */
- public void testNonEmptyReferencedBeanForClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList referencedBean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!referencedBean.isEmpty());
- for (int i = 0; i < referencedBean.size(); i++) {
- ReferencedBeanType item = (ReferencedBeanType) referencedBean
- .get(i);
- String referencedBeanClass = item.getReferencedBeanClass().getTextContent();
- System.out.println(" referenced-bean-class is : " + referencedBeanClass);
- assertEquals("referenced-bean-class", referencedBeanClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleRenderKit.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleRenderKit.java
deleted file mode 100644
index e60559f..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleRenderKit.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the render which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleRenderKit extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleRenderKit(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- *Test to see if there is at least one render-kit.
- *This should be specified in the file for reading (faces-config)
- */
- public void testSingleRenderKit() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType item = (RenderKitType) renderKit.get(i);
-
- EList desc = item.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-/*
- * check for the display-name
- */
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType item = (RenderKitType) renderKit.get(i);
- EList disp = item.getDisplayName();
- assertTrue(!disp.isEmpty() && disp.size() == 1);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * get the icon
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- RenderKitType item = (RenderKitType) renderKit.get(0);
-
- EList icon = item.getIcon();
- assertTrue(!icon.isEmpty());
-
- // HOW COME THE SIZE IS 0 FOR ICON????
- System.out.println(" total number of icons is : "
- + icon.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * chech for hte render-kit-id element
- */
-
- public void testNonEmptyRenderKitId() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKits = edit.getFacesConfig()
- .getRenderKit();
- assertTrue(!renderKits.isEmpty());
- for (int i = 0; i < renderKits.size(); i++) {
- RenderKitType item = (RenderKitType) renderKits.get(i);
- String renderKitId = item.getRenderKitId().getTextContent();
- System.out.println(" render-kit-Id is : " + renderKitId);
- assertEquals("render-kit-Id", renderKitId);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Check for the existence of the Render-kit-class
- */
-
- public void testNonEmptyRenderKitClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKits = edit.getFacesConfig()
- .getRenderKit();
- assertTrue(!renderKits.isEmpty());
- for (int i = 0; i < renderKits.size(); i++) {
- RenderKitType item = (RenderKitType) renderKits.get(i);
- String renderKitClass = item.getRenderKitClass().getTextContent();
- System.out.println(" render-kit-class is : "
- + renderKitClass);
- assertEquals("render-kit-class", renderKitClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- /*
- * Checks to see if there is at least one renderer
- *
- */
-
- public void testRenderer() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty());
- for (int i = 0; i < renderKit.size(); i++) {
- RenderKitType item = (RenderKitType) renderKit.get(i);
-
- EList renders = item.getRenderer();
-
- assertTrue(!renders.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of renderer (in render-kit objs) is : "
- + renders.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleValidator.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleValidator.java
deleted file mode 100644
index bdbf55d..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleValidator.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the validator which is one of
- * many items inside the root elemnt faces-config in the configuration
- * information hierarchy of the faces-config.xml file
- *
- */
-public class FacesConfigFactoryImplForReadSingleValidator extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForReadSingleValidator(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the empty navigation rule. Since
- * I am supplying a single faces-config.xml file as a testing file, I had to
- * testcases fit in to it by controlling the conditions
- *
- */
- public void testSingleValidator() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- // Test for the Descirption
- public void testNonEmptyDescription() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType item = (ValidatorType) validator
- .get(i);
-
- EList desc = item.getDescription();
-
- assertTrue(!desc.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + desc.size());
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- public void testDisplayName() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType item = (ValidatorType) validator
- .get(i);
-
- EList disp = item.getDisplayName();
- assertTrue(!disp.isEmpty()&& disp.size()==1);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * get the icon of a compnent
- *
- */
- public void testNonEmptyIcon() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- ValidatorType item = (ValidatorType) validator
- .get(0);
-
- EList icon = item.getIcon();
- assertTrue(!icon.isEmpty());
-
- // HOW COME THE SIZE IS 0 FOR ICON????
- System.out.println(" total number of icons is : "
- + icon.size());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testValidatorId() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType item = (ValidatorType) validator
- .get(i);
- String validatorId = item.getValidatorId().getTextContent();
- //String compClass = item.getComponentClass();
- // just check that from-View-id is not empty and that
- // has emelent named "fromViewId"
- System.out.println("validator-Id is : " + validatorId);
- assertEquals("validator-Id", validatorId);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- public void testNonEmptyValidatorClass() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType item = (ValidatorType) validator
- .get(i);
- String validatorClass = item.getValidatorClass().getTextContent();
- System.out.println("validator-class is : " + validatorClass);
- assertEquals("validator-class", validatorClass);
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- public void testAttribute() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType navRule = (ValidatorType)validator.get(i);
- EList attr = navRule.getAttribute();
- assertTrue(!attr.isEmpty());
- //assertEquals(1, attr.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testProperty() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty());
- for (int i = 0; i < validator.size(); i++) {
- ValidatorType item = (ValidatorType)validator.get(i);
- EList property = item.getProperty();
- assertTrue(!property.isEmpty());
- //assertEquals(1, property.size());
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplication.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplication.java
deleted file mode 100644
index 2790ccb..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplication.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ActionListenerType;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultLocaleType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultRenderKitIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType;
-import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationHandlerType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
-import org.eclipse.jst.jsf.facesconfig.emf.StateManagerType;
-import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType;
-import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
-import org.eclipse.jst.jsf.facesconfig.emf.ViewHandlerType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
- * This class is used to test wether the writing into the faces-config.xml
- * file is being done propertly and the outputs are as expected
- *
- */
-public class FacesConfigFactoryImplForWriteApplication extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteApplication(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
- /*
- * Do the writing here to all the attributes
- *
- */
-
- public void testWriteApplication() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit2 = null;
-
- String actionListener = "action-listener";
- String variableResolver = "variable-resolver";
- String defaultRenderKitId = "default-render-kit-id";
- String messageBundle= "message-bundle";
- String navigationHandler = "navigation-handler";
- String viewHandler = "view-handler";
- String stateManager="state-manager";
- String propertyResolver="property-resolver";
- //Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- ApplicationType newApplication = facesConfigFactory.createApplicationType();
-
-
- ActionListenerType actionList= facesConfigFactory.createActionListenerType();
- actionList.setTextContent(actionListener);
- newApplication.getActionListener().add(actionList);
-
-
-
- VariableResolverType variableResolverType= facesConfigFactory.createVariableResolverType();
- variableResolverType.setTextContent(variableResolver);
- newApplication.getVariableResolver().add(variableResolverType);
-
-
- DefaultRenderKitIdType renderKitIdType= facesConfigFactory.createDefaultRenderKitIdType();
- renderKitIdType.setTextContent(defaultRenderKitId);
- newApplication.getDefaultRenderKitId().add(renderKitIdType);
-
-
- MessageBundleType messageBundleType= facesConfigFactory.createMessageBundleType();
- messageBundleType.setTextContent(messageBundle);
- newApplication.getMessageBundle().add(messageBundleType);
-
-
- NavigationHandlerType navigationHandlerType= facesConfigFactory.createNavigationHandlerType();
- navigationHandlerType.setTextContent(navigationHandler);
- newApplication.getNavigationHandler().add(navigationHandlerType);
-
-
- ViewHandlerType viewHandlerType= facesConfigFactory.createViewHandlerType();
- viewHandlerType.setTextContent(viewHandler);
- newApplication.getViewHandler().add(viewHandlerType);
-
- StateManagerType stateManagerType= facesConfigFactory.createStateManagerType();
- stateManagerType.setTextContent(stateManager);
- newApplication.getStateManager().add(stateManagerType);
-
-
- PropertyResolverType propertyResolverType= facesConfigFactory.createPropertyResolverType();
- propertyResolverType.setTextContent(propertyResolver);
- newApplication.getPropertyResolver().add(propertyResolverType);
-
-
- LocaleConfigType localConfigType = facesConfigFactory.createLocaleConfigType();
- DefaultLocaleType defaultLocaleType = facesConfigFactory.createDefaultLocaleType();
- defaultLocaleType.setTextContent("default-locals");
- localConfigType.setDefaultLocale(defaultLocaleType);
-
- SupportedLocaleType supportedLocalType = facesConfigFactory.createSupportedLocaleType();
- supportedLocalType.setTextContent("supported-local-type");
- localConfigType.getSupportedLocale().add(supportedLocalType);
- //newApplication.getSpportedLocal().add("some value"); blahhhhhh;
- //***************** missing method above line **********************//
- newApplication.getLocaleConfig().add(localConfigType);
-
- edit2.getFacesConfig().getApplication().add(newApplication);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String actionList = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList actListener = lifecycle.getActionListener();
- for (int j=0; j<actListener.size(); j++) {
- ActionListenerType factory = (ActionListenerType)actListener.get(j);
- actionList = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + actionList);
- assertEquals(actionListener,actionList);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //variableResolver
- String varResolver = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList varRes = lifecycle.getVariableResolver();
- for (int j=0; j<varRes.size(); j++) {
- VariableResolverType factory = (VariableResolverType)varRes.get(j);
- varResolver = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + varResolver);
- assertEquals(variableResolver,varResolver);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //defaultRenderKitId
- String defRenderKitId = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList defKit = lifecycle.getDefaultRenderKitId();
- for (int j=0; j<defKit.size(); j++) {
- DefaultRenderKitIdType factory = (DefaultRenderKitIdType)defKit.get(j);
- defRenderKitId = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + defRenderKitId);
- assertEquals(defaultRenderKitId,defRenderKitId);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //messageBundle
- String messBundle = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList bundle = lifecycle.getMessageBundle();
- for (int j=0; j<bundle.size(); j++) {
- MessageBundleType factory = (MessageBundleType)bundle.get(j);
- messBundle = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + messBundle);
- assertEquals(messageBundle,messBundle);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //navigationHandler
- String naviHandler = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList navigation = lifecycle.getNavigationHandler();
- for (int j=0; j<navigation.size(); j++) {
- NavigationHandlerType factory = (NavigationHandlerType)navigation.get(j);
- naviHandler = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + naviHandler);
- assertEquals(navigationHandler, naviHandler);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //viewHandler
- String viewHand = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList view = lifecycle.getViewHandler();
- for (int j=0; j<view.size(); j++) {
- ViewHandlerType factory = (ViewHandlerType)view.get(j);
- viewHand = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + viewHand);
- assertEquals(viewHandler, viewHand);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //stateManager
- String stateMgr= null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList actListener = lifecycle.getStateManager();
- for (int j=0; j<actListener.size(); j++) {
- StateManagerType factory = (StateManagerType)actListener.get(j);
- stateMgr = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + stateMgr);
- assertEquals(stateManager,stateMgr);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //propertyResolver
- String propertyRes = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType lifecycle = (ApplicationType) apps.get(i);
- EList prop = lifecycle.getPropertyResolver();
- for (int j=0; j<prop.size(); j++) {
- PropertyResolverType factory = (PropertyResolverType)prop.get(j);
- propertyRes = factory.getTextContent();
- System.out.println("The action listener of Application factory is : " + propertyRes);
- assertEquals(propertyResolver,propertyRes);
- break;
- }
- }
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //LOCAL-CONFIG REMAINING.
- String defLocal = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList config = appType.getLocaleConfig();
- for (int j=0; j<config.size(); j++) {
- LocaleConfigType localConf = (LocaleConfigType) config.get(i);
- defLocal = localConf.getDefaultLocale().getTextContent();
- System.out.println("The Defualt Local config of Application is: " + defLocal);
- assertEquals("default-locals",defLocal);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //supportedLocal
- String supportedLocal = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList localConf = appType.getLocaleConfig();
- for(int k=0; k<localConf.size(); k++){
- LocaleConfigType confType = (LocaleConfigType) localConf.get(k);
- EList localConfList = confType.getSupportedLocale();
- for (int j=0; j<localConfList.size(); j++) {
- SupportedLocaleType supportedLocalConf = (SupportedLocaleType) localConfList.get(i);
- supportedLocal = supportedLocalConf.getTextContent();
- System.out.println("The Supported Local config of Application is: " + supportedLocal);
- //assertEquals("supported-local-type",supportedLocal);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplicationTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplicationTwoFiles.java
deleted file mode 100644
index 3d001bb..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplicationTwoFiles.java
+++ /dev/null
@@ -1,763 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ActionListenerType;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultLocaleType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultRenderKitIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType;
-import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationHandlerType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
-import org.eclipse.jst.jsf.facesconfig.emf.StateManagerType;
-import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType;
-import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
-import org.eclipse.jst.jsf.facesconfig.emf.ViewHandlerType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-/*
- * This class is used to test wether the writing into the faces-config.xml
- * file is being done propertly and the outputs are as expected
- *
- */
-public class FacesConfigFactoryImplForWriteApplicationTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit1 = null;
- FacesConfigArtifactEdit edit2 = null;
-
- String actionListener = "action-listener";
- String variableResolver = "variable-resolver";
- String defaultRenderKitId = "default-render-kit-id";
- String messageBundle= "message-bundle";
- String navigationHandler = "navigation-handler";
- String viewHandler = "view-handler";
- String stateManager="state-manager";
- String propertyResolver="property-resolver";
-
- public FacesConfigFactoryImplForWriteApplicationTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
- /*
- * Do the writing here to all the attributes
- *
- */
-
- public void testWriteApplicationToFileTwo() {
- //IProject project = WizardUtil.getTestProject();
-
- //Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- ApplicationType newApplication = facesConfigFactory.createApplicationType();
-
-
- ActionListenerType actionList= facesConfigFactory.createActionListenerType();
- actionList.setTextContent(actionListener);
- newApplication.getActionListener().add(actionList);
-
-
- VariableResolverType variableResolverType= facesConfigFactory.createVariableResolverType();
- variableResolverType.setTextContent(variableResolver);
- newApplication.getVariableResolver().add(variableResolverType);
-
-
- DefaultRenderKitIdType renderKitIdType= facesConfigFactory.createDefaultRenderKitIdType();
- renderKitIdType.setTextContent(defaultRenderKitId);
- newApplication.getDefaultRenderKitId().add(renderKitIdType);
-
-
- MessageBundleType messageBundleType= facesConfigFactory.createMessageBundleType();
- messageBundleType.setTextContent(messageBundle);
- newApplication.getMessageBundle().add(messageBundleType);
-
-
- NavigationHandlerType navigationHandlerType= facesConfigFactory.createNavigationHandlerType();
- navigationHandlerType.setTextContent(navigationHandler);
- newApplication.getNavigationHandler().add(navigationHandlerType);
-
-
- ViewHandlerType viewHandlerType= facesConfigFactory.createViewHandlerType();
- viewHandlerType.setTextContent(viewHandler);
- newApplication.getViewHandler().add(viewHandlerType);
-
- StateManagerType stateManagerType= facesConfigFactory.createStateManagerType();
- stateManagerType.setTextContent(stateManager);
- newApplication.getStateManager().add(stateManagerType);
-
-
- PropertyResolverType propertyResolverType= facesConfigFactory.createPropertyResolverType();
- propertyResolverType.setTextContent(propertyResolver);
- newApplication.getPropertyResolver().add(propertyResolverType);
-
-
- LocaleConfigType localConfigType = facesConfigFactory.createLocaleConfigType();
- DefaultLocaleType defaultLocaleType = facesConfigFactory.createDefaultLocaleType();
- defaultLocaleType.setTextContent("default-locals");
- localConfigType.setDefaultLocale(defaultLocaleType);
-
- SupportedLocaleType supportedLocalType = facesConfigFactory.createSupportedLocaleType();
- supportedLocalType.setTextContent("supported-local-type");
- localConfigType.getSupportedLocale().add(supportedLocalType);
- //newApplication.getSpportedLocal().add("some value"); blahhhhhh;
- //***************** missing method above line **********************//
- newApplication.getLocaleConfig().add(localConfigType);
-
- edit2.getFacesConfig().getApplication().add(newApplication);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String actionList = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList actListener = appType.getActionListener();
- for (int j=0; j<actListener.size(); j++) {
- ActionListenerType listener = (ActionListenerType)actListener.get(j);
- actionList = listener.getTextContent();
- System.out.println("The action listener of Application is : " + actionList);
- assertEquals(actionListener,actionList);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //variableResolver
- String varResolver = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList varRes = appType.getVariableResolver();
- for (int j=0; j<varRes.size(); j++) {
- VariableResolverType resolver = (VariableResolverType)varRes.get(j);
- varResolver = resolver.getTextContent();
- System.out.println("The action listener of Application is : " + varResolver);
- assertEquals(variableResolver,varResolver);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //defaultRenderKitId
- String defRenderKitId = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList defKit = appType.getDefaultRenderKitId();
- for (int j=0; j<defKit.size(); j++) {
- DefaultRenderKitIdType defaultKit = (DefaultRenderKitIdType)defKit.get(j);
- defRenderKitId = defaultKit.getTextContent();
- System.out.println("The action listener of Application is : " + defRenderKitId);
- assertEquals(defaultRenderKitId,defRenderKitId);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //messageBundle
- String messBundle = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList bundle = appType.getMessageBundle();
- for (int j=0; j<bundle.size(); j++) {
- MessageBundleType bundleType = (MessageBundleType)bundle.get(j);
- messBundle = bundleType.getTextContent();
- System.out.println("The action listener of Application is : " + messBundle);
- assertEquals(messageBundle,messBundle);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //navigationHandler
- String naviHandler = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList navigation = appType.getNavigationHandler();
- for (int j=0; j<navigation.size(); j++) {
- NavigationHandlerType handler = (NavigationHandlerType)navigation.get(j);
- naviHandler = handler.getTextContent();
- System.out.println("The action listener of Application is : " + naviHandler);
- assertEquals(navigationHandler, naviHandler);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //viewHandler
- String viewHand = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList view = appType.getViewHandler();
- for (int j=0; j<view.size(); j++) {
- ViewHandlerType handler = (ViewHandlerType)view.get(j);
- viewHand = handler.getTextContent();
- System.out.println("The action listener of Application is: " + viewHand);
- assertEquals(viewHandler, viewHand);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //stateManager
- String stateMgr= null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList actListener = appType.getStateManager();
- for (int j=0; j<actListener.size(); j++) {
- StateManagerType manager = (StateManagerType)actListener.get(j);
- stateMgr = manager.getTextContent();
- System.out.println("The action listener of Application is: " + stateMgr);
- assertEquals(stateManager,stateMgr);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //propertyResolver
- String propertyRes = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList prop = appType.getPropertyResolver();
- for (int j=0; j<prop.size(); j++) {
- PropertyResolverType resolver = (PropertyResolverType)prop.get(j);
- propertyRes = resolver.getTextContent();
- System.out.println("The action listener of Application is: " + propertyRes);
- assertEquals(propertyResolver,propertyRes);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //LOCAL-CONFIG REMAINING.
- String defLocal = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList config = appType.getLocaleConfig();
- for (int j=0; j<config.size(); j++) {
- LocaleConfigType localConf = (LocaleConfigType) config.get(i);
- defLocal = localConf.getDefaultLocale().getTextContent();
- System.out.println("The Defualt Local config of Application is: " + defLocal);
- assertEquals("default-locals",defLocal);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //supportedLocal
- String supportedLocal = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList apps = edit2.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList localConf = appType.getLocaleConfig();
- for(int k=0; k<localConf.size(); k++){
- LocaleConfigType confType = (LocaleConfigType) localConf.get(k);
- EList localConfList = confType.getSupportedLocale();
- for (int j=0; j<localConfList.size(); j++) {
- SupportedLocaleType supportedLocalConf = (SupportedLocaleType) localConfList.get(i);
- supportedLocal = supportedLocalConf.getTextContent();
- System.out.println("The Supported Local config of Application is: " + supportedLocal);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- }
-
- public void testWriteApplicationToFileOne() {
- //IProject project = WizardUtil.getTestProject();
-
- //Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ApplicationType newApplication = facesConfigFactory.createApplicationType();
-
- ActionListenerType actionList= facesConfigFactory.createActionListenerType();
- actionList.setTextContent(actionListener);
- newApplication.getActionListener().add(actionList);
-
- VariableResolverType variableResolverType= facesConfigFactory.createVariableResolverType();
- variableResolverType.setTextContent(variableResolver);
- newApplication.getVariableResolver().add(variableResolverType);
-
- DefaultRenderKitIdType renderKitIdType= facesConfigFactory.createDefaultRenderKitIdType();
- renderKitIdType.setTextContent(defaultRenderKitId);
- newApplication.getDefaultRenderKitId().add(renderKitIdType);
-
- MessageBundleType messageBundleType= facesConfigFactory.createMessageBundleType();
- messageBundleType.setTextContent(messageBundle);
- newApplication.getMessageBundle().add(messageBundleType);
-
-
- NavigationHandlerType navigationHandlerType= facesConfigFactory.createNavigationHandlerType();
- navigationHandlerType.setTextContent(navigationHandler);
- newApplication.getNavigationHandler().add(navigationHandlerType);
-
- ViewHandlerType viewHandlerType= facesConfigFactory.createViewHandlerType();
- viewHandlerType.setTextContent(viewHandler);
- newApplication.getViewHandler().add(viewHandlerType);
-
- StateManagerType stateManagerType= facesConfigFactory.createStateManagerType();
- stateManagerType.setTextContent(stateManager);
- newApplication.getStateManager().add(stateManagerType);
-
-
- PropertyResolverType propertyResolverType= facesConfigFactory.createPropertyResolverType();
- propertyResolverType.setTextContent(propertyResolver);
- newApplication.getPropertyResolver().add(propertyResolverType);
-
-
- LocaleConfigType localConfigType = facesConfigFactory.createLocaleConfigType();
- DefaultLocaleType defaultLocaleType = facesConfigFactory.createDefaultLocaleType();
- defaultLocaleType.setTextContent("default-locals");
- localConfigType.setDefaultLocale(defaultLocaleType);
-
- SupportedLocaleType supportedLocalType = facesConfigFactory.createSupportedLocaleType();
- supportedLocalType.setTextContent("supported-local-type");
- localConfigType.getSupportedLocale().add(supportedLocalType);
- //newApplication.getSpportedLocal().add("some value"); blahhhhhh;
- //***************** missing method above line **********************//
- newApplication.getLocaleConfig().add(localConfigType);
-
- edit1.getFacesConfig().getApplication().add(newApplication);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- String resultFactory = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < lifecycles.size(); i++) {
- FactoryType appType = (FactoryType) lifecycles.get(i);
- EList appFactory = appType.getApplicationFactory();
- for (int j=0; j<appFactory.size(); j++) {
- ApplicationFactoryType app = (ApplicationFactoryType)appFactory.get(j);
- resultFactory = app.getTextContent();
- System.out.println("The Application is: " + resultFactory);
- //assert here
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String actionList = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList actListener = appType.getActionListener();
- for (int j=0; j<actListener.size(); j++) {
- ActionListenerType listener = (ActionListenerType)actListener.get(j);
- actionList = listener.getTextContent();
- System.out.println("The action listener of Application is: " + actionList);
- assertEquals(actionListener,actionList);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //variableResolver
- String varResolver = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList varRes = appType.getVariableResolver();
- for (int j=0; j<varRes.size(); j++) {
- VariableResolverType resolver = (VariableResolverType)varRes.get(j);
- varResolver = resolver.getTextContent();
- System.out.println("The action listener of Application is: " + varResolver);
- assertEquals(variableResolver,varResolver);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //defaultRenderKitId
- String defRenderKitId = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList defKit = appType.getDefaultRenderKitId();
- for (int j=0; j<defKit.size(); j++) {
- DefaultRenderKitIdType defaultKit = (DefaultRenderKitIdType)defKit.get(j);
- defRenderKitId = defaultKit.getTextContent();
- System.out.println("The action listener of Application is: " + defRenderKitId);
- assertEquals(defaultRenderKitId,defRenderKitId);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //messageBundle
- String messBundle = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList bundle = appType.getMessageBundle();
- for (int j=0; j<bundle.size(); j++) {
- MessageBundleType bundleType = (MessageBundleType)bundle.get(j);
- messBundle = bundleType.getTextContent();
- System.out.println("The action listener of Application is: " + messBundle);
- assertEquals(messageBundle,messBundle);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
- //navigationHandler
- String naviHandler = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList navigation = appType.getNavigationHandler();
- for (int j=0; j<navigation.size(); j++) {
- NavigationHandlerType navHandler = (NavigationHandlerType)navigation.get(j);
- naviHandler = navHandler.getTextContent();
- System.out.println("The action listener of Application is: " + naviHandler);
- assertEquals(navigationHandler, naviHandler);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //viewHandler
- String viewHand = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList view = appType.getViewHandler();
- for (int j=0; j<view.size(); j++) {
- ViewHandlerType handler = (ViewHandlerType)view.get(j);
- viewHand = handler.getTextContent();
- System.out.println("The action listener of Application is: " + viewHand);
- assertEquals(viewHandler, viewHand);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //stateManager
- String stateMgr= null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList actListener = appType.getStateManager();
- for (int j=0; j<actListener.size(); j++) {
- StateManagerType listener = (StateManagerType)actListener.get(j);
- stateMgr = listener.getTextContent();
- System.out.println("The action listener of Application is: " + stateMgr);
- assertEquals(stateManager,stateMgr);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //propertyResolver
- String propertyRes = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList prop = appType.getPropertyResolver();
- for (int j=0; j<prop.size(); j++) {
- PropertyResolverType listener = (PropertyResolverType)prop.get(j);
- propertyRes = listener.getTextContent();
- System.out.println("The action listener of Application is: " + propertyRes);
- assertEquals(propertyResolver,propertyRes);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //LOCAL-CONFIG REMAINING.
- String defLocal = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList config = appType.getLocaleConfig();
- for (int j=0; j<config.size(); j++) {
- LocaleConfigType localConf = (LocaleConfigType) config.get(i);
- defLocal = localConf.getDefaultLocale().getTextContent();
- System.out.println("The Defualt Local config of Application is: " + defLocal);
- assertEquals("default-locals",defLocal);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //supportedLocal
- String supportedLocal = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList apps = edit1.getFacesConfig().getApplication();
- for (int i = 0; i < apps.size(); i++) {
- ApplicationType appType = (ApplicationType) apps.get(i);
- EList localConf = appType.getLocaleConfig();
- for(int k=0; k<localConf.size(); k++){
- LocaleConfigType confType = (LocaleConfigType) localConf.get(k);
- EList localConfList = confType.getSupportedLocale();
- for (int j=0; j<localConfList.size(); j++) {
- SupportedLocaleType supportedLocalConf = (SupportedLocaleType) localConfList.get(i);
- supportedLocal = supportedLocalConf.getTextContent();
- System.out.println("The Supported Local config of Application is: " + supportedLocal);
- //assertEquals("supported-local-type",supportedLocal);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponent.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponent.java
deleted file mode 100644
index c25f0c6..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponent.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteComponent extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteComponent(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteComponent() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- //String description = "description";
- String displayName = "display-name";
- String icon="small-icon";
-
- String attributeDispName = "attribute-display-name";
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- ComponentType newComponent = facesConfigFactory.createComponentType();
-
- DisplayNameType disp= facesConfigFactory.createDisplayNameType();
- disp.setTextContent(displayName);
- newComponent.getDisplayName().add(disp);
-
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(icon);
- iconType.setSmallIcon(smallIconType);
- newComponent.getIcon().add(iconType);
-
- ComponentTypeType componentTypeType = facesConfigFactory.createComponentTypeType();
- componentTypeType.setTextContent("component-type");
- newComponent.setComponentType(componentTypeType);
-
- ComponentClassType componentClassType = facesConfigFactory.createComponentClassType();
- componentClassType.setTextContent("component-class");
- newComponent.setComponentClass(componentClassType);
-
- AttributeType attrType = facesConfigFactory.createAttributeType();
-
- DisplayNameType attributeDisplayName= facesConfigFactory.createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon= facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(icon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- //ATTRIBUTE EXTENISON REMAIND HERE
- //AttributeExtensionType attrExtType = facesConfigFactory.createAttributeExtensionType();
-
- newComponent.getAttribute().add(attrType);
-
- //******* Not working show it to Xiao Nan....
- //ComponentExtensionType componentExtType = facesConfigFactory.createComponentExtensionType();
- //componentExtType.
-
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propDefaultValueType = facesConfigFactory.createDefaultValueType();
- propDefaultValueType.setTextContent("property-default-value");
- propType.setDefaultValue(propDefaultValueType);
-
- newComponent.getProperty().add(propType);
-
- // ComponentExtensionType compExtType = facesConfigFactory.createComponentExtensionType();
-
-
- edit.getFacesConfig().getComponent().add(newComponent);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList components = edit.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- EList descr = comp.getDescription();
- for (int j=0; j<descr.size(); j++) {
- // TODO: ???
- //DescriptionType phaseListener = (DescriptionType)descr.get(j);
- //result = phaseListener.getLang();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponentTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponentTwoFiles.java
deleted file mode 100644
index 71ffb45..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponentTwoFiles.java
+++ /dev/null
@@ -1,453 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteComponentTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit = null;
-
- FacesConfigArtifactEdit edit1 = null;
-
- String displayName = "display-name";
-
- String icon = "small-icon";
-
- String attributeDispName = "attribute-display-name";
-
- public FacesConfigFactoryImplForWriteComponentTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteComponent() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ComponentType newComponent = facesConfigFactory
- .createComponentType();
-
- DisplayNameType disp = facesConfigFactory
- .createDisplayNameType();
- disp.setTextContent(displayName);
- newComponent.getDisplayName().add(disp);
-
- IconType iconType = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(icon);
- iconType.setSmallIcon(smallIconType);
- newComponent.getIcon().add(iconType);
-
- ComponentTypeType componentTypeType = facesConfigFactory.createComponentTypeType();
- componentTypeType.setTextContent("component-type");
- newComponent.setComponentType(componentTypeType);
-
- ComponentClassType componentClassType = facesConfigFactory.createComponentClassType();
- componentClassType.setTextContent("component-class");
- newComponent.setComponentClass(componentClassType);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(icon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- // ATTRIBUTE EXTENISON REMAIND HERE
- // AttributeExtensionType attrExtType =
- // facesConfigFactory.createAttributeExtensionType();
-
- newComponent.getAttribute().add(attrType);
-
- // property section
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propDefaultValueType = facesConfigFactory.createDefaultValueType();
- propDefaultValueType.setTextContent("property-default-value");
- propType.setDefaultValue(propDefaultValueType);
-
- newComponent.getProperty().add(propType);
-
- edit.getFacesConfig().getComponent().add(newComponent);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- String dispNam = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList components = edit.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- EList disp = comp.getDisplayName();
- for (int j = 0; j < disp.size(); j++) {
- DisplayNameType name = (DisplayNameType) disp.get(j);
- dispNam = name.getTextContent();
- System.out
- .println("The display name for component is "
- + dispNam);
- assertEquals(displayName, dispNam);
- break;
- }
- }
- }
- } finally {
-
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // icon
- String fetchedIcon = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList components = edit.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- EList disp = comp.getIcon();
- for (int j = 0; j < disp.size(); j++) {
- IconType iconT = (IconType) disp.get(j);
- fetchedIcon = iconT.getSmallIcon().getTextContent();
- System.out.println("The icon name for component is "
- + fetchedIcon);
- assertEquals(icon, fetchedIcon);
- break;
- }
- }
- }
- } finally {
-
- if (edit != null) {
- edit.dispose();
- }
- }
- // componentType
- String compType = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList components = edit.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- compType = comp.getComponentType().getTextContent();
- System.out.println("The comp type for component is "
- + compType);
- assertEquals("component-type", compType);
- break;
- }
- }
-
- } finally {
-
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // componentClass
- String compClass = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList components = edit.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- compClass = comp.getComponentClass().getTextContent();
- System.out.println("The comp class name for component is "
- + compClass);
- assertEquals("component-class", compClass);
- break;
- }
- }
- } finally {
-
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //
- }
-
- public void testWriteComponentToFileOne() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ComponentType newComponent = facesConfigFactory
- .createComponentType();
-
- DisplayNameType disp = facesConfigFactory
- .createDisplayNameType();
- disp.setTextContent(displayName);
- newComponent.getDisplayName().add(disp);
-
- IconType iconType = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(icon);
- iconType.setSmallIcon(smallIconType);
- newComponent.getIcon().add(iconType);
-
- ComponentTypeType componentTypeType = facesConfigFactory.createComponentTypeType();
- componentTypeType.setTextContent("component-type");
- newComponent.setComponentType(componentTypeType);
-
- ComponentClassType componentClassType = facesConfigFactory.createComponentClassType();
- componentClassType.setTextContent("component-class");
- newComponent.setComponentClass(componentClassType);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(icon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- // ATTRIBUTE EXTENISON REMAIND HERE
- // AttributeExtensionType attrExtType =
- // facesConfigFactory.createAttributeExtensionType();
-
- newComponent.getAttribute().add(attrType);
-
- // ******* Not working show it to Xiao Nan....
- // ComponentExtensionType componentExtType =
- // facesConfigFactory.createComponentExtensionType();
- // componentExtType.
-
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propDefaultValueType = facesConfigFactory.createDefaultValueType();
- propDefaultValueType.setTextContent("property-default-value");
- propType.setDefaultValue(propDefaultValueType);
-
- newComponent.getProperty().add(propType);
-
- // ComponentExtensionType compExtType =
- // facesConfigFactory.createComponentExtensionType();
- edit1.getFacesConfig().getComponent().add(newComponent);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- String dispNam = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList components = edit1.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- EList disp = comp.getDisplayName();
- for (int j = 0; j < disp.size(); j++) {
- DisplayNameType name = (DisplayNameType) disp.get(j);
- dispNam = name.getTextContent();
- System.out
- .println("The display name for component is "
- + dispNam);
- assertEquals(displayName, dispNam);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // icon
- String fetchedIcon = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList components = edit1.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- EList disp = comp.getIcon();
- for (int j = 0; j < disp.size(); j++) {
- IconType iconT = (IconType) disp.get(j);
- fetchedIcon = iconT.getSmallIcon().getTextContent();
- System.out.println("The icon name for component is "
- + fetchedIcon);
- assertEquals(icon, fetchedIcon);
- break;
- }
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- // componentType
- String compType = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList components = edit1.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- compType = comp.getComponentType().getTextContent();
- System.out.println("The comp type for component is "
- + compType);
- assertEquals("component-type", compType);
- break;
- }
- }
-
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // componentClass
- String compClass = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList components = edit1.getFacesConfig().getComponent();
- for (int i = 0; i < components.size(); i++) {
- ComponentType comp = (ComponentType) components.get(i);
- compClass = comp.getComponentClass().getTextContent();
- System.out.println("The comp class for component is "
- + compClass);
- assertEquals("component-class", compClass);
- break;
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverter.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverter.java
deleted file mode 100644
index 53f62da..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverter.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteConverter extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteConverter(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteApplication() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- //String desc = "description";
- String dispName = "display-name";
- String converterForClass = "converter-for-class";
- String converterClass= "converter-class";
- String converterIcon="Converter-icon";
-
- //attribute related variables
- String attributeDispName = "attribute-display-name";
- String attributeIcon= "attribute-icon";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ConverterType newApplication = facesConfigFactory.createConverterType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconT = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(converterIcon);
- iconT.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconT);
-
- ConverterClassType converterClassType = facesConfigFactory.createConverterClassType();
- converterClassType.setTextContent(converterClass);
- newApplication.setConverterClass(converterClassType);
-
- ConverterForClassType converterForClassType = facesConfigFactory.createConverterForClassType();
- converterForClassType.setTextContent(converterForClass);
- newApplication.setConverterForClass(converterForClassType);
-
- AttributeType attrType = facesConfigFactory.createAttributeType();
-
- DisplayNameType attributeDisplayName= facesConfigFactory.createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon= facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- //ATTRIBUTE EXTENSION HERE
-
- /* AttributeExtensionType attrExtType = facesConfigFactory.createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- newApplication.getAttribute().add(attrType);
- */
- edit.getFacesConfig().getConverter().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getConverter();
- for (int i = 0; i < lifecycles.size(); i++) {
- ConverterType lifecycle = (ConverterType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- // TODO: ??
-// DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
-// result = phaseListener.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-}
-
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverterTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverterTwoFiles.java
deleted file mode 100644
index e782f9a..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverterTwoFiles.java
+++ /dev/null
@@ -1,859 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeExtensionType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteConverterTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit2 = null;
-
- FacesConfigArtifactEdit edit1 = null;
-
- String dispName = "display-name";
-
- String converterForClass = "converter-for-class";
-
- String converterClass = "converter-class";
-
- String converterIcon = "Converter-icon";
-
- // attribute related variables
- String attributeDispName = "attribute-display-name";
-
- String attributeIcon = "attribute-icon";
-
- public FacesConfigFactoryImplForWriteConverterTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteApplication() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ConverterType newApplication = facesConfigFactory
- .createConverterType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconT = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(converterIcon);
- iconT.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconT);
-
- ConverterClassType converterClassType = facesConfigFactory.createConverterClassType();
- converterClassType.setTextContent(converterClass);
- newApplication.setConverterClass(converterClassType);
-
- ConverterForClassType converterForClassType = facesConfigFactory.createConverterForClassType();
- converterForClassType.setTextContent(converterForClass);
- newApplication.setConverterForClass(converterForClassType);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- AttributeExtensionType attrExtType = facesConfigFactory
- .createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- newApplication.getAttribute().add(attrType);
-
- newApplication.getAttribute().add(attrType);
-
- // need to add Propety here PropertyType
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name-validation-file-two");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class-validation-file-two");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propDefaultValueType = facesConfigFactory.createDefaultValueType();
- propDefaultValueType.setTextContent("property-default-value-validation-file-two");
- propType.setDefaultValue(propDefaultValueType);
-
- newApplication.getProperty().add(propType);
-
- edit2.getFacesConfig().getConverter().add(newApplication);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList nameList = converter.getDisplayName();
- for (int j = 0; j < nameList.size(); j++) {
- DisplayNameType name = (DisplayNameType) nameList
- .get(j);
- result = name.getTextContent();
- assertEquals(dispName, result);
- System.out
- .println("The display name in converter has value :: "
- + result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // icon
- String icon = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList iconList = converter.getIcon();
- for (int j = 0; j < iconList.size(); j++) {
- IconType iconT = (IconType) iconList.get(j);
- icon = iconT.getSmallIcon().getTextContent();
- assertEquals(converterIcon, icon);
- System.out
- .println("The display name in converter has value :: "
- + icon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // converer-for-class
- String conForClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- conForClass = converter.getConverterForClass().getTextContent();
- assertEquals(converterForClass, conForClass);
- System.out
- .println("The converter for class in converter has value :: "
- + conForClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // coverterClass
- String conClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- conClass = converter.getConverterClass().getTextContent();
- assertEquals(converterClass, conClass);
- System.out
- .println("The converter class in converter has value :: "
- + conClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- String displayNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList displayNameList = attType.getDisplayName();
- for (int k = 0; k < displayNameList.size(); k++) {
- DisplayNameType dispType = (DisplayNameType) displayNameList
- .get(j);
- displayNameResult = dispType.getTextContent();
- System.out
- .println("attribute display name for file 2 of converter is : "
- + displayNameResult);
- assertEquals(attributeDispName,
- displayNameResult);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // ATTRIBUTE PART OF CONVERTER.
- // attribute-name
- String attributeNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeNameResult = attType.getAttributeName().getTextContent();
- System.out
- .println("**** attribute name for file 2 of converter is : "
- + attributeNameResult);
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeIcon
- String attributeIconResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList iconList = attType.getIcon();
- for (int k = 0; k < iconList.size(); k++) {
- IconType iconType = (IconType) iconList.get(j);
- attributeIconResult = iconType.getSmallIcon().getTextContent();
- System.out
- .println("attribute icon name for file 2 of converter is : "
- + attributeIconResult);
- assertEquals(attributeIcon, attributeIconResult);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeClassResult = attType.getAttributeClass().getTextContent();
- System.out
- .println("attribute classe for file 2 of converter is : "
- + attributeClassResult);
- assertEquals("attribute-class",
- attributeClassResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeValue
- String attributeValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("attribute default value for file 2 of converter is : "
- + attributeValueResult);
- assertEquals("default-value", attributeValueResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // suggestedValue
- String suggestedValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList converterList = edit2.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- suggestedValueResult = attType.getSuggestedValue().getTextContent();
- System.out
- .println("attribute suggested value for file 2 of converter is : "
- + suggestedValueResult);
- assertEquals("suggested-value",
- suggestedValueResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //PROPERTY
-
-
-
- }
-
- }
-
- public void testWriteConverterToFilesOne() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ConverterType newApplication = facesConfigFactory
- .createConverterType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconT = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(converterIcon);
- iconT.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconT);
-
- ConverterClassType converterClassType = facesConfigFactory.createConverterClassType();
- converterClassType.setTextContent(converterClass);
- newApplication.setConverterClass(converterClassType);
-
- ConverterForClassType converterForClassType = facesConfigFactory.createConverterForClassType();
- converterForClassType.setTextContent(converterForClass);
- newApplication.setConverterForClass(converterForClassType);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- // ATTRIBUTE EXTENSION HERE
-
- /*
- * AttributeExtensionType attrExtType =
- * facesConfigFactory.createAttributeExtensionType();
- * attrType.getAttributeExtension().add(attrExtType);
- * newApplication.getAttribute().add(attrType);
- */
- edit1.getFacesConfig().getConverter().add(newApplication);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList phaseListeners = converter.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- result = phaseListener.getTextContent();
- assertEquals(dispName, result);
- System.out
- .println("The display name in converter has value :: "
- + result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // icon
- String icon = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList phaseListeners = converter.getIcon();
- for (int j = 0; j < phaseListeners.size(); j++) {
- IconType phaseListener = (IconType) phaseListeners
- .get(j);
- icon = phaseListener.getSmallIcon().getTextContent();
- assertEquals(converterIcon, icon);
- System.out
- .println("The display name in converter has value :: "
- + icon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // converer-for-class
- String conForClass = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- conForClass = converter.getConverterForClass().getTextContent();
- assertEquals(converterForClass, conForClass);
- System.out
- .println("The display name in converter has value :: "
- + conForClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // coverterClass
- String conClass = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- conClass = converter.getConverterClass().getTextContent();
- assertEquals(converterClass, conClass);
- System.out
- .println("The converter class in converter has value :: "
- + conClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- String displayNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList displayNameList = attType.getDisplayName();
- for (int k = 0; k < displayNameList.size(); k++) {
- DisplayNameType dispType = (DisplayNameType) displayNameList
- .get(j);
- displayNameResult = dispType.getTextContent();
- System.out
- .println("attribute display name for file 1 of converter is : "
- + displayNameResult);
- assertEquals(attributeDispName,
- displayNameResult);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // ATTRIBUTE PART OF CONVERTER.
- // attribute-name
- String attributeNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeNameResult = attType.getAttributeName().getTextContent();
- System.out
- .println("**** attribute name for file 1 of converter is : "
- + attributeNameResult);
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // attributeIcon
- String attributeIconResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList iconList = attType.getIcon();
- for (int k = 0; k < iconList.size(); k++) {
- IconType iconType = (IconType) iconList.get(j);
- attributeIconResult = iconType.getSmallIcon().getTextContent();
- System.out
- .println("attribute icon name for file 1 of converter is : "
- + attributeIconResult);
- assertEquals(attributeIcon, attributeIconResult);
- break;
- }
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeClassResult = attType.getAttributeClass().getTextContent();
- System.out
- .println("attribute classe for file 1 of converter is : "
- + attributeClassResult);
- assertEquals("attribute-class",
- attributeClassResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // attributeValue
- String attributeValueResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("attribute default value for file 1 of converter is : "
- + attributeValueResult);
- assertEquals("default-value", attributeValueResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // suggestedValue
- String suggestedValueResult = null;
- try {
- edit1 = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project,
- "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList converterList = edit1.getFacesConfig().getConverter();
- for (int i = 0; i < converterList.size(); i++) {
- ConverterType converter = (ConverterType) converterList
- .get(i);
- EList attributeList = converter.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- suggestedValueResult = attType.getSuggestedValue().getTextContent();
- System.out
- .println("attribute suggested value for file 1 of converter is : "
- + suggestedValueResult);
- assertEquals("suggested-value",
- suggestedValueResult);
- break;
- }
- }
- }
- } finally {
-
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactory.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactory.java
deleted file mode 100644
index af32715..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactory.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- */
-
-//NEEDS to be changed to reflect navigagtion rule
-// as of now it just shows lifeclycle.
-
-public class FacesConfigFactoryImplForWriteFactory extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteFactory(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteFacesconfigFile() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
- String applicationFactory="";
- applicationFactory += "application-factory";
- String facesContext = "Faces-Contexto";
- String lifecyclefactory = "lifecycle-factory";
- String renderKitFactory = "render-kit-factory";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- ApplicationFactoryType newApplicationFactory = facesConfigFactory.createApplicationFactoryType();
- newApplicationFactory.setTextContent(applicationFactory);
- newfactory.getApplicationFactory().add(newApplicationFactory);
-
- FacesContextFactoryType facesContextFactory = facesConfigFactory.createFacesContextFactoryType();
- facesContextFactory.setTextContent(facesContext);
- newfactory.getFacesContextFactory().add(facesContextFactory);
-
-
- LifecycleFactoryType lifeclycleFactory = facesConfigFactory.createLifecycleFactoryType();
- lifeclycleFactory.setTextContent(lifecyclefactory);
- newfactory.getLifecycleFactory().add(lifeclycleFactory);
-
- RenderKitFactoryType renderKit = facesConfigFactory.createRenderKitFactoryType();
- renderKit.setTextContent(renderKitFactory);
- newfactory.getRenderKitFactory().add(renderKit);
-
-
- edit.getFacesConfig().getFactory().add(newfactory);
-
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getFactory();
- for (int i = 0; i < lifecycles.size(); i++) {
- FactoryType lifecycle = (FactoryType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getApplicationFactory();
- for (int j=0; j<phaseListeners.size(); j++) {
- //TODO:??
- // ApplicationFactoryType phaseListener = (ApplicationFactoryType)phaseListeners.get(j);
- //result = phaseListener.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- public void testWriteFactoryFacesContextFactory() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
- //String sTestString = "";
- String facesContextFactory=null;
-
-
- facesContextFactory = "faces-context-factory";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
-
- FacesContextFactoryType newFacesContextFactory = facesConfigFactory.createFacesContextFactoryType();
-
-
- newFacesContextFactory.setTextContent(facesContextFactory);
- newfactory.getFacesContextFactory().add(newFacesContextFactory);
- edit.getFacesConfig().getFactory().add(newfactory);
-
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList factories = edit.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList facescContextFactories = factory.getFacesContextFactory();
- for (int j=0; j<facescContextFactories.size(); j++) {
- // TODO:???
-// FacesContextFactoryType faacesContext = (FacesContextFactoryType)facescContextFactories.get(j);
-// result = faacesContext.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testWriteFactoryLifecycleFactory() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
- //String sTestString = "";
- String lifecycleFactory=null;
-
-
- lifecycleFactory = "lifecycle-factory";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
-
- LifecycleFactoryType newLifecycleFactory = facesConfigFactory.createLifecycleFactoryType();
-
-
- newLifecycleFactory.setTextContent(lifecycleFactory);
- newfactory.getLifecycleFactory().add(newLifecycleFactory);
- edit.getFacesConfig().getFactory().add(newfactory);
-
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList factories = edit.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList lifecycleFactories = factory.getLifecycleFactory();
- for (int j=0; j<lifecycleFactories.size(); j++) {
- // TODO: ???
-// LifecycleFactoryType lifecyle = (LifecycleFactoryType)lifecycleFactories.get(j);
-// result = lifecyle.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-
-
- public void testWriteRednderKitFactory() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
- //String sTestString = "";
- String renderKitFactory=null;
-
- renderKitFactory = "render-kit-factory";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- RenderKitFactoryType renderKitFact = facesConfigFactory.createRenderKitFactoryType();
-
- renderKitFact.setTextContent(renderKitFactory);
- newfactory.getRenderKitFactory().add(renderKitFact);
- edit.getFacesConfig().getFactory().add(newfactory);
-
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList factories = edit.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList renderKitFactories = factory.getRenderKitFactory();
- for (int j=0; j<renderKitFactories.size(); j++) {
- // TODO: ???
-// RenderKitFactoryType render = (RenderKitFactoryType)renderKitFactories.get(j);
-// result = render.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactoryTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactoryTwoFiles.java
deleted file mode 100644
index 415af89..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactoryTwoFiles.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- */
-
-//NEEDS to be changed to reflect navigagtion rule
-// as of now it just shows lifeclycle.
-
-public class FacesConfigFactoryImplForWriteFactoryTwoFiles extends TestCase {
- IProject project = null;
- FacesConfigArtifactEdit edit1 = null;
- FacesConfigArtifactEdit edit2 = null;
-
- private static final String applicationFactory = "application-factory";
- private static final String facesContext = "Faces-Contexto";
- private static final String lifecyclefactory = "lifecycle-factory";
- private static final String renderKitFactory = "render-kit-factory";
-
-
- public FacesConfigFactoryImplForWriteFactoryTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteFacesconfigFile() {
- //IProject project = WizardUtil.getTestProject();
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- ApplicationFactoryType newApplicationFactory = facesConfigFactory.createApplicationFactoryType();
- newApplicationFactory.setTextContent(applicationFactory);
- newfactory.getApplicationFactory().add(newApplicationFactory);
-
- FacesContextFactoryType facesContextFactory = facesConfigFactory.createFacesContextFactoryType();
- facesContextFactory.setTextContent(facesContext);
- newfactory.getFacesContextFactory().add(facesContextFactory);
-
-
- LifecycleFactoryType lifeclycleFactory = facesConfigFactory.createLifecycleFactoryType();
- lifeclycleFactory.setTextContent(lifecyclefactory);
- newfactory.getLifecycleFactory().add(lifeclycleFactory);
-
- RenderKitFactoryType renderKit = facesConfigFactory.createRenderKitFactoryType();
- renderKit.setTextContent(renderKitFactory);
- newfactory.getRenderKitFactory().add(renderKit);
-
-
- edit2.getFacesConfig().getFactory().add(newfactory);
-
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList factoryList = edit2.getFacesConfig().getFactory();
- for (int i = 0; i < factoryList.size(); i++) {
- FactoryType facto = (FactoryType) factoryList.get(i);
- EList appFactList = facto.getApplicationFactory();
- for (int j=0; j<appFactList.size(); j++) {
- ApplicationFactoryType app = (ApplicationFactoryType)appFactList.get(j);
- String result = app.getTextContent();
- assertEquals(result, applicationFactory);
- // TODO: eliminate loop and assertEquals(1, appFactList.size())?
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-
-
- //fileOne
- public void testWriteFacesconfigFileToFile() {
- //IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- ApplicationFactoryType newApplicationFactory = facesConfigFactory.createApplicationFactoryType();
- newApplicationFactory.setTextContent(applicationFactory);
- newfactory.getApplicationFactory().add(newApplicationFactory);
-
- FacesContextFactoryType facesContextFactory = facesConfigFactory.createFacesContextFactoryType();
- facesContextFactory.setTextContent(facesContext);
- newfactory.getFacesContextFactory().add(facesContextFactory);
-
-
- LifecycleFactoryType lifeclycleFactory = facesConfigFactory.createLifecycleFactoryType();
- lifeclycleFactory.setTextContent(lifecyclefactory);
- newfactory.getLifecycleFactory().add(lifeclycleFactory);
-
- RenderKitFactoryType renderKit = facesConfigFactory.createRenderKitFactoryType();
- renderKit.setTextContent(renderKitFactory);
- newfactory.getRenderKitFactory().add(renderKit);
-
-
- edit1.getFacesConfig().getFactory().add(newfactory);
-
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < lifecycles.size(); i++) {
- FactoryType lifecycle = (FactoryType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getApplicationFactory();
- for (int j=0; j<phaseListeners.size(); j++) {
- // TODO: ???
-// ApplicationFactoryType phaseListener = (ApplicationFactoryType)phaseListeners.get(j);
-// result = phaseListener.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-
-
-
- public void testWriteFactoryFacesContextFactory() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit2 = null;
-
- String facesContextFactory=null;
-
-
- facesContextFactory = "faces-context-factory";
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
-
- FacesContextFactoryType newFacesContextFactory = facesConfigFactory.createFacesContextFactoryType();
-
-
- newFacesContextFactory.setTextContent(facesContextFactory);
- newfactory.getFacesContextFactory().add(newFacesContextFactory);
- edit2.getFacesConfig().getFactory().add(newfactory);
-
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList factories = edit2.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList facescContextFactories = factory.getFacesContextFactory();
- for (int j=0; j<facescContextFactories.size(); j++) {
- // TODO:???
-// FacesContextFactoryType faacesContext = (FacesContextFactoryType)facescContextFactories.get(j);
-// result = faacesContext.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-
-
- //fileOne version is below:
- public void testWriteFactoryFacesContextFactoryToFileOne() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit1 = null;
- String facesContextFactory=null;
-
- facesContextFactory = "faces-context-factory";
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
-
- FacesContextFactoryType newFacesContextFactory = facesConfigFactory.createFacesContextFactoryType();
-
-
- newFacesContextFactory.setTextContent(facesContextFactory);
- newfactory.getFacesContextFactory().add(newFacesContextFactory);
- edit1.getFacesConfig().getFactory().add(newfactory);
-
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit1.getFacesConfig() != null) {
- EList factories = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList facescContextFactories = factory.getFacesContextFactory();
- for (int j=0; j<facescContextFactories.size(); j++) {
- // TODO: ??
-// FacesContextFactoryType faacesContext = (FacesContextFactoryType)facescContextFactories.get(j);
-// result = faacesContext.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-
-
-
- public void testWriteFactoryLifecycleFactory() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit1 = null;
-
- String lifecycleFactory=null;
-
- lifecycleFactory = "lifecycle-factory";
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- LifecycleFactoryType newLifecycleFactory = facesConfigFactory.createLifecycleFactoryType();
-
- newLifecycleFactory.setTextContent(lifecycleFactory);
- newfactory.getLifecycleFactory().add(newLifecycleFactory);
- edit2.getFacesConfig().getFactory().add(newfactory);
-
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList factories = edit2.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList lifecycleFactories = factory.getLifecycleFactory();
- for (int j=0; j<lifecycleFactories.size(); j++) {
- // TODO: ???
-// LifecycleFactoryType lifecyle = (LifecycleFactoryType)lifecycleFactories.get(j);
-// result = lifecyle.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-
-
- //for fileOne
-
- public void testWriteFactoryLifecycleFactoryToFileOne() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit1 = null;
-
- String lifecycleFactory=null;
-
-
- lifecycleFactory = "lifecycle-factory";
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
-
- LifecycleFactoryType newLifecycleFactory = facesConfigFactory.createLifecycleFactoryType();
-
-
- newLifecycleFactory.setTextContent(lifecycleFactory);
- newfactory.getLifecycleFactory().add(newLifecycleFactory);
- edit1.getFacesConfig().getFactory().add(newfactory);
-
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList factories = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList lifecycleFactories = factory.getLifecycleFactory();
- for (int j=0; j<lifecycleFactories.size(); j++) {
- // TODO: ???
-// LifecycleFactoryType lifecyle = (LifecycleFactoryType)lifecycleFactories.get(j);
-// result = lifecyle.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-
-
-
- public void testWriteRednderKitFactory() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit1 = null;
-
- final String renderKitFactory1= "render-kit-factory";
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- RenderKitFactoryType renderKitFact = facesConfigFactory.createRenderKitFactoryType();
-
- renderKitFact.setTextContent(renderKitFactory1);
- newfactory.getRenderKitFactory().add(renderKitFact);
- edit2.getFacesConfig().getFactory().add(newfactory);
-
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- //String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList factories = edit2.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList renderKitFactories = factory.getRenderKitFactory();
- for (int j=0; j<renderKitFactories.size(); j++) {
- // TODO: ????
-// RenderKitFactoryType render = (RenderKitFactoryType)renderKitFactories.get(j);
-// result = render.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-
-
- //for file one
-
- public void testWriteRednderKitFactoryToFileOne() {
- //IProject project = WizardUtil.getTestProject();
- //FacesConfigArtifactEdit edit1 = null;
-
- final String renderKitFactory1="render-kit-factory";
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- FactoryType newfactory = facesConfigFactory.createFactoryType();
-
- RenderKitFactoryType renderKitFact = facesConfigFactory.createRenderKitFactoryType();
-
- renderKitFact.setTextContent(renderKitFactory1);
- newfactory.getRenderKitFactory().add(renderKitFact);
- edit1.getFacesConfig().getFactory().add(newfactory);
-
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit1.getFacesConfig() != null) {
- EList factories = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < factories.size(); i++) {
- FactoryType factory = (FactoryType) factories.get(i);
- EList renderKitFactories = factory.getRenderKitFactory();
- for (int j=0; j<renderKitFactories.size(); j++) {
- // TODO: ???
-// RenderKitFactoryType render = (RenderKitFactoryType)renderKitFactories.get(j);
-// result = render.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycle.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycle.java
deleted file mode 100644
index 225b558..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycle.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
-import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteLifecycle extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteLifecycle(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteLifecycleToFileTwo() {
- // IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- String phaseListener = "test2";
-
- // Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
- LifecycleType newLifecycle = facesConfigFactory
- .createLifecycleType();
- PhaseListenerType newPhaseListener = facesConfigFactory
- .createPhaseListenerType();
- newPhaseListener.setTextContent(phaseListener);
- newLifecycle.getPhaseListener().add(newPhaseListener);
- edit.getFacesConfig().getLifecycle().add(newLifecycle);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- //TODO: never read. String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getFactory();
- for (int i = 0; i < lifecycles.size(); i++) {
- FactoryType lifecycle = (FactoryType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getApplicationFactory();
- for (int j = 0; j < phaseListeners.size(); j++) {
- //ApplicationFactoryType phaseLis = (ApplicationFactoryType) phaseListeners
- // .get(j);
- // TODO: what's the point?
- // result = phaseLis.getTextContent();
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testWriteLifecycleToFileOne() {
- // IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit1 = null;
-
- String phaseListener = "test1";
-
- // Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
- LifecycleType newLifecycle = facesConfigFactory
- .createLifecycleType();
- PhaseListenerType newPhaseListener = facesConfigFactory
- .createPhaseListenerType();
- newPhaseListener.setTextContent(phaseListener);
- newLifecycle.getPhaseListener().add(newPhaseListener);
- edit1.getFacesConfig().getLifecycle().add(newLifecycle);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- // TODO: never read: String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getFactory();
- for (int i = 0; i < lifecycles.size(); i++) {
- FactoryType lifecycle = (FactoryType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getApplicationFactory();
- for (int j = 0; j < phaseListeners.size(); j++) {
- //TODO: what's the point of this?
-// ApplicationFactoryType phaseLis = (ApplicationFactoryType) phaseListeners
-// .get(j);
-// result = phaseLis.getTextContent();
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycleTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycleTwoFiles.java
deleted file mode 100644
index 177ba67..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycleTwoFiles.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
-import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-//DefaultRenderKitIdType
-
-
-public class FacesConfigFactoryImplForWriteLifecycleTwoFiles extends TestCase {
- IProject project = null;
- FacesConfigArtifactEdit edit1 = null;
- FacesConfigArtifactEdit edit2 = null;
-
- private final String phaseListener1 = "test1";
- private final String phaseListener2 = "test2";
-
- public FacesConfigFactoryImplForWriteLifecycleTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteToFileTwo() {
- //IProject project = WizardUtil.getTestProject();
-
- //Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
- LifecycleType newLifecycle = facesConfigFactory.createLifecycleType();
- PhaseListenerType newPhaseListener = facesConfigFactory.createPhaseListenerType();
- newPhaseListener.setTextContent(phaseListener2);
- newLifecycle.getPhaseListener().add(newPhaseListener);
- edit2.getFacesConfig().getLifecycle().add(newLifecycle);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList lifecycles = edit2.getFacesConfig().getLifecycle();
- boolean foundPhaseListener2 = false;
- for (int i = 0; i < lifecycles.size(); i++) {
- LifecycleType lifecycle = (LifecycleType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getPhaseListener();
- for (int j=0; j<phaseListeners.size(); j++) {
- PhaseListenerType phaseLis = (PhaseListenerType)phaseListeners.get(j);
- result = phaseLis.getTextContent();
- System.out.println("The PhaseListener in lifecycle is (for file two) " + result);
- if (phaseListener2.equals(result))
- {
- foundPhaseListener2 = true;
- break;
- }
- }
- }
- assertTrue(foundPhaseListener2);
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
- public void testWriteToFileOne() {
- //IProject project = WizardUtil.getTestProject();
-
- //Local-Config is REMAINING HERE TO BE ADDED LATER ON.
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
- LifecycleType newLifecycle = facesConfigFactory.createLifecycleType();
- PhaseListenerType newPhaseListener = facesConfigFactory.createPhaseListenerType();
- newPhaseListener.setTextContent(phaseListener1);
- newLifecycle.getPhaseListener().add(newPhaseListener);
- edit1.getFacesConfig().getLifecycle().add(newLifecycle);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //String result_one = null;
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getLifecycle();
- for (int i = 0; i < lifecycles.size(); i++) {
- LifecycleType lifecycle = (LifecycleType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getPhaseListener();
- for (int j=0; j<phaseListeners.size(); j++) {
- PhaseListenerType phaseLis = (PhaseListenerType)phaseListeners.get(j);
- result = phaseLis.getTextContent();
- System.out.println("The PhaseListener in lifecycle is (for file two) " + result);
- assertEquals(phaseListener1,result);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBean.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBean.java
deleted file mode 100644
index e7792cf..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBean.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteManagedBean extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteManagedBean(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteManagedBean() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- //String desc = "description";
- String dispName = "display-name";
-
- String propertyDisplayName = "managed-property-display-name";
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ManagedBeanType managedBT = facesConfigFactory.createManagedBeanType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- managedBT.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent("SMALL-ICON");
- iconType.setSmallIcon(smallIconType);
- managedBT.getIcon().add(iconType);
-
- ManagedBeanNameType managedBeanNameType = facesConfigFactory.createManagedBeanNameType();
- managedBeanNameType.setTextContent("MANAGED-BEAN-NAME");
- managedBT.setManagedBeanName(managedBeanNameType);
-
- ManagedBeanClassType managedBeanClassType = facesConfigFactory.createManagedBeanClassType();
- managedBeanClassType.setTextContent("MANAGED-BEAN-CLASS");
- managedBT.setManagedBeanClass(managedBeanClassType);
-
- ManagedBeanScopeType managedBeanScopeType = facesConfigFactory.createManagedBeanScopeType();
- managedBeanScopeType.setTextContent("MANAGED-BEAN-SCOPE");
- managedBT.setManagedBeanScope(managedBeanScopeType);
-
- ManagedPropertyType manageedPropType = facesConfigFactory.createManagedPropertyType();
-
- DisplayNameType propertyDispName= facesConfigFactory.createDisplayNameType();
- propertyDispName.setTextContent(propertyDisplayName);
- manageedPropType.getDisplayName().add(propertyDispName);
-
- IconType propertyIconType= facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent("property-SMALL-ICON");
- propertyIconType.setLargeIcon(largeIconType);
- manageedPropType.getIcon().add(propertyIconType);
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("managedBean->managedProperty->property-name");
- manageedPropType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("managedBean->managedProperty->property-class");
- manageedPropType.setPropertyClass(propertyClassType);
- /*
- * THERE IS A SERIOUS PROBLEM HERE THE "null-value" tag should have No value
- * inside it but here i am able to set some values which makes the XML file
- * invalid.
- */
- //manageedPropType.setNullValue("managedBean->managedProperty->property-nullValue");
- /* Problem: discussed this with Xiao nan on 03/29/06
- * The following is REDUNDANT and should actually be removed from the API.
- * manageedPropType.setNullValue(null) produces the same output as not having it there
- * even more important is that in either case another value has to be added to conform
- * to the xml file so that it validates.
- */
- //manageedPropType.setNullValue(null);
- ValueType valueType = facesConfigFactory.createValueType();
- valueType.setTextContent("some new value instead of null values");
- manageedPropType.setValue(valueType);
- managedBT.getManagedProperty().add(manageedPropType);
-
- //managedBT.getDisplayName().add(actionList);
- edit.getFacesConfig().getManagedBean().add(managedBT);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- // TODO: never read String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- // TODO: never used?DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
- // TODO: never tested? result = phaseListener.getTextContent();
- // TODO: this break kills loop after 1 iteration?
- break;
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-}
-
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBeanTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBeanTwoFiles.java
deleted file mode 100644
index a9254b2..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBeanTwoFiles.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteManagedBeanTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit = null;
-
- FacesConfigArtifactEdit edit1 = null;
-
- public FacesConfigFactoryImplForWriteManagedBeanTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteManagedBean() {
- // IProject project = WizardUtil.getTestProject();
-
- String dispName = "display-name-two";
- String propertyDisplayName = "managed-property-display-name";
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ManagedBeanType managedBT = facesConfigFactory
- .createManagedBeanType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- managedBT.getDisplayName().add(actionList);
-
- IconType iconType = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent("SMALL-ICON");
- iconType.setSmallIcon(smallIconType);
- managedBT.getIcon().add(iconType);
-
- ManagedBeanNameType managedBeanNameType = facesConfigFactory.createManagedBeanNameType();
- managedBeanNameType.setTextContent("MANAGED-BEAN-NAME");
- managedBT.setManagedBeanName(managedBeanNameType);
-
- ManagedBeanClassType managedBeanClassType = facesConfigFactory.createManagedBeanClassType();
- managedBeanClassType.setTextContent("MANAGED-BEAN-CLASS");
- managedBT.setManagedBeanClass(managedBeanClassType);
-
- ManagedBeanScopeType managedBeanScopeType = facesConfigFactory.createManagedBeanScopeType();
- managedBeanScopeType.setTextContent("MANAGED-BEAN-SCOPE");
- managedBT.setManagedBeanScope(managedBeanScopeType);
-
- ManagedPropertyType manageedPropType = facesConfigFactory
- .createManagedPropertyType();
-
- DisplayNameType propertyDispName = facesConfigFactory
- .createDisplayNameType();
- propertyDispName.setTextContent(propertyDisplayName);
- manageedPropType.getDisplayName().add(propertyDispName);
-
- IconType propertyIconType = facesConfigFactory.createIconType();
- LargeIconType propertyLargeIconType = facesConfigFactory.createLargeIconType();
- propertyLargeIconType.setTextContent("property-SMALL-ICON");
- propertyIconType.setLargeIcon(propertyLargeIconType);
- manageedPropType.getIcon().add(propertyIconType);
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("managedBean->managedProperty->property-name");
- manageedPropType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("managedBean->managedProperty->property-class");
- manageedPropType.setPropertyClass(propertyClassType);
-
- ValueType valueType = facesConfigFactory.createValueType();
- valueType.setTextContent("some new value instead of null values");
- manageedPropType.setValue(valueType);
- managedBT.getManagedProperty().add(manageedPropType);
-
- // managedBT.getDisplayName().add(actionList);
- edit.getFacesConfig().getManagedBean().add(managedBT);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
-
- EList lifecycles = edit.getFacesConfig().getManagedBean();
- for (int i = 0; i < lifecycles.size(); i++) {
- ManagedBeanType lifecycle = (ManagedBeanType) lifecycles
- .get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- result = phaseListener.getTextContent();
- System.out
- .println("wrte-read results is (for file 2): "
- + result);
-
- break;
- }
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testWriteManagedBeanToFileOne() {
- String displayName = "display-name-file-one";
-
- String propertyDisplayName = "managed-property-display-name-file-one";
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ManagedBeanType managedBT = facesConfigFactory
- .createManagedBeanType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(displayName);
- managedBT.getDisplayName().add(actionList);
-
- IconType iconType = facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent("SMALL-ICON");
- iconType.setSmallIcon(smallIconType);
- managedBT.getIcon().add(iconType);
-
- ManagedBeanNameType managedBeanNameType = facesConfigFactory.createManagedBeanNameType();
- managedBeanNameType.setTextContent("MANAGED-BEAN-NAME");
- managedBT.setManagedBeanName(managedBeanNameType);
-
- ManagedBeanClassType managedBeanClassType = facesConfigFactory.createManagedBeanClassType();
- managedBeanClassType.setTextContent("MANAGED-BEAN-CLASS");
- managedBT.setManagedBeanClass(managedBeanClassType);
-
- ManagedBeanScopeType managedBeanScopeType = facesConfigFactory.createManagedBeanScopeType();
- managedBeanScopeType.setTextContent("MANAGED-BEAN-SCOPE");
- managedBT.setManagedBeanScope(managedBeanScopeType);
-
- ManagedPropertyType manageedPropType = facesConfigFactory
- .createManagedPropertyType();
-
- DisplayNameType propertyDispName = facesConfigFactory
- .createDisplayNameType();
- propertyDispName.setTextContent(propertyDisplayName);
- manageedPropType.getDisplayName().add(propertyDispName);
-
- IconType propertyIconType = facesConfigFactory.createIconType();
- LargeIconType propertyLargeIconType = facesConfigFactory.createLargeIconType();
- propertyLargeIconType.setTextContent("property-LARGE-ICON");
- propertyIconType.setLargeIcon(propertyLargeIconType);
- manageedPropType.getIcon().add(propertyIconType);
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("managedBean->managedProperty->property-name");
- manageedPropType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("managedBean->managedProperty->property-class");
- manageedPropType.setPropertyClass(propertyClassType);
-
- ValueType valueType = facesConfigFactory.createValueType();
- valueType.setTextContent("some new value instead of null values");
- manageedPropType.setValue(valueType);
- managedBT.getManagedProperty().add(manageedPropType);
-
- // managedBT.getDisplayName().add(actionList);
- edit1.getFacesConfig().getManagedBean().add(managedBT);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- String resu = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < lifecycles.size(); i++) {
- ManagedBeanType lifecycle = (ManagedBeanType) lifecycles
- .get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- resu = phaseListener.getTextContent();
- System.out.println("write-read results is (file one) "
- + resu);
- assertEquals("display-name-file-one", resu);
- break;
- }
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- String icon = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < lifecycles.size(); i++) {
- ManagedBeanType lifecycle = (ManagedBeanType) lifecycles
- .get(i);
- EList phaseListeners = lifecycle.getIcon();
- for (int j = 0; j < phaseListeners.size(); j++) {
- IconType phaseListener = (IconType) phaseListeners
- .get(j);
- icon = phaseListener.getSmallIcon().getTextContent();
- System.out.println("wrte-read ICON results is (file one) "
- + icon);
- // for now comment this out!!
- assertEquals("SMALL-ICON", icon);
- break;
- }
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String ManagedBeanName = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeans = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeans.size(); i++) {
- ManagedBeanType managedBean = (ManagedBeanType) managedBeans
- .get(i);
-
- ManagedBeanName = managedBean.getManagedBeanName().getTextContent();
- System.out.println("wrte-read results is (file one) "
- + ManagedBeanName);
-
- assertEquals("MANAGED-BEAN-NAME", ManagedBeanName);
- break;
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String ManagedBeanClass = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeans = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeans.size(); i++) {
- ManagedBeanType managedBean = (ManagedBeanType) managedBeans
- .get(i);
-
- ManagedBeanClass = managedBean.getManagedBeanClass().getTextContent();
-
- System.out.println("wrte-read results is (file one) "
- + ManagedBeanClass);
-
- assertEquals("MANAGED-BEAN-CLASS", ManagedBeanClass);
- break;
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String ManagedBeanScope = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeans = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeans.size(); i++) {
- ManagedBeanType managedBean = (ManagedBeanType) managedBeans
- .get(i);
- ManagedBeanScope = managedBean.getManagedBeanScope().getTextContent();
- System.out.println("wrte-read results is (file one) "
- + ManagedBeanScope);
- assertEquals("MANAGED-BEAN-SCOPE", ManagedBeanScope);
- break;
- }
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // NEED TO DO THE SAME FOR ***** ==> "MANAGED PROPERTY" HERE!!!
- // PROPERTY PART
- /*
- *
- manageedPropType
- .setPropertyName("managedBean->managedProperty->property-name");
- manageedPropType
- .setPropertyClass("managedBean->managedProperty->property-class");
- manageedPropType
- .setValue("some new value instead of null values");
- *
- */
-
-
-// display name within property
- String propertyDispNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeanList = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeanList.size(); i++) {
- ManagedBeanType beanType = (ManagedBeanType) managedBeanList
- .get(i);
- EList attributeList = beanType.getManagedProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- ManagedPropertyType attType = (ManagedPropertyType) attributeList
- .get(j);
-
- EList namesList = attType.getDisplayName();
- for(int k=0; k<namesList.size(); k++){
- DisplayNameType iconT = (DisplayNameType) namesList.get(k);
- propertyDispNameResult = iconT.getTextContent();
- System.out
- .println("property display name for file 1 of managed bean is : "
- + propertyDispNameResult);
- assertEquals(propertyDisplayName,propertyDispNameResult);
-
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
-
- //icon within property
- String propertyIconResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeanList = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeanList.size(); i++) {
- ManagedBeanType converter = (ManagedBeanType) managedBeanList
- .get(i);
- EList attributeList = converter.getManagedProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- ManagedPropertyType attType = (ManagedPropertyType) attributeList
- .get(j);
-
- EList iconList = attType.getIcon();
- for(int k=0; k<iconList.size(); k++){
- IconType iconT = (IconType) iconList.get(k);
- propertyIconResult = iconT.getLargeIcon().getTextContent();
- System.out
- .println("propetry icon for file 1 of managed bean is : "
- + propertyIconResult);
- assertEquals("property-LARGE-ICON",
- propertyIconResult);
-
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
- String propertyNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeanList = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeanList.size(); i++) {
- ManagedBeanType beanType = (ManagedBeanType) managedBeanList
- .get(i);
- EList attributeList = beanType.getManagedProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- ManagedPropertyType attType = (ManagedPropertyType) attributeList
- .get(j);
- propertyNameResult = attType.getPropertyName().getTextContent();
- System.out
- .println("property name for file 1 of managed-bean is : "
- + propertyNameResult);
- assertEquals("managedBean->managedProperty->property-name",
- propertyNameResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
- String propertyClassResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList managedBeanList = edit1.getFacesConfig().getManagedBean();
- for (int i = 0; i < managedBeanList.size(); i++) {
- ManagedBeanType beanT = (ManagedBeanType) managedBeanList
- .get(i);
- EList attributeList = beanT.getManagedProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- ManagedPropertyType attType = (ManagedPropertyType) attributeList
- .get(j);
- propertyClassResult = attType.getPropertyClass().getTextContent();
- System.out
- .println("propetry class for file 1 of converer is : "
- + propertyClassResult);
- assertEquals("managedBean->managedProperty->property-class",
- propertyClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRule.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRule.java
deleted file mode 100644
index 6d9f113..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRule.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FromActionType;
-import org.eclipse.jst.jsf.facesconfig.emf.FromOutcomeType;
-import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteNavigationRule extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteNavigationRule(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteApplication() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- //String desc = "description";
- String dispName = "display-name";
-
- //Navigation case related values
- String caseDispName ="navigation-case-display-name";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- NavigationRuleType newApplication = facesConfigFactory.createNavigationRuleType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent("large-icon");
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- FromViewIdType fromViewIdType = facesConfigFactory.createFromViewIdType();
- fromViewIdType.setTextContent("from-view-id");
- newApplication.setFromViewId(fromViewIdType);
-
- NavigationCaseType navCaseType = facesConfigFactory.createNavigationCaseType();
-
- DisplayNameType navCasedisplayName= facesConfigFactory.createDisplayNameType();
- navCasedisplayName.setTextContent(caseDispName);
- navCaseType.getDisplayName().add(navCasedisplayName);
-
- IconType navCaseIconType= facesConfigFactory.createIconType();
- LargeIconType navCaseLargeIconType = facesConfigFactory.createLargeIconType();
- navCaseLargeIconType.setTextContent("navigation-case-icon");
- navCaseIconType.setLargeIcon(navCaseLargeIconType);
- navCaseType.getIcon().add(navCaseIconType);
-
- FromActionType fromActionType = facesConfigFactory.createFromActionType();
- fromActionType.setTextContent("navigation-case-from-action");
- navCaseType.setFromAction(fromActionType);
-
- FromOutcomeType fromOutcomeType = facesConfigFactory.createFromOutcomeType();
- fromOutcomeType.setTextContent("navigation-case-from-outcome");
- navCaseType.setFromOutcome(fromOutcomeType);
-
- ToViewIdType toViewIdType = facesConfigFactory.createToViewIdType();
- toViewIdType.setTextContent("navigation-case-from-view-id");
- navCaseType.setToViewId(toViewIdType);
-
- newApplication.getNavigationCase().add(navCaseType);
-
- edit.getFacesConfig().getNavigationRule().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- /*
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
- result = phaseListener.getValue();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }*/
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.java
deleted file mode 100644
index 6276de4..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.java
+++ /dev/null
@@ -1,595 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.FromActionType;
-import org.eclipse.jst.jsf.facesconfig.emf.FromOutcomeType;
-import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteNavigationRuleTwoFiles extends TestCase {
- IProject project = null;
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
- FacesConfigArtifactEdit edit1 = null;
-
- public FacesConfigFactoryImplForWriteNavigationRuleTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteApplication() {
-
- //String desc = "description";
- String dispNameTwo = "display-name";
-
- //Navigation case related values
- String caseDispName ="navigation-case-display-name";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- NavigationRuleType newApplication = facesConfigFactory.createNavigationRuleType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispNameTwo);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent("large-icon");
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- FromViewIdType fromViewIdType = facesConfigFactory.createFromViewIdType();
- fromViewIdType.setTextContent("from-view-id");
- newApplication.setFromViewId(fromViewIdType);
-
- NavigationCaseType navCaseType = facesConfigFactory.createNavigationCaseType();
-
- DisplayNameType navCasedisplayName= facesConfigFactory.createDisplayNameType();
- navCasedisplayName.setTextContent(caseDispName);
- navCaseType.getDisplayName().add(navCasedisplayName);
-
- IconType navCaseIconType= facesConfigFactory.createIconType();
- LargeIconType navCaseLargeIconType = facesConfigFactory.createLargeIconType();
- navCaseLargeIconType.setTextContent("navigation-case-icon");
- navCaseIconType.setLargeIcon(navCaseLargeIconType);
- navCaseType.getIcon().add(navCaseIconType);
-
- FromActionType fromActionType = facesConfigFactory.createFromActionType();
- fromActionType.setTextContent("navigation-case-from-action");
- navCaseType.setFromAction(fromActionType);
-
- FromOutcomeType fromOutcomeType = facesConfigFactory.createFromOutcomeType();
- fromOutcomeType.setTextContent("navigation-case-from-outcome");
- navCaseType.setFromOutcome(fromOutcomeType);
-
- ToViewIdType toViewIdType = facesConfigFactory.createToViewIdType();
- toViewIdType.setTextContent("navigation-case-from-view-id");
- navCaseType.setToViewId(toViewIdType);
-
- newApplication.getNavigationCase().add(navCaseType);
-
- edit.getFacesConfig().getNavigationRule().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList names = rule.getDisplayName();
- for (int j=0; j<names.size(); j++) {
- DisplayNameType displayName = (DisplayNameType)names.get(j);
- result = displayName.getTextContent();
- assertEquals( dispNameTwo ,result);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
-
- //icon
- String resultIcon=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList icons = rule.getIcon();
- for (int j=0; j<icons.size(); j++) {
- IconType iconName = (IconType)icons.get(j);
- resultIcon = iconName.getLargeIcon().getTextContent();
- assertEquals( "large-icon" ,resultIcon);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //fromViewId
- String resultFromViewId=null;
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- resultFromViewId = rule.getFromViewId().getTextContent();
- assertEquals( "from-view-id" ,resultFromViewId);
- break;
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //NAVIGATION CASE REMAINING HERE!!!
- String navCaseResult=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- EList names = navCase.getDisplayName();
- for(int k=0; k<names.size();k++){
- DisplayNameType displayName = (DisplayNameType)names.get(k);
- navCaseResult = displayName.getTextContent();
- assertEquals( "navigation-case-display-name" ,navCaseResult);
- break;
- }
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //icon
- //"navigation-case-icon"
- String iconResult=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- EList icons = navCase.getIcon();
- for(int k=0; k<icons.size();k++){
- IconType icon = (IconType)icons.get(k);
- iconResult = icon.getLargeIcon().getTextContent();
- assertEquals("navigation-case-icon" ,iconResult);
- break;
- }
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
-
- //fromAction
- String fromActionResult=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- fromActionResult = navCase.getFromAction().getTextContent();
- assertEquals( "navigation-case-from-action" ,fromActionResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //fromOutcome
- String fromOutcomeResult=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- fromOutcomeResult = navCase.getFromOutcome().getTextContent();
- assertEquals( "navigation-case-from-outcome" ,fromOutcomeResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- //toViewId
- String toViewIdResult=null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- toViewIdResult = navCase.getToViewId().getTextContent();
- assertEquals( "navigation-case-from-view-id",toViewIdResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
-
-
- }
-
-
- public void testWriteNavigationRuleToFileOne() {
- //String desc = "description-to-file-one";
- String dispNameOne = "display-name-of-file-one";
-
- //Navigation case related values
- String caseDispName ="navigation-case-display-name-of-file-one";
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- NavigationRuleType newApplication = facesConfigFactory.createNavigationRuleType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispNameOne);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent("large-icon");
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- FromViewIdType fromViewIdType = facesConfigFactory.createFromViewIdType();
- fromViewIdType.setTextContent("from-view-id");
- newApplication.setFromViewId(fromViewIdType);
-
- NavigationCaseType navCaseType = facesConfigFactory.createNavigationCaseType();
-
- DisplayNameType navCasedisplayName= facesConfigFactory.createDisplayNameType();
- navCasedisplayName.setTextContent(caseDispName);
- navCaseType.getDisplayName().add(navCasedisplayName);
-
- IconType navCaseIconType= facesConfigFactory.createIconType();
- LargeIconType navCaseLargeIconType = facesConfigFactory.createLargeIconType();
- navCaseLargeIconType.setTextContent("navigation-case-icon-file-one");
- navCaseIconType.setLargeIcon(navCaseLargeIconType);
- navCaseType.getIcon().add(navCaseIconType);
-
- FromActionType fromActionType = facesConfigFactory.createFromActionType();
- fromActionType.setTextContent("navigation-case-from-action");
- navCaseType.setFromAction(fromActionType);
-
- FromOutcomeType fromOutcomeType = facesConfigFactory.createFromOutcomeType();
- fromOutcomeType.setTextContent("navigation-case-from-outcome");
- navCaseType.setFromOutcome(fromOutcomeType);
-
- ToViewIdType toViewIdType = facesConfigFactory.createToViewIdType();
- toViewIdType.setTextContent("navigation-case-from-view-id");
- navCaseType.setToViewId(toViewIdType);
-
- newApplication.getNavigationCase().add(navCaseType);
-
- edit1.getFacesConfig().getNavigationRule().add(newApplication);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList names = rule.getDisplayName();
- for (int j=0; j<names.size(); j++) {
- DisplayNameType displayName = (DisplayNameType)names.get(j);
- result = displayName.getTextContent();
- assertEquals( dispNameOne ,result);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //icon
- String resultIcon=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList icons = rule.getIcon();
- for (int j=0; j<icons.size(); j++) {
- IconType iconName = (IconType)icons.get(j);
- resultIcon = iconName.getLargeIcon().getTextContent();
- assertEquals( "large-icon" ,resultIcon);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //fromViewId
- String resultFromViewId=null;
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- resultFromViewId = rule.getFromViewId().getTextContent();
- assertEquals( "from-view-id" ,resultFromViewId);
- break;
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- //NAVIGATION CASE REMAINING HERE!!!
- String navCaseResult=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- EList names = navCase.getDisplayName();
- for(int k=0; k<names.size();k++){
- DisplayNameType displayName = (DisplayNameType)names.get(k);
- navCaseResult = displayName.getTextContent();
- assertEquals( "navigation-case-display-name-of-file-one" ,navCaseResult);
- break;
- }
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //icon
- //"navigation-case-icon"
- String iconResult=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- EList icons = navCase.getIcon();
- for(int k=0; k<icons.size();k++){
- IconType icon = (IconType)icons.get(k);
- iconResult = icon.getLargeIcon().getTextContent();
- assertEquals("navigation-case-icon-file-one" ,iconResult);
- break;
- }
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
- //fromAction
- String fromActionResult=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- fromActionResult = navCase.getFromAction().getTextContent();
- assertEquals( "navigation-case-from-action" ,fromActionResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //fromOutcome
- String fromOutcomeResult=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- fromOutcomeResult = navCase.getFromOutcome().getTextContent();
- assertEquals( "navigation-case-from-outcome" ,fromOutcomeResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- //toViewId
- String toViewIdResult=null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList navRules = edit1.getFacesConfig().getNavigationRule();
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType rule = (NavigationRuleType) navRules.get(i);
- EList navCases = rule.getNavigationCase();
- for (int j=0; j<navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases.get(j);
- toViewIdResult = navCase.getToViewId().getTextContent();
- assertEquals( "navigation-case-from-view-id",toViewIdResult);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
-
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBean.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBean.java
deleted file mode 100644
index 5482cb0..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBean.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteReferencedBean extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteReferencedBean(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteReferencedBeanToFileTwo() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- String dispName = "display-name";
- String icon = "small-icon";
- String referenceBeanClass = "reference-bean-class";
- String referenceBeanName = "reference-bean-name";
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ReferencedBeanType newApplication = facesConfigFactory.createReferencedBeanType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(icon);
- iconType.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconType);
-
- ReferencedBeanNameType referencedBeanNameType = facesConfigFactory.createReferencedBeanNameType();
- referencedBeanNameType.setTextContent(referenceBeanName);
- newApplication.setReferencedBeanName(referencedBeanNameType);
-
- ReferencedBeanClassType referencedBeanClassType = facesConfigFactory.createReferencedBeanClassType();
- referencedBeanClassType.setTextContent(referenceBeanClass);
- newApplication.setReferencedBeanClass(referencedBeanClassType);
-
- edit.getFacesConfig().getReferencedBean().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- /*
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
- result = phaseListener.getValue();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }*/
- }
-
-
- public void testWriteReferencedBeanToFileOne() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit1 = null;
-
- String dispName = "display-name";
- String icon = "small-icon";
- String referenceBeanClass = "reference-bean-class";
- String referenceBeanName = "reference-bean-name";
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ReferencedBeanType newApplication = facesConfigFactory.createReferencedBeanType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(icon);
- iconType.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconType);
-
- ReferencedBeanNameType referencedBeanNameType = facesConfigFactory.createReferencedBeanNameType();
- referencedBeanNameType.setTextContent(referenceBeanName);
- newApplication.setReferencedBeanName(referencedBeanNameType);
-
- ReferencedBeanClassType referencedBeanClassType = facesConfigFactory.createReferencedBeanClassType();
- referencedBeanClassType.setTextContent(referenceBeanClass);
- newApplication.setReferencedBeanClass(referencedBeanClassType);
-
- edit1.getFacesConfig().getReferencedBean().add(newApplication);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- /*
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
- result = phaseListener.getValue();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }*/
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.java
deleted file mode 100644
index 733519f..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteReferencedBeanTwoFiles extends TestCase {
- IProject project = null;
- FacesConfigArtifactEdit edit1 = null;
- FacesConfigArtifactEdit edit2 = null;
- String desc = "description";
- String dispName = "display-name";
- String validatorId = "validator-id";
- String smallIcon = "small-icon";
- String referencedBeanClass = "reference-bean-class";
- String referencedBeanName = "reference-bean-name";
-
- public FacesConfigFactoryImplForWriteReferencedBeanTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteReferencedBean() {
- //IProject project = WizardUtil.getTestProject();
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ReferencedBeanType newApplication = facesConfigFactory.createReferencedBeanType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(smallIcon);
- iconType.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconType);
-
- ReferencedBeanNameType referencedBeanNameType = facesConfigFactory.createReferencedBeanNameType();
- referencedBeanNameType.setTextContent(referencedBeanName);
- newApplication.setReferencedBeanName(referencedBeanNameType);
-
- ReferencedBeanClassType referencedBeanClassType = facesConfigFactory.createReferencedBeanClassType();
- referencedBeanClassType.setTextContent(referencedBeanClass);
- newApplication.setReferencedBeanClass(referencedBeanClassType);
-
- edit2.getFacesConfig().getReferencedBean().add(newApplication);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- EList dispNames = referncedBean.getDisplayName();
- for (int j=0; j<dispNames.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)dispNames.get(j);
- result = phaseListener.getTextContent();
- System.out.println("display-name for reference-bean is " + result);
- assertEquals(dispName,result);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //icon
- String icon = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- EList icons = referncedBean.getIcon();
- for (int j = 0; j < icons.size(); j++) {
- IconType phaseListener = (IconType)icons.get(j);
- icon = phaseListener.getSmallIcon().getTextContent();
- System.out.println("small-icon for reference-bean is " + icon);
- assertEquals(smallIcon,icon);
- break;
- }
- }
- }
- } finally {
- //assertTrue(icon != null && icon.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //referenced-bean name
- String beanName = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- beanName = referncedBean.getReferencedBeanName().getTextContent();
- System.out.println("display-name for reference-bean is " + beanName);
- assertEquals(referencedBeanName,beanName);
- break;
- }
- }
- } finally {
- //assertTrue(referencedBeanName != null && referencedBeanName.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //referenced-bean class
-
- String beanClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referencedBean = (ReferencedBeanType) referencedBeans.get(i);
- beanClass = referencedBean.getReferencedBeanClass().getTextContent();
- System.out.println("display-name for reference-bean is " + beanClass);
- assertEquals(referencedBeanClass,beanClass);
- break;
- }
- }
- } finally {
- //assertTrue(referencedBeanClass != null && referencedBeanClass.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- }
-
- public void testWriteReferencedBeanFileTwo() {
- //IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ReferencedBeanType newApplication = facesConfigFactory.createReferencedBeanType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- SmallIconType smallIconType = facesConfigFactory.createSmallIconType();
- smallIconType.setTextContent(smallIcon);
- iconType.setSmallIcon(smallIconType);
- newApplication.getIcon().add(iconType);
-
- ReferencedBeanNameType referencedBeanNameType = facesConfigFactory.createReferencedBeanNameType();
- referencedBeanNameType.setTextContent(referencedBeanName);
- newApplication.setReferencedBeanName(referencedBeanNameType);
-
- ReferencedBeanClassType referencedBeanClassType = facesConfigFactory.createReferencedBeanClassType();
- referencedBeanClassType.setTextContent(referencedBeanClass);
- newApplication.setReferencedBeanClass(referencedBeanClassType);
-
- edit1.getFacesConfig().getReferencedBean().add(newApplication);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- EList dispNames = referncedBean.getDisplayName();
- for (int j=0; j<dispNames.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)dispNames.get(j);
- result = phaseListener.getTextContent();
- System.out.println("display-name for reference-bean is " + result);
- assertEquals(dispName,result);
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //icon
- String icon = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- EList icons = referncedBean.getIcon();
- for (int j=0; j<icons.size(); j++) {
- IconType phaseListener = (IconType)icons.get(j);
- icon = phaseListener.getSmallIcon().getTextContent();
- System.out.println("small-icon for reference-bean is " + icon);
- assertEquals(smallIcon,icon);
- break;
- }
- }
- }
- } finally {
- //assertTrue(icon != null && icon.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //referenced-bean name
- String beanName = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referncedBean = (ReferencedBeanType) referencedBeans.get(i);
- beanName = referncedBean.getReferencedBeanName().getTextContent();
- System.out.println("display-name for reference-bean is " + beanName);
- assertEquals(referencedBeanName,beanName);
- break;
- }
- }
- } finally {
- //assertTrue(referencedBeanName != null && referencedBeanName.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- //referenced-bean class
- String beanClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit2.getFacesConfig() != null) {
- EList referencedBeans = edit2.getFacesConfig().getReferencedBean();
- for (int i = 0; i < referencedBeans.size(); i++) {
- ReferencedBeanType referencedBean = (ReferencedBeanType) referencedBeans.get(i);
- beanClass = referencedBean.getReferencedBeanClass().getTextContent();
- System.out.println("display-name for reference-bean is " + beanClass);
- assertEquals(referencedBeanClass,beanClass);
- break;
- }
- }
- } finally {
- //assertTrue(referencedBeanClass != null && referencedBeanClass.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKit.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKit.java
deleted file mode 100644
index d7025ae..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKit.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentFamilyType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererTypeType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-public class FacesConfigFactoryImplForWriteRenderKit extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteRenderKit(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteRenderKit() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- String dispName = "display-name";
- String icon = "large-icon";
- String renderKitId = "render-kit-id";
- String renderKitClass = "render-kit-class";
- String rendererFamily = "component-family";
- String rendererClass = "renderer-class";
- String rendererType = "renderer-type";
- //String rendererExtension = "renderer-extension";
- String rendDispName="renderer-display-name";
- String rendIcon = "renderer-icon";
-
- //Attribute related variables
- String attrDispName="attribute-display-name";
- String attrIcon = "attribute-icon";
-
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- RenderKitType newApplication = facesConfigFactory.createRenderKitType();
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType= facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent(icon);
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- RenderKitIdType renderKitIdType = facesConfigFactory.createRenderKitIdType();
- renderKitIdType.setTextContent(renderKitId);
- newApplication.setRenderKitId(renderKitIdType);
-
- RenderKitClassType renderKitClassType = facesConfigFactory.createRenderKitClassType();
- renderKitClassType.setTextContent(renderKitClass);
- newApplication.setRenderKitClass(renderKitClassType);
-
- RendererType rendererT = facesConfigFactory.createRendererType();
-
- DisplayNameType renDispName= facesConfigFactory.createDisplayNameType();
- renDispName.setTextContent(rendDispName);
- rendererT.getDisplayName().add(renDispName);
-
- IconType rendIconType= facesConfigFactory.createIconType();
- LargeIconType rendLargeIconType = facesConfigFactory.createLargeIconType();
- rendLargeIconType.setTextContent(rendIcon);
- rendIconType.setLargeIcon(rendLargeIconType);
- rendererT.getIcon().add(rendIconType);
-
- ComponentFamilyType componentFamilyType = facesConfigFactory.createComponentFamilyType();
- componentFamilyType.setTextContent(rendererFamily);
- rendererT.setComponentFamily(componentFamilyType);
-
- RendererTypeType rendererTypeType = facesConfigFactory.createRendererTypeType();
- rendererTypeType.setTextContent(rendererType);
- rendererT.setRendererType(rendererTypeType);
-
- RendererClassType rendererClassType = facesConfigFactory.createRendererClassType();
- rendererClassType.setTextContent(rendererClass);
- rendererT.setRendererClass(rendererClassType);
-
- //NEED TO COME BACK TO THIS PORTION SOMETIME SOON
- //RendererExtensionType rendererextType = facesConfigFactory.createRendererExtensionType();
- //rendererextType.
- //rendererT.getRendererExtension().add(rendererExtension);
-
-
-
- AttributeType attrType = facesConfigFactory.createAttributeType();
-
- DisplayNameType attributeDispName= facesConfigFactory.createDisplayNameType();
- attributeDispName.setTextContent(attrDispName);
- attrType.getDisplayName().add(attributeDispName);
-
- IconType attrIconType= facesConfigFactory.createIconType();
- LargeIconType attrLargeIconType = facesConfigFactory.createLargeIconType();
- attrLargeIconType.setTextContent(attrIcon);
- attrIconType.setLargeIcon(attrLargeIconType);
- attrType.getIcon().add(attrIconType);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("attribute-defaulat-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("attribute-suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- //Check if this is actually correct!!!
- /* AttributeExtensionType attrExtType = facesConfigFactory.createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- */
-
- rendererT.getAttribute().add(attrType);
- //rendererT.getRendererExtension().add(rendererExtension);
- newApplication.getRenderer().add(rendererT);
-
- edit.getFacesConfig().getRenderKit().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- /*
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j=0; j<phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType)phaseListeners.get(j);
- result = phaseListener.getValue();
- break;
- }
- }
- }
- } finally {
- //assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }*/
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKitTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKitTwoFiles.java
deleted file mode 100644
index 4c4cbfa..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKitTwoFiles.java
+++ /dev/null
@@ -1,1171 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.ComponentFamilyType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
-import org.eclipse.jst.jsf.facesconfig.emf.RendererTypeType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteRenderKitTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit = null;
-
- FacesConfigArtifactEdit edit1 = null;
- String desc = "description";
- String dispName = "display-name";
- String icon = "large-icon";
- String renderKitId = "render-kit-id";
- String renderKitClass = "render-kit-class";
- String rendererFamily = "component-family";
- String rendererClass = "renderer-class";
- String rendererType = "renderer-type";
- String rendererExtension = "renderer-extension";
- String rendererIcon = "renderer-icon";
- String rendDispName = "renderer-display-name";
- String rendIcon = "renderer-icon";
- // Attribute related variables
- String attrDispName = "attribute-display-name";
- String attrIcon = "attribute-icon";
-
- public FacesConfigFactoryImplForWriteRenderKitTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteRenderKit() {
-
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
-
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- RenderKitType newApplication = facesConfigFactory
- .createRenderKitType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType = facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent(icon);
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- RenderKitIdType renderKitIdType = facesConfigFactory.createRenderKitIdType();
- renderKitIdType.setTextContent(renderKitId);
- newApplication.setRenderKitId(renderKitIdType);
-
- RenderKitClassType renderKitClassType = facesConfigFactory.createRenderKitClassType();
- renderKitClassType.setTextContent(renderKitClass);
- newApplication.setRenderKitClass(renderKitClassType);
-
- RendererType rendererT = facesConfigFactory
- .createRendererType();
-
- DisplayNameType renDispName = facesConfigFactory
- .createDisplayNameType();
- renDispName.setTextContent(rendDispName);
- rendererT.getDisplayName().add(renDispName);
-
- IconType rendIconType = facesConfigFactory.createIconType();
- LargeIconType rendLargeIconType = facesConfigFactory.createLargeIconType();
- rendLargeIconType.setTextContent(rendIcon);
- rendIconType.setLargeIcon(rendLargeIconType);
- rendererT.getIcon().add(rendIconType);
-
- ComponentFamilyType componentFamilyType = facesConfigFactory.createComponentFamilyType();
- componentFamilyType.setTextContent(rendererFamily);
- rendererT.setComponentFamily(componentFamilyType);
-
- RendererTypeType rendererTypeType = facesConfigFactory.createRendererTypeType();
- rendererTypeType.setTextContent(rendererType);
- rendererT.setRendererType(rendererTypeType);
-
- RendererClassType rendererClassType = facesConfigFactory.createRendererClassType();
- rendererClassType.setTextContent(rendererClass);
- rendererT.setRendererClass(rendererClassType);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDispName = facesConfigFactory
- .createDisplayNameType();
- attributeDispName.setTextContent(attrDispName);
- attrType.getDisplayName().add(attributeDispName);
-
- IconType attrIconType = facesConfigFactory.createIconType();
- LargeIconType attrLargeIconType = facesConfigFactory.createLargeIconType();
- attrLargeIconType.setTextContent(attrIcon);
- attrIconType.setLargeIcon(attrLargeIconType);
- attrType.getIcon().add(attrIconType);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("attribute-defaulat-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("attribute-suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- rendererT.getAttribute().add(attrType);
- newApplication.getRenderer().add(rendererT);
-
- edit.getFacesConfig().getRenderKit().add(newApplication);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
-
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList names = renderer.getDisplayName();
- for (int j = 0; j < names.size(); j++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(j);
- result = displayName.getTextContent();
- assertEquals(dispName, result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- // icon
- String resultIcon = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList icons = renderer.getIcon();
- for (int j = 0; j < icons.size(); j++) {
- IconType displayName = (IconType) icons.get(j);
- resultIcon = displayName.getLargeIcon().getTextContent();
- assertEquals(icon, resultIcon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // render-kit-id
- String resultRenderKitId = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- resultRenderKitId = renderer.getRenderKitId().getTextContent();
- assertEquals(renderKitId, resultRenderKitId);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // renderKitClass
-
- // render-kit-id
- String resultrenderKitClass = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- resultrenderKitClass = renderer.getRenderKitClass().getTextContent();
- assertEquals(renderKitClass, resultrenderKitClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // RENDERER PART
- String rendererResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList names = rendererType1.getDisplayName();
- for (int k = 0; k < names.size(); k++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(k);
- rendererResult = displayName.getTextContent();
- assertEquals(rendDispName,
- rendererResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- // Renderer - icon
- String rendererIconResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList icons = rendererType1.getIcon();
- for (int k = 0; k < icons.size(); k++) {
- IconType icon1 = (IconType) icons.get(k);
- rendererIconResult = icon1.getLargeIcon().getTextContent();
- assertEquals(rendIcon, rendererIconResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // renderer--componentFmaily
- String rendererComponentFmaily = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererComponentFmaily = rendererType1.getComponentFamily().getTextContent();
- assertEquals(rendererFamily, rendererComponentFmaily);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // renderer-rendererType
- String rendererTyp = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererTyp = rendererType1.getRendererType().getTextContent();
- assertEquals("renderer-type", rendererTyp);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // renderer-rendererClass
- String rendererClassResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererClassResult = rendererType1.getRendererClass().getTextContent();
- assertEquals(rendererClass, rendererClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // THE FOLLOWING DEALS WITH RenderKit-->Renderer-->Attribute
- // display name
- String displayNameResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- EList names = attTyp.getDisplayName();
- for (int z = 0; z < names.size(); z++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(k);
- displayNameResult = displayName.getTextContent();
- assertEquals(attrDispName, displayNameResult);
- break;
- }
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // icon
- String iconResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- EList icons = attTyp.getIcon();
- for (int z = 0; z < icons.size(); z++) {
- IconType icon1 = (IconType) icons.get(k);
- iconResult = icon1.getLargeIcon().getTextContent();
- assertEquals(attrIcon, iconResult);
- break;
- }
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // attributeNaame
- String attributeNameResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- attributeNameResult = attTyp.getAttributeName().getTextContent();
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- attributeClassResult = attTyp.getAttributeClass().getTextContent();
- assertEquals("attribute-class",
- attributeClassResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // defaultValue
- String defaultValueResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- defaultValueResult = attTyp.getDefaultValue().getTextContent();
- assertEquals("attribute-defaulat-value",
- defaultValueResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- // suggestedValue
- String suggestedValueResult = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList RendereKitList = edit.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- suggestedValueResult = attTyp.getSuggestedValue().getTextContent();
- assertEquals("attribute-suggested-value",
- suggestedValueResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
-
- }
-
- public void testWriteRenderKitToFileOne() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- RenderKitType newApplication = facesConfigFactory
- .createRenderKitType();
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- newApplication.getDisplayName().add(actionList);
-
- IconType iconType = facesConfigFactory.createIconType();
- LargeIconType largeIconType = facesConfigFactory.createLargeIconType();
- largeIconType.setTextContent(icon);
- iconType.setLargeIcon(largeIconType);
- newApplication.getIcon().add(iconType);
-
- RenderKitIdType renderKitIdType = facesConfigFactory.createRenderKitIdType();
- renderKitIdType.setTextContent(renderKitId);
- newApplication.setRenderKitId(renderKitIdType);
-
- RenderKitClassType renderKitClassType = facesConfigFactory.createRenderKitClassType();
- renderKitClassType.setTextContent(renderKitClass);
- newApplication.setRenderKitClass(renderKitClassType);
-
- RendererType rendererT = facesConfigFactory
- .createRendererType();
-
- DisplayNameType renDispName = facesConfigFactory
- .createDisplayNameType();
- renDispName.setTextContent(rendDispName);
- rendererT.getDisplayName().add(renDispName);
-
- IconType rendIconType = facesConfigFactory.createIconType();
- LargeIconType rendLargeIconType = facesConfigFactory.createLargeIconType();
- rendLargeIconType.setTextContent(rendIcon);
- rendIconType.setLargeIcon(rendLargeIconType);
- rendererT.getIcon().add(rendIconType);
-
- ComponentFamilyType componentFamilyType = facesConfigFactory.createComponentFamilyType();
- componentFamilyType.setTextContent(rendererFamily);
- rendererT.setComponentFamily(componentFamilyType);
-
- RendererTypeType rendererTypeType = facesConfigFactory.createRendererTypeType();
- rendererTypeType.setTextContent(rendererType);
- rendererT.setRendererType(rendererTypeType);
-
- RendererClassType rendererClassType = facesConfigFactory.createRendererClassType();
- rendererClassType.setTextContent(rendererClass);
- rendererT.setRendererClass(rendererClassType);
-
- // The following item is not done since it takes
- // any type and getting a specific type is not possible.
- // RendererExtensionType
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDispName = facesConfigFactory
- .createDisplayNameType();
- attributeDispName.setTextContent(dispName);
- attrType.getDisplayName().add(attributeDispName);
-
- IconType attrIconType = facesConfigFactory.createIconType();
- LargeIconType attrLargeIconType = facesConfigFactory.createLargeIconType();
- attrLargeIconType.setTextContent(attrIcon);
- attrIconType.setLargeIcon(attrLargeIconType);
- attrType.getIcon().add(attrIconType);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("attribute-defaulat-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("attribute-suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- rendererT.getAttribute().add(attrType);
- // rendererT.getRendererExtension().add(rendererExtension);
- newApplication.getRenderer().add(rendererT);
-
- edit1.getFacesConfig().getRenderKit().add(newApplication);
- edit1.save(null);
-
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList names = renderer.getDisplayName();
- for (int j = 0; j < names.size(); j++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(j);
- result = displayName.getTextContent();
- assertEquals(dispName, result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- // icon
- String resultIcon = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList icons = renderer.getIcon();
- for (int j = 0; j < icons.size(); j++) {
- IconType displayName = (IconType) icons.get(j);
- resultIcon = displayName.getLargeIcon().getTextContent();
- assertEquals(icon, resultIcon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // render-kit-id
- String resultRenderKitId = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- resultRenderKitId = renderer.getRenderKitId().getTextContent();
- assertEquals(renderKitId, resultRenderKitId);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // renderKitClass
-
- // render-kit-id
- String resultrenderKitClass = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- resultrenderKitClass = renderer.getRenderKitClass().getTextContent();
- assertEquals(renderKitClass, resultrenderKitClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // RENDERER PART
- String rendererResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList names = rendererType1.getDisplayName();
- for (int k = 0; k < names.size(); k++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(k);
- rendererResult = displayName.getTextContent();
- assertEquals("renderer-display-name",
- rendererResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- // Renderer - icon
- String rendererIconResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList icons = rendererType1.getIcon();
- for (int k = 0; k < icons.size(); k++) {
- IconType icon1 = (IconType) icons.get(k);
- rendererIconResult = icon1.getLargeIcon().getTextContent();
- assertEquals(rendIcon, rendererIconResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // renderer--componentFmaily
- String rendererComponentFmaily = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererComponentFmaily = rendererType1.getComponentFamily().getTextContent();
- assertEquals(rendererFamily, rendererComponentFmaily);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // renderer-rendererType
- String rendererTyp = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererTyp = rendererType1.getRendererType().getTextContent();
- assertEquals("renderer-type", rendererTyp);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // renderer-rendererClass
- String rendererClassResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- rendererClassResult = rendererType1.getRendererClass().getTextContent();
- assertEquals(rendererClass, rendererClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // THE FOLLOWING DEALS WITH RenderKit-->Renderer-->Attribute
- // display name
- String displayNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- EList names = attTyp.getDisplayName();
- for (int z = 0; z < names.size(); z++) {
- DisplayNameType displayName = (DisplayNameType) names
- .get(k);
- displayNameResult = displayName.getTextContent();
- assertEquals(dispName, displayNameResult);
- break;
- }
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // icon
- String iconResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- EList icons = attTyp.getIcon();
- for (int z = 0; z < icons.size(); z++) {
- IconType icon1 = (IconType) icons.get(k);
- iconResult = icon1.getLargeIcon().getTextContent();
- assertEquals(attrIcon, iconResult);
- break;
- }
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // attributeNaame
- String attributeNameResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- attributeNameResult = attTyp.getAttributeName().getTextContent();
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- attributeClassResult = attTyp.getAttributeClass().getTextContent();
- assertEquals("attribute-class",
- attributeClassResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // defaultValue
- String defaultValueResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- defaultValueResult = attTyp.getDefaultValue().getTextContent();
- assertEquals("attribute-defaulat-value",
- defaultValueResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- // suggestedValue
- String suggestedValueResult = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList RendereKitList = edit1.getFacesConfig().getRenderKit();
- for (int i = 0; i < RendereKitList.size(); i++) {
- RenderKitType renderer = (RenderKitType) RendereKitList
- .get(i);
- EList rendererList = renderer.getRenderer();
- for (int j = 0; j < rendererList.size(); j++) {
- RendererType rendererType1 = (RendererType) rendererList
- .get(j);
- EList attribute = rendererType1.getAttribute();
- for (int k = 0; k < attribute.size(); k++) {
- AttributeType attTyp = (AttributeType) attribute
- .get(k);
- suggestedValueResult = attTyp.getSuggestedValue().getTextContent();
- assertEquals("attribute-suggested-value",
- suggestedValueResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
-
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidator.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidator.java
deleted file mode 100644
index c88bfa1..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidator.java
+++ /dev/null
@@ -1,537 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeExtensionType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteValidator extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplForWriteValidator(String name) {
- super(name);
- }
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteValidator() {
- //IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit2 = null;
-
- //String desc = "description";
- String dispName = "display-name";
- String attributeDispName = "attribute-display-name";
- String attributeIcon ="attribute-icon";
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
-
- ValidatorType newValidator = facesConfigFactory.createValidatorType();
-
- ValidatorIdType validatorIdType = facesConfigFactory.createValidatorIdType();
- validatorIdType.setTextContent("validator-id");
- newValidator.setValidatorId(validatorIdType);
-
- ValidatorClassType validatorClassType = facesConfigFactory.createValidatorClassType();
- validatorClassType.setTextContent("validator-class");
- newValidator.setValidatorClass(validatorClassType);
-
- DisplayNameType actionList= facesConfigFactory.createDisplayNameType();
- actionList.setTextContent(dispName);
- newValidator.getDisplayName().add(actionList);
-
-
- AttributeType attrType = facesConfigFactory.createAttributeType();
-
- DisplayNameType attributeDisplayName= facesConfigFactory.createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon= facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- //ATTRIBUTE EXTENISON REMAIND HERE
- // There is a problem with extension. Here is a good place to see that.
- //AttributeExtensionType attrExtType = facesConfigFactory.createAttributeExtensionType();
-
- AttributeExtensionType attrExtType = facesConfigFactory.createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- newValidator.getAttribute().add(attrType);
-
- newValidator.getAttribute().add(attrType);
-
- //need to add Propety here PropertyType
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name-validation-file-two");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class-validation-file-two");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propertyDefaultValueType = facesConfigFactory.createDefaultValueType();
- propertyDefaultValueType.setTextContent("property-default-value-validation-file-two");
- propType.setDefaultValue(propertyDefaultValueType);
-
- newValidator.getProperty().add(propType);
-
- edit2.getFacesConfig().getValidator().add(newValidator);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList lifecycles = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- result = phaseListener.getTextContent();
- System.out.println("display name for file 2 is : "
- + result);
- assertEquals(dispName, result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String resultIcon = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList icons = validator.getIcon();
- for (int j = 0; j < icons.size(); j++) {
- IconType icon = (IconType) icons.get(j);
- resultIcon = icon.getLargeIcon().getTextContent();
- assertEquals(attributeIcon, resultIcon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // render-kit-id
- String resultValidatorId = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- resultValidatorId = validator.getValidatorId().getTextContent();
- assertEquals("validator-id", resultValidatorId);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // renderKitClass
-
- // render-kit-id
- String resultValidatorClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- resultValidatorClass = validator.getValidatorClass().getTextContent();
- assertEquals("validator-class", resultValidatorClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
-
- // ATTRIBUTE PART OF VALIDATOR.
- //attributeDisplayName
- String displayNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList displayNameList = attType.getDisplayName();
- for (int k = 0; k < displayNameList.size(); k++) {
- DisplayNameType dispType = (DisplayNameType) displayNameList
- .get(j);
- displayNameResult = dispType.getTextContent();
- System.out
- .println("attribute display name for file 2 of validator is : "
- + displayNameResult);
- assertEquals(attributeDispName, displayNameResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // ATTRIBUTE PART OF VALIDATOR.
- // attribute-name
- String attributeNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeNameResult = attType.getAttributeName().getTextContent();
- System.out
- .println("**** attribute name for file 2 of validator is : "
- + attributeNameResult);
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //attributeIcon
- String attributeIconResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList iconList = attType.getIcon();
- for (int k = 0; k < iconList.size(); k++) {
- IconType iconType = (IconType) iconList
- .get(j);
- attributeIconResult = iconType.getSmallIcon().getTextContent();
- System.out
- .println("attribute icon name for file 2 of validator is : "
- + attributeIconResult);
- assertEquals(attributeIcon, attributeIconResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeClassResult = attType.getAttributeClass().getTextContent();
- System.out
- .println("attribute classe for file 2 of validator is : "
- + attributeClassResult);
- assertEquals("attribute-class", attributeClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeValue
- String attributeValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("attribute default value for file 2 of validator is : "
- + attributeValueResult);
- assertEquals("default-value", attributeValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //suggestedValue
- String suggestedValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- suggestedValueResult = attType.getSuggestedValue().getTextContent();
- System.out
- .println("attribute suggested value for file 2 of validator is : "
- + suggestedValueResult);
- assertEquals("suggested-value", suggestedValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- /*
- *
- * PropertyType propType = facesConfigFactory.createPropertyType();
- propType.setPropertyName("property-name-validation-file-two");
- propType.setPropertyClass("property-class-validation-file-two");
- propType.setDefaultValue("property-default-value-validation-file-two");
-
- newValidator.getProperty().add(propType);
- */
- //PROPERTY PART
- String propertyNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyNameResult = attType.getPropertyName().getTextContent();
- System.out
- .println("propetry name for file 2 of validator is : "
- + propertyNameResult);
- assertEquals("property-name-validation-file-two", propertyNameResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String propertyClassResult=null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyClassResult = attType.getPropertyClass().getTextContent();
- System.out
- .println("propetry class for file 2 of validator is : "
- + propertyClassResult);
- assertEquals("property-class-validation-file-two", propertyClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- String propertyDefaultValueResult=null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyDefaultValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("propetry default value for file 2 of validator is : "
- + propertyDefaultValueResult);
- assertEquals("property-default-value-validation-file-two", propertyDefaultValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- }
-
-}
-
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidatorTwoFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidatorTwoFiles.java
deleted file mode 100644
index 3d8b519..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidatorTwoFiles.java
+++ /dev/null
@@ -1,652 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeExtensionType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
-import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.IconType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
-import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
-import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
-import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorIdType;
-import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-public class FacesConfigFactoryImplForWriteValidatorTwoFiles extends TestCase {
- IProject project = null;
-
- FacesConfigArtifactEdit edit1 = null;
-
- FacesConfigArtifactEdit edit2 = null;
-
- // String desc = "description";
- String dispName = "display-name";
-
- String dispNameOne = "display-name";
-
- String attributeDispName = "attribute-display-name";
-
- String attributeIcon = "attribute-icon";
-
- public FacesConfigFactoryImplForWriteValidatorTwoFiles(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- public void testWriteValidatorToFileTwo() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ValidatorType newValidator = facesConfigFactory
- .createValidatorType();
-
- ValidatorIdType validatorIdType = facesConfigFactory.createValidatorIdType();
- validatorIdType.setTextContent("validator-id");
- newValidator.setValidatorId(validatorIdType);
-
- ValidatorClassType validatorClassType = facesConfigFactory.createValidatorClassType();
- validatorClassType.setTextContent("validator-class");
- newValidator.setValidatorClass(validatorClassType);
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispName);
- newValidator.getDisplayName().add(actionList);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- // ATTRIBUTE EXTENISON REMAIND HERE
- // There is a problem with extension. Here is a good place to
- // see that.
- // AttributeExtensionType attrExtType =
- // facesConfigFactory.createAttributeExtensionType();
-
- AttributeExtensionType attrExtType = facesConfigFactory
- .createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- newValidator.getAttribute().add(attrType);
-
- newValidator.getAttribute().add(attrType);
-
- //adding property
- PropertyType propType = facesConfigFactory.createPropertyType();
-
- PropertyNameType propertyNameType = facesConfigFactory.createPropertyNameType();
- propertyNameType.setTextContent("property-name-validation-file-two");
- propType.setPropertyName(propertyNameType);
-
- PropertyClassType propertyClassType = facesConfigFactory.createPropertyClassType();
- propertyClassType.setTextContent("property-class-validation-file-two");
- propType.setPropertyClass(propertyClassType);
-
- DefaultValueType propertyDefaultValueType = facesConfigFactory.createDefaultValueType();
- propertyDefaultValueType.setTextContent("property-default-value-validation-file-two");
- propType.setDefaultValue(propertyDefaultValueType);
-
- newValidator.getProperty().add(propType);
-
- edit2.getFacesConfig().getValidator().add(newValidator);
- edit2.save(null);
- }
- } finally {
- if (edit2 != null) {
- edit2.dispose();
- }
- }
- String result = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList lifecycles = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- result = phaseListener.getTextContent();
- System.out.println("display name for file 2 is : "
- + result);
- assertEquals(dispName, result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String resultIcon = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList icons = validator.getIcon();
- for (int j = 0; j < icons.size(); j++) {
- IconType icon = (IconType) icons.get(j);
- resultIcon = icon.getLargeIcon().getTextContent();
- assertEquals(attributeIcon, resultIcon);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // render-kit-id
- String resultValidatorId = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- resultValidatorId = validator.getValidatorId().getTextContent();
- assertEquals("validator-id", resultValidatorId);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // renderKitClass
-
- // render-kit-id
- String resultValidatorClass = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- resultValidatorClass = validator.getValidatorClass().getTextContent();
- assertEquals("validator-class", resultValidatorClass);
- break;
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
-
- // ATTRIBUTE PART OF VALIDATOR.
- //attributeDisplayName
- String displayNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList displayNameList = attType.getDisplayName();
- for (int k = 0; k < displayNameList.size(); k++) {
- DisplayNameType dispType = (DisplayNameType) displayNameList
- .get(j);
- displayNameResult = dispType.getTextContent();
- System.out
- .println("attribute display name for file 2 of validator is : "
- + displayNameResult);
- assertEquals(attributeDispName, displayNameResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // ATTRIBUTE PART OF VALIDATOR.
- // attribute-name
- String attributeNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeNameResult = attType.getAttributeName().getTextContent();
- System.out
- .println("**** attribute name for file 2 of validator is : "
- + attributeNameResult);
- assertEquals("attribute-name", attributeNameResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //attributeIcon
- String attributeIconResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- EList iconList = attType.getIcon();
- for (int k = 0; k < iconList.size(); k++) {
- IconType iconType = (IconType) iconList
- .get(j);
- attributeIconResult = iconType.getSmallIcon().getTextContent();
- System.out
- .println("attribute icon name for file 2 of validator is : "
- + attributeIconResult);
- assertEquals(attributeIcon, attributeIconResult);
- break;
- }
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeClass
- String attributeClassResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeClassResult = attType.getAttributeClass().getTextContent();
- System.out
- .println("attribute classe for file 2 of validator is : "
- + attributeClassResult);
- assertEquals("attribute-class", attributeClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- // attributeValue
- String attributeValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- attributeValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("attribute default value for file 2 of validator is : "
- + attributeValueResult);
- assertEquals("default-value", attributeValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- //suggestedValue
- String suggestedValueResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getAttribute();
- for (int j = 0; j < attributeList.size(); j++) {
- AttributeType attType = (AttributeType) attributeList
- .get(j);
- suggestedValueResult = attType.getSuggestedValue().getTextContent();
- System.out
- .println("attribute suggested value for file 2 of validator is : "
- + suggestedValueResult);
- assertEquals("suggested-value", suggestedValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- /*
- *
- * PropertyType propType = facesConfigFactory.createPropertyType();
- propType.setPropertyName("property-name-validation-file-two");
- propType.setPropertyClass("property-class-validation-file-two");
- propType.setDefaultValue("property-default-value-validation-file-two");
-
- newValidator.getProperty().add(propType);
- */
- //PROPERTY PART
- String propertyNameResult = null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyNameResult = attType.getPropertyName().getTextContent();
- System.out
- .println("propetry name for file 2 of validator is : "
- + propertyNameResult);
- assertEquals("property-name-validation-file-two", propertyNameResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- String propertyClassResult=null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyClassResult = attType.getPropertyClass().getTextContent();
- System.out
- .println("propetry class for file 2 of validator is : "
- + propertyClassResult);
- assertEquals("property-class-validation-file-two", propertyClassResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
-
- String propertyDefaultValueResult=null;
- try {
- edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit2.getFacesConfig() != null) {
- EList validatorList = edit2.getFacesConfig().getValidator();
- for (int i = 0; i < validatorList.size(); i++) {
- ValidatorType validator = (ValidatorType) validatorList
- .get(i);
- EList attributeList = validator.getProperty();
- for (int j = 0; j < attributeList.size(); j++) {
- PropertyType attType = (PropertyType) attributeList
- .get(j);
- propertyDefaultValueResult = attType.getDefaultValue().getTextContent();
- System.out
- .println("propetry default value for file 2 of validator is : "
- + propertyDefaultValueResult);
- assertEquals("property-default-value-validation-file-two", propertyDefaultValueResult);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit2 != null) {
- edit2.dispose();
- }
- }
-
- }
-
- public void testWriteValidatorToFileOne() {
- // IProject project = WizardUtil.getTestProject();
-
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage
- .getFacesConfigFactory();
-
- ValidatorType newValidator = facesConfigFactory
- .createValidatorType();
-
- ValidatorIdType validatorIdType = facesConfigFactory.createValidatorIdType();
- validatorIdType.setTextContent("validator-id");
- newValidator.setValidatorId(validatorIdType);
-
- ValidatorClassType validatorClassType = facesConfigFactory.createValidatorClassType();
- validatorClassType.setTextContent("validator-class");
- newValidator.setValidatorClass(validatorClassType);
-
- DisplayNameType actionList = facesConfigFactory
- .createDisplayNameType();
- actionList.setTextContent(dispNameOne);
- newValidator.getDisplayName().add(actionList);
-
- AttributeType attrType = facesConfigFactory
- .createAttributeType();
-
- DisplayNameType attributeDisplayName = facesConfigFactory
- .createDisplayNameType();
- attributeDisplayName.setTextContent(attributeDispName);
- attrType.getDisplayName().add(attributeDisplayName);
-
- IconType attributeDIcon = facesConfigFactory.createIconType();
- SmallIconType attributeDSmallIcon = facesConfigFactory.createSmallIconType();
- attributeDSmallIcon.setTextContent(attributeIcon);
- attributeDIcon.setSmallIcon(attributeDSmallIcon);
- attrType.getIcon().add(attributeDIcon);
-
- AttributeNameType attributeNameType = facesConfigFactory.createAttributeNameType();
- attributeNameType.setTextContent("attribute-name");
- attrType.setAttributeName(attributeNameType);
-
- AttributeClassType attributeClassType = facesConfigFactory.createAttributeClassType();
- attributeClassType.setTextContent("attribute-class");
- attrType.setAttributeClass(attributeClassType);
-
- DefaultValueType defaultValueType = facesConfigFactory.createDefaultValueType();
- defaultValueType.setTextContent("default-value");
- attrType.setDefaultValue(defaultValueType);
-
- SuggestedValueType suggestedValueType = facesConfigFactory.createSuggestedValueType();
- suggestedValueType.setTextContent("suggested-value");
- attrType.setSuggestedValue(suggestedValueType);
-
- AttributeExtensionType attrExtType = facesConfigFactory
- .createAttributeExtensionType();
- attrType.getAttributeExtension().add(attrExtType);
- newValidator.getAttribute().add(attrType);
-
- newValidator.getAttribute().add(attrType);
-
- edit1.getFacesConfig().getValidator().add(newValidator);
- edit1.save(null);
- }
- } finally {
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- String result = null;
- try {
- edit1 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit1.getFacesConfig() != null) {
- EList lifecycles = edit1.getFacesConfig().getValidator();
- for (int i = 0; i < lifecycles.size(); i++) {
- ValidatorType lifecycle = (ValidatorType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getDisplayName();
- for (int j = 0; j < phaseListeners.size(); j++) {
- DisplayNameType phaseListener = (DisplayNameType) phaseListeners
- .get(j);
- result = phaseListener.getTextContent();
- System.out.println("display-name for file one is: "
- + result);
- assertEquals(dispNameOne, result);
- break;
- }
- }
- }
- } finally {
- // assertTrue(result != null && result.equals(sTestString));
- if (edit1 != null) {
- edit1.dispose();
- }
- }
- }
-
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplTestForRead.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplTestForRead.java
deleted file mode 100644
index 2a31fbc..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplTestForRead.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
-import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- *
- */
-public class FacesConfigFactoryImplTestForRead extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryImplTestForRead(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- project = WizardUtil.getTestProject(getName());
- }
-
- /*
- * The following method is used to test for the empty navigation rule. Since
- * I am supplying a single faces-config.xml file as a testing file, I had to
- * testcases fit in to it by controlling the conditions
- *
- */
- public void testEmptyNavigationRule() {
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(!navRules.isEmpty());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testSingleNavigationsRule() {
- // testSingleNavigationsRule
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
- assertTrue(navRules.size() != 0);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- public void testMultipleNavigationRules() {
- // assertTrue(...);
-
- // IProject project = WizardUtil.getTestProject();
- FacesConfigArtifactEdit edit = null;
-
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList navRules = edit.getFacesConfig().getNavigationRule();
-
- // assertEquals(1, navRules.size());
- System.out.println("navRules size " + navRules.size());
- // for (int num=0; num<4; num++) {
- // Sort the items
- for (int i = 0; i < navRules.size(); i++) {
- NavigationRuleType navRule = (NavigationRuleType) navRules
- .get(i);
-
- String navRulesDisName = navRule.getDisplayName()
- .toString();
- System.out.println("navRule names " + navRulesDisName);
-
- //String sFromTreeId = navRule.getFromViewId();
- // assertEquals("/Page1.jsp",sFromTreeId);
- EList navCases = navRule.getNavigationCase();
-
- // sassertEquals(2,navCases.size());
- System.out.println(" navCases size " + navCases.size());
- for (int j = 0; j < navCases.size(); j++) {
- NavigationCaseType navCase = (NavigationCaseType) navCases
- .get(j);
-
- EList caseNames = navCase.getDisplayName();
- System.out.println("CLASS = " + caseNames.getClass());
-
- String sOutcome = navCase.getFromOutcome().getTextContent();
- System.out.println(" sOutcome " + sOutcome);
- String sActionRef = navCase.getFromAction().getTextContent();
- System.out.println(" sActionRef " + sActionRef);
- String sToPage = navCase.getToViewId().getTextContent();
- System.out.println(" sOutcome " + sToPage);
- }
- // }
-
- }
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryTest.java
deleted file mode 100644
index 98475eb..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-
-/*
-* This Junit class is used to test the FacesConfigFactoryImpl
-* class.
-*
-*/
-public class FacesConfigFactoryTest extends TestCase {
- IProject project = null;
-
- public FacesConfigFactoryTest(String name) {
- super(name);
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- project = WizardUtil.getTestProject(getName());
- }
-
- public static Test suite() {
- return new TestSuite(FacesConfigFactoryTest.class);
- }
-
- /*
- * Test the applicaion element of faces-config.xml
- *
- */
- public void testEmptyFactory() {
-
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory = edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty() && factory.size() == 1);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Test the application-factory element of Factory in faces-config.xml
- *
- */
- public void testApplicationFactory() {
-
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList appFactory = edit.getFacesConfig().getFactory();
- FactoryType factoryType = (FactoryType)appFactory.get(0);
- assertTrue(!factoryType.equals(null));
- System.out.println("application Factory class : " + factoryType.getClass());
- assertEquals("class org.eclipse.jst.jsf.facesconfig.emf.impl.FactoryTypeImpl",
- factoryType.getClass().toString());
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
- /*
- * Test the faces-context-factory element of Factory in faces-config.xml
- * PROBLEM PROBLEM I DO NOT KNOW WHY
- */
- public void testFacesContextFactory() {
-
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- //EList appFactory = edit.getFacesConfig().getFactory();
- // NOT DOING AS OF HERE SO COMEBACK AND SO SOME ASSERTS.
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
- /*
- * Test the application-factory element of Factory in faces-config.xml
- *
- */
- public void testLifeCycleFactory() {
-
- FacesConfigArtifactEdit edit = null;
- try {
- edit = FacesConfigArtifactEdit
- .getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- //EList appFactory = edit.getFacesConfig().getFactory();
- //FactoryType factoryType = (FactoryType)appFactory.get(0);
- /*LifecycleFactoryType item = (LifecycleFactoryType)appFactory.get(0);
- String name = item.getValue();
- assertEquals("lifecycle",name);
- assertTrue(!name.equals(null));*/
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-
-
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigSingleTests.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigSingleTests.java
deleted file mode 100644
index f932973..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigSingleTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper suite for all the tests against the .util package.
- *
- * @author spaxton
- */
-public class FacesConfigSingleTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Single Navigation Rule tests");
-
- //The following tests for single elements of the navigation-rule
- //(description, display-name, icon, from-action, to-view-id, redirect)
- suite.addTest(new TestSuite(FacesConfigFactoryImplForReadSingeNavigationRule.class));
-
- return suite;
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTests.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTests.java
deleted file mode 100644
index 57423c6..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTests.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper suite for all the tests against the .util package.
- *
- * @author spaxton
- * @author le-ake m. G kristos
- */
-public class FacesConfigTests {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test FacesConfig model");
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingeNavigationRule.class,
- "Non-Empty Navigation - Rule"));
- // This is to test config-files with no attributes
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadEmptyNavigationRule.class,
- "Empty Navigation rule"));
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadApplication.class,
- "Applicaiton Test"));
-
- suite.addTest(new TestSuite(MultipleFacesConfigFilesTest.class,
- "Multiple Facesconfig Files Support"));
-
- // FacesConfigElementsTest
- suite.addTest(new TestSuite(FacesConfigElementsTest.class,
- "Faces-config - Each Element"));
-
- // FacesConfigFactoryTest
- suite.addTest(new TestSuite(FacesConfigFactoryTest.class,
- "Facesconfig -Factory "));
-
- // FacesConfigFactoryImplForReadSingeNavigationCase
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingeNavigationCase.class,
- "Navigation-case Test"));
-
- // FacesConfigFactoryImplForReadSingleComponent
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleComponent.class,
- "Component Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleConverter
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleConverter.class,
- "Converter Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleManagedBean
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleManagedBean.class,
- "Managed-Bean Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleReferencedBean
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleReferencedBean.class,
- "Referenced-Bean Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleRenderKit
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleRenderKit.class,
- "Render-kit Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleLifecycle
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleLifecycle.class,
- "Lifecycle Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleValidator
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleValidator.class,
- "Validator Test - Single"));
-
- // FacesConfigFactoryImplForReadRenderer
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadRenderer.class,
- "Renderer Test - Single"));
-
- // FacesConfigFactoryImplForReadAttributeComponent
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadAttributeComponent.class,
- "Component-->Attribute Test - Single"));
-
- // FacesConfigFactoryImplForReadAttributeConverter
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadAttributeConverter.class,
- "Converter-->Attribute Test - Single"));
-
- // FacesConfigFactoryImplForReadAttributeValidator
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadAttributeValidator.class,
- "Validator-->Attribute Test - Single"));
-
- // FacesConfigFactoryImplForReadSingleFactory
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadSingleFactory.class,
- "Factory Test - Single"));
-
- // FacesConfigFactoryImplForReadManagedBeanManagedProperty
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForReadManagedBeanManagedProperty.class,
- "Managed-property - Single"));
-
-
- //FacecConfigFactoryImplForWriteRenderKi
- return suite;
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWrite.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWrite.java
deleted file mode 100644
index 7903e11..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWrite.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper suite for all the tests against the .util package.
- *
- * @author spaxton
- * @author le-ake m. G kristos
- */
-public class FacesConfigTestsForWrite {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test FacesConfig - writing");
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteNavigationRule.class,
- "Write navigation rule "));
- //FacesConfigFactoryImplForWriteFactory
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteFactory.class,
- "Write factory "));
- //FacesConfigFactoryImplForWriteApplication
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteApplication.class,
- "Write Application Test"));
- //FacesConfigFactoryImplForWriteLifecycle
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteLifecycle.class,
- "Write Lifectycle Test"));
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteComponent.class,
- "Write Component Test"));
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteValidator.class,
- "Write Validator Test"));
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteManagedBean.class,
- "Write Managed-bean Test"));
- //FacesConfigFactoryImplForWriteConverter
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteConverter.class,
- "Write converter Test"));
- //FacesConfigFactoryImplForWriteRenderKit
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteRenderKit.class,
- "Write Render-kit Test"));
- //FacesConfigFactoryImplForWriteReferencedBean
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteReferencedBean.class,
- "Write ReferencedBean Test"));
- return suite;
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWriteMultipleFiles.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWriteMultipleFiles.java
deleted file mode 100644
index 1a74117..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWriteMultipleFiles.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Wrapper suite for all the tests against the .util package.
- *
- * @author spaxton
- * @author le-ake m. G kristos
- */
-public class FacesConfigTestsForWriteMultipleFiles {
-
- public static Test suite() {
- TestSuite suite = new TestSuite("Test FacesConfig - writing to MULTIPLE FILes");
-
- //add all the test suits here
-
- //FacesConfigFactoryImplForWriteRenderKitTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteRenderKitTwoFiles.class,
- "Write TWO files Render-kit Test"));
-
- //FacesConfigFactoryImplForWriteLifecycleTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteLifecycleTwoFiles.class,
- "Write TWO files Lifecycle Test"));
-
- //FacesConfigFactoryImplForWriteReferencedBeanTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.class,
- "Write TWO files Referenced Bean Test"));
-
- //FacesConfigFactoryImplForWriteValidatorTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteValidatorTwoFiles.class,
- "Write TWO files Validator Test"));
-
- //FacesConfigFactoryImplForWriteApplicationTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteApplicationTwoFiles.class,
- "Write TWO files Application Test"));
- //FacesConfigFactoryImplForWriteFactoryTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteFactoryTwoFiles.class,
- "Write TWO files config factory Test"));
- //FacesConfigFactoryImplForWriteComponentTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteComponentTwoFiles.class,
- "Write TWO files Component Test"));
-
- //FacesConfigFactoryImplForWriteConverterTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteConverterTwoFiles.class,
- "Write TWO files Converter Test"));
-
- //FacesConfigFactoryImplForWriteNavigationRuleTwoFiles
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.class,
- "Write TWO files Nav - Rules Test"));
- //testWriteManagedBeanToFileOne
- suite.addTest(new TestSuite(
- FacesConfigFactoryImplForWriteManagedBeanTwoFiles.class,
- "Write TWO files Managed - Bean Test"));
- return suite;
- }
-}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/MultipleFacesConfigFilesTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/MultipleFacesConfigFilesTest.java
deleted file mode 100644
index 3c34258..0000000
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/MultipleFacesConfigFilesTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/***************************************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- **************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
-import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
-import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
-import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
-import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
-
-/*
- * This Junit class is used to test the FacesConfigFactoryImpl
- * class.
- *
- */
-public class MultipleFacesConfigFilesTest extends TestCase {
- public MultipleFacesConfigFilesTest(String name) {
- super(name);
- }
- protected void setUp() throws Exception {
- super.setUp();
- WizardUtil.createProject(getName());
- }
- public static Test suite() {
- return new TestSuite(MultipleFacesConfigFilesTest.class);
- }
- public void testReadFacesconfigFile() {
- IProject project = WizardUtil.getTestProject(getName());
- FacesConfigArtifactEdit edit = null;
- String sTestString = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config1.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getLifecycle();
- for (int i = 0; i < lifecycles.size(); i++) {
- LifecycleType lifecycle = (LifecycleType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getPhaseListener();
- for (int j=0; j<phaseListeners.size(); j++) {
- PhaseListenerType phaseListener = (PhaseListenerType)phaseListeners.get(j);
- sTestString = phaseListener.getTextContent();
- System.out.println("What is read from faces-config1.xml is " + sTestString);
- break;
- }
- }
- }
- } finally {
- //assertTrue(sTestString != null && sTestString.equals("test1"));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
- public void testWriteFacesconfigFile() {
- IProject project = WizardUtil.getTestProject(getName());
- FacesConfigArtifactEdit edit = null;
- String sTestString = "";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getLifecycle();
- for (int i = 0; i < lifecycles.size(); i++) {
- LifecycleType lifecycle = (LifecycleType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getPhaseListener();
- for (int j=0; j<phaseListeners.size(); j++) {
- PhaseListenerType phaseListener = (PhaseListenerType)phaseListeners.get(j);
- sTestString = phaseListener.getTextContent();
- break;
- }
- }
- }
- } finally {
- //assertNull(sTestString);
- if (edit != null) {
- edit.dispose();
- }
- }
- sTestString += "newTest2";
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
- project, "WEB-INF/faces-config2.xml");
-
- if (edit.getFacesConfig() != null) {
- FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
- FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
- LifecycleType newLifecycle = facesConfigFactory.createLifecycleType();
- PhaseListenerType newPhaseListener = facesConfigFactory.createPhaseListenerType();
- newPhaseListener.setTextContent(sTestString);
- newLifecycle.getPhaseListener().add(newPhaseListener);
- edit.getFacesConfig().getLifecycle().add(newLifecycle);
- edit.save(null);
- }
- } finally {
- if (edit != null) {
- edit.dispose();
- }
- }
- String result = null;
- try {
- edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
- project, "WEB-INF/faces-config2.xml");
- if (edit.getFacesConfig() != null) {
- EList lifecycles = edit.getFacesConfig().getLifecycle();
- for (int i = 0; i < lifecycles.size(); i++) {
- LifecycleType lifecycle = (LifecycleType) lifecycles.get(i);
- EList phaseListeners = lifecycle.getPhaseListener();
- for (int j=0; j<phaseListeners.size(); j++) {
- PhaseListenerType phaseListener = (PhaseListenerType)phaseListeners.get(j);
- result = phaseListener.getTextContent();
- break;
- }
- }
- }
- } finally {
- assertTrue(result != null && result.equals(sTestString));
- if (edit != null) {
- edit.dispose();
- }
- }
- }
-} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/AllReadTests.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/AllReadTests.java
new file mode 100644
index 0000000..5738faf
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/AllReadTests.java
@@ -0,0 +1,99 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Wrapper suite for all the tests against the .util package.
+ *
+ * @author spaxton
+ * @author le-ake m. G kristos
+ */
+public class AllReadTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test FacesConfig model");
+
+ suite.addTest(new TestSuite(ReadFacesConfigElementsTestCase.class,
+ "Faces-config - Each Element"));
+
+ // Application
+ suite.addTest(new TestSuite(ReadApplicationTestCase.class,
+ "Application Test"));
+
+ // Component
+ suite.addTest(new TestSuite(ReadComponentTestCase.class,
+ "Component Test"));
+ suite.addTest(new TestSuite(ReadAttributeComponentTestCase.class,
+ "Component-->Attribute Test"));
+ suite.addTest(new TestSuite(ReadFacetComponentTestCase.class,
+ "Component-->Facet Test"));
+ suite.addTest(new TestSuite(ReadPropertyComponentTestCase.class,
+ "Component-->Property Test"));
+
+ // Converter
+ suite.addTest(new TestSuite(ReadConverterTestCase.class,
+ "Converter Test - Single"));
+ suite.addTest(new TestSuite(ReadAttributeConverterTestCase.class,
+ "Converter-->Attribute Test"));
+ suite.addTest(new TestSuite(ReadPropertyConverterTestCase.class,
+ "Converter-->Property Test"));
+
+ // Factory
+ suite.addTest(new TestSuite(ReadFactoryTestCase.class,
+ "Facesconfig -Factory "));
+
+ // Lifecycle
+ suite.addTest(new TestSuite(ReadLifecycleTestCase.class,
+ "Lifecycle Test - Single"));
+
+ // Managed Bean
+ suite.addTest(new TestSuite(ReadManagedBeanTestCase.class,
+ "Managed-Bean Test"));
+ suite.addTest(new TestSuite(
+ ReadManagedBeanManagedPropertyTestCase.class,
+ "Managed-Bean Property"));
+
+ // Navigation
+ suite.addTest(new TestSuite(ReadNavigationRuleTestCase.class,
+ "Navigation Rule"));
+
+ // Referenced Bean
+ suite.addTest(new TestSuite(ReadReferencedBeanTestCase.class,
+ "Referenced-Bean Test"));
+
+ // Render-kit
+ suite.addTest(new TestSuite(ReadRenderKitTestCase.class,
+ "Render-kit Test"));
+ suite.addTest(new TestSuite(ReadRendererTestCase.class,
+ "Render-kit-->Renderer Test"));
+ suite.addTest(new TestSuite(ReadAttributeRendererTestCase.class,
+ "Render-kit-->Renderer-->Attribute"));
+ suite.addTest(new TestSuite(ReadFacetRendererTestCase.class,
+ "Render-kit-->Renderer-->Facet"));
+
+ // Validator
+ suite.addTest(new TestSuite(ReadValidatorTestCase.class,
+ "Validator Test - Single"));
+ suite.addTest(new TestSuite(ReadAttributeValidatorTestCase.class,
+ "Validator-->Attribute Test - Single"));
+ suite.addTest(new TestSuite(ReadPropertyValidatorTestCase.class,
+ "Validator-->Property Test"));
+
+ // Extended data
+ suite.addTest(new TestSuite(ReadExtensionDataTestCase.class,
+ "Extension Data Test 1"));
+
+ return suite;
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadApplicationTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadApplicationTestCase.java
new file mode 100644
index 0000000..c90c6fd
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadApplicationTestCase.java
@@ -0,0 +1,326 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ActionListenerType;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.facesconfig.emf.DefaultRenderKitIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationHandlerType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
+import org.eclipse.jst.jsf.facesconfig.emf.StateManagerType;
+import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType;
+import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
+import org.eclipse.jst.jsf.facesconfig.emf.ViewHandlerType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+/*
+ * This Junit class is used to test that the different of child lists
+ * of Application are correctly populated.
+ */
+public class ReadApplicationTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadApplicationTestCase(String name) {
+ super(name);
+ }
+
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the empty navigation rule. Since
+ * I am supplying a single faces-config.xml file as a testing file, I had to
+ * testcases fit in to it by controlling the conditions
+ *
+ */
+ public void testSingleApplication() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ assertEquals(1, application1.getActionListener().size());
+ assertEquals(1, application1.getDefaultRenderKitId().size());
+ assertEquals(1, application1.getLocaleConfig().size());
+ assertEquals(1, application1.getMessageBundle().size());
+ assertEquals(1, application1.getNavigationHandler().size());
+ assertEquals(1, application1.getPropertyResolver().size());
+ assertEquals(1, application1.getStateManager().size());
+ assertEquals(1, application1.getVariableResolver().size());
+ assertEquals(1, application1.getViewHandler().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ApplicationType getApplication1(FacesConfigArtifactEdit edit)
+ {
+ ApplicationType application1 =
+ FacesConfigModelUtil.findApplicationById
+ (edit.getFacesConfig().getApplication(), "application1");
+ assertNotNull(application1);
+ return application1;
+ }
+
+ /*
+ * Testing for action-listener
+ *
+ */
+ public void testActionListener() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ ActionListenerType actionListener =
+ FacesConfigModelUtil.findActionListenerById
+ (application1.getActionListener(), "actionListener1");
+ assertNotNull(actionListener);
+ assertEquals("Action listener",
+ actionListener.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for default-render-kit-id
+ *
+ */
+ public void testDefaultRenderKitId() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ DefaultRenderKitIdType defaultRenderKit =
+ FacesConfigModelUtil.findDefaultRenderKitIdTypeById
+ (application1.getDefaultRenderKitId(), "defaultRenderKit1");
+ assertNotNull(defaultRenderKit);
+ assertEquals("some renderer kit",
+ defaultRenderKit.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for a single entry of message-bundle
+ *
+ */
+ public void testMessageBundle() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ MessageBundleType messageBundleType =
+ FacesConfigModelUtil.findMessageBundleTypeById
+ (application1.getMessageBundle(), "messageBundle1");
+ assertNotNull(messageBundleType);
+ assertEquals("some messeage bundle goes here",
+ messageBundleType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for a single entry of navigation-handler
+ *
+ */
+ public void testNavigationHandler() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ NavigationHandlerType navigationHandlerType =
+ (NavigationHandlerType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getNavigationHandler(), "navigationHandler1");
+ assertNotNull(navigationHandlerType);
+ assertEquals("navigation handler",
+ navigationHandlerType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for a single entry of view-handler
+ *
+ */
+ public void testViewHandler() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ ViewHandlerType viewHandlerType =
+ (ViewHandlerType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getViewHandler(), "viewHandler1");
+ assertNotNull(viewHandlerType);
+ assertEquals("view handler",
+ viewHandlerType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for a single entry of state-manager
+ *
+ */
+ public void testStateManager() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ StateManagerType stateManagerType =
+ (StateManagerType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getStateManager(), "stateManager1");
+ assertNotNull(stateManagerType);
+ assertEquals("state manager",
+ stateManagerType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * Testing for the variable-resolver
+ */
+
+ public void testSingleVariableResolver() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ VariableResolverType variableResolverType =
+ (VariableResolverType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getVariableResolver(), "variableResolver1");
+ assertNotNull(variableResolverType);
+ assertEquals("com.ibm.faces.databind.SelectItemsVarResolver",
+ variableResolverType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for the property-resolver
+ */
+ public void testSinglePropertyResolver() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ PropertyResolverType propertyResolverType =
+ (PropertyResolverType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getPropertyResolver(), "propertyResolver1");
+ assertNotNull(propertyResolverType);
+ assertEquals("com.ibm.faces.databind.SelectItemsPropResolver",
+ propertyResolverType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Testing for the local-config within an application
+ */
+ public void testLocalConfig() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ApplicationType application1 = getApplication1(edit);
+ LocaleConfigType localeConfigType =
+ (LocaleConfigType)
+ FacesConfigModelUtil.findEObjectElementById
+ (application1.getLocaleConfig(), "localeConfig1");
+ assertNotNull(localeConfigType);
+
+ assertEquals("en", localeConfigType.getDefaultLocale().getTextContent());
+ assertEquals("defaultLocale1", localeConfigType.getDefaultLocale().getId());
+
+ assertEquals(2, localeConfigType.getSupportedLocale().size());
+
+ SupportedLocaleType supportedLocaleType =
+ (SupportedLocaleType)
+ FacesConfigModelUtil.findEObjectElementById(
+ localeConfigType.getSupportedLocale(),
+ "supportedLocale_en");
+ assertNotNull(supportedLocaleType);
+ assertEquals("en", supportedLocaleType.getTextContent().trim());
+
+ supportedLocaleType =
+ (SupportedLocaleType)
+ FacesConfigModelUtil.findEObjectElementById(
+ localeConfigType.getSupportedLocale(),
+ "supportedLocale_de");
+ assertNotNull(supportedLocaleType);
+ assertEquals("de", supportedLocaleType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeComponentTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeComponentTestCase.java
new file mode 100644
index 0000000..9516f72
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeComponentTestCase.java
@@ -0,0 +1,276 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This clas is used to test the Attribute inside Component Element
+ *
+ */
+public class ReadAttributeComponentTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadAttributeComponentTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the existence of a single
+ * attribute in the Compoenent Element. While testing I had just one with
+ * everything (all children) inside it
+ */
+ public void testSingleAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ComponentType getComponent1(FacesConfigType facesConfigType)
+ {
+ return (ComponentType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getComponent(), "component1");
+ }
+
+ private AttributeType getAttribute1(FacesConfigType facesConfigType)
+ {
+ ComponentType component1 = getComponent1(facesConfigType);
+ assertNotNull(component1);
+ return (AttributeType) FacesConfigModelUtil
+ .findEObjectElementById
+ (component1.getAttribute(), "componentAttribute1");
+ }
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDescription()
+ ,"componentAttribute1_descripton1");
+ assertEquals("attribute-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDisplayName()
+ ,"componentAttribute1_displayName1");
+ assertEquals("attribute-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attrType = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attrType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (attrType.getIcon(), "componentAttribute1_icon1");
+ assertNotNull(iconType);
+
+ assertEquals("attribute-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("attribute-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testAttributeNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+
+ assertEquals("attribute-name"
+ ,attribute1.getAttributeName().getTextContent());
+ assertEquals("attribute-class"
+ ,attribute1.getAttributeClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("attribute-suggested-value"
+ ,attributeType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("value5"
+ , attributeType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+ public void testAttributeExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ if (edit.getFacesConfig() != null) {
+ EList comp = edit.getFacesConfig().getComponent();
+ assertTrue(!comp.isEmpty());
+ for (int i = 0; i < comp.size(); i++) {
+ ComponentType compType = (ComponentType) comp
+ .get(i);
+ assertTrue(!compType.getAttribute().isEmpty());
+
+ EList attr = compType.getAttribute();
+ for (int k = 0; k < attr.size(); k++) {
+ AttributeType attrType = (AttributeType) attr.get(k);
+ EList ext= attrType.getAttributeExtension();
+ assertTrue(ext.size()!=0);
+ }
+ }
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeConverterTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeConverterTestCase.java
new file mode 100644
index 0000000..3efaaca
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeConverterTestCase.java
@@ -0,0 +1,274 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test for the existence of all
+ * items with in attribute of the Converter Element
+ *
+ */
+public class ReadAttributeConverterTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadAttributeConverterTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * checks to see if there exists an atribute in the first place
+ *
+ */
+ public void testSingleAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private AttributeType getAttribute1(FacesConfigType facesConfig)
+ {
+ ConverterType converter1 =
+ (ConverterType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getConverter(), "converter1");
+ assertNotNull(converter1);
+
+ return (AttributeType)
+ FacesConfigModelUtil
+ .findEObjectElementById(converter1.getAttribute()
+ , "converter1Attribute");
+ }
+
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDescription()
+ ,"converter1_attribute_description");
+ assertEquals("converter-attribute-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDisplayName()
+ ,"converter1_attribute_display-name");
+ assertEquals("converter-attribute-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attrType = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attrType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (attrType.getIcon(), "converter1_attribute_icon");
+ assertNotNull(iconType);
+
+ assertEquals("converter1-attribute-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("converter1-attribute-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testAttributeNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+
+ assertEquals("converter1-attribute-name"
+ ,attribute1.getAttributeName().getTextContent());
+ assertEquals("converter1-attribute-class"
+ ,attribute1.getAttributeClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("converter1-attribute-suggested-value"
+ ,attributeType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("converter1-default-value"
+ , attributeType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+ public void testAttributeExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ if (edit.getFacesConfig() != null) {
+ EList comp = edit.getFacesConfig().getComponent();
+ assertTrue(!comp.isEmpty());
+ for (int i = 0; i < comp.size(); i++) {
+ ComponentType compType = (ComponentType) comp
+ .get(i);
+ assertTrue(!compType.getAttribute().isEmpty());
+
+ EList attr = compType.getAttribute();
+ for (int k = 0; k < attr.size(); k++) {
+ AttributeType attrType = (AttributeType) attr.get(k);
+ EList ext= attrType.getAttributeExtension();
+ assertTrue(ext.size()!=0);
+ }
+ }
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeRendererTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeRendererTestCase.java
new file mode 100644
index 0000000..b0e5644
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeRendererTestCase.java
@@ -0,0 +1,267 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class ReadAttributeRendererTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadAttributeRendererTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * checks to see if there exists an atribute in the first place
+ *
+ */
+ public void testSingleAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private AttributeType getAttribute1(FacesConfigType facesConfig)
+ {
+ RenderKitType renderKit =
+ (RenderKitType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfig.getRenderKit(), "renderKit1");
+ assertNotNull(renderKit);
+
+ RendererType renderer =
+ (RendererType) FacesConfigModelUtil
+ .findEObjectElementById
+ (renderKit.getRenderer(), "renderKit1Renderer");
+ assertNotNull(renderer);
+
+ return (AttributeType) FacesConfigModelUtil
+ .findEObjectElementById
+ (renderer.getAttribute(), "renderKit1RendererAttribute1");
+ }
+
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDescription()
+ ,"renderKit1RendererAttribute1Description");
+ assertEquals("renderer-attribute-attribute-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDisplayName()
+ ,"renderKit1RendererAttribute1DisplayName");
+ assertEquals("renderer-attribute-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attrType = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attrType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (attrType.getIcon(), "renderKit1RendererAttribute1Icon");
+ assertNotNull(iconType);
+
+ assertEquals("renderer-attribute-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("renderer-attribute-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testAttributeNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+
+ assertEquals("renderer attribute name"
+ ,attribute1.getAttributeName().getTextContent());
+ assertEquals("renderer Attribute Class"
+ ,attribute1.getAttributeClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("renderer attribute suggested value"
+ ,attributeType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("renderer attribute default value"
+ , attributeType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+ public void testAttributeExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ if (edit.getFacesConfig() != null) {
+ EList comp = edit.getFacesConfig().getComponent();
+ assertTrue(!comp.isEmpty());
+ for (int i = 0; i < comp.size(); i++) {
+ ComponentType compType = (ComponentType) comp
+ .get(i);
+ assertTrue(!compType.getAttribute().isEmpty());
+
+ EList attr = compType.getAttribute();
+ for (int k = 0; k < attr.size(); k++) {
+ AttributeType attrType = (AttributeType) attr.get(k);
+ EList ext= attrType.getAttributeExtension();
+ assertTrue(ext.size()!=0);
+ }
+ }
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeValidatorTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeValidatorTestCase.java
new file mode 100644
index 0000000..7dc7600
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadAttributeValidatorTestCase.java
@@ -0,0 +1,274 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test Attibute part in the Validator Element
+ *
+ */
+public class ReadAttributeValidatorTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadAttributeValidatorTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * checks to see if there exists an atribute in the first place
+ *
+ */
+ public void testSingleAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private AttributeType getAttribute1(FacesConfigType facesConfig)
+ {
+ ValidatorType validator1 =
+ (ValidatorType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getValidator(), "validator1");
+ assertNotNull(validator1);
+
+ return (AttributeType)
+ FacesConfigModelUtil
+ .findEObjectElementById(validator1.getAttribute()
+ , "validator1_attribute");
+ }
+
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDescription()
+ ,"validator1_attribute_description");
+ assertEquals("validator-attribute-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+ assertNotNull(attributeType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (attributeType.getDisplayName()
+ ,"validator1_attribute_displayName");
+ assertEquals("validator-attribute-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attrType = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attrType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (attrType.getIcon(), "validator1_attribute_icon");
+ assertNotNull(iconType);
+
+ assertEquals("validator-attribute-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("validator-attribute-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testAttributeNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attribute1 = getAttribute1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+
+ assertEquals("validator-attribute-name"
+ ,attribute1.getAttributeName().getTextContent());
+ assertEquals("validator-attribute-class"
+ ,attribute1.getAttributeClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("validator-attribute-suggested-value"
+ ,attributeType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ AttributeType attributeType =
+ getAttribute1(edit.getFacesConfig());
+
+ assertEquals("validator-default-value"
+ , attributeType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+ public void testAttributeExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ if (edit.getFacesConfig() != null) {
+ EList comp = edit.getFacesConfig().getComponent();
+ assertTrue(!comp.isEmpty());
+ for (int i = 0; i < comp.size(); i++) {
+ ComponentType compType = (ComponentType) comp
+ .get(i);
+ assertTrue(!compType.getAttribute().isEmpty());
+
+ EList attr = compType.getAttribute();
+ for (int k = 0; k < attr.size(); k++) {
+ AttributeType attrType = (AttributeType) attr.get(k);
+ EList ext= attrType.getAttributeExtension();
+ assertTrue(ext.size()!=0);
+ }
+ }
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadComponentTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadComponentTestCase.java
new file mode 100644
index 0000000..b24e1e6
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadComponentTestCase.java
@@ -0,0 +1,271 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test for Component with in faces-config
+ * root Element.
+ *
+ */
+public class ReadComponentTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadComponentTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * assert there is at least one Component listed
+ */
+ public void testSingleComponent() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertNotNull(getComponent1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ComponentType getComponent1(FacesConfigType facesConfig)
+ {
+ return (ComponentType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getComponent(), "component1");
+ }
+
+ // Test for the Descirption
+ public void testNonEmptyDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ final ComponentType component1 =
+ getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ final DescriptionType descriptionType =
+ (DescriptionType) FacesConfigModelUtil.
+ findEObjectElementById
+ (component1.getDescription(), "componentDescription1");
+ assertNotNull(descriptionType);
+ assertEquals("my component", descriptionType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ *Check for the Display name
+ *
+ */
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ final ComponentType component1 =
+ getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType) FacesConfigModelUtil.
+ findEObjectElementById
+ (component1.getDisplayName(), "componentDisplayName1");
+ assertNotNull(displayNameType);
+ assertEquals("My component", displayNameType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * get the icon of a compnent
+ *
+ */
+ public void testNonEmptyIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ final ComponentType component1 =
+ getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ final IconType iconType =
+ (IconType) FacesConfigModelUtil.
+ findEObjectElementById
+ (component1.getIcon(), "componentIcon1");
+ assertNotNull(iconType);
+
+ assertEquals("small-icon",
+ iconType.getSmallIcon().getTextContent().trim());
+ assertEquals("large-icon",
+ iconType.getLargeIcon().getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * check to see there is the Component-type and the Component-class
+ */
+ public void testNonEmptyComponentTypeAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull (edit.getFacesConfig());
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ assertEquals("component-type", component1.getComponentType().getTextContent());
+ assertEquals("ComponentClass", component1.getComponentClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /**
+ * check for the attribute part of the Component
+ * @see ReadAttributeComponentTestCase for the full test of the
+ * component attributes
+ */
+ public void testAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull (edit.getFacesConfig());
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+
+ // full testing of attribute is in ReadAttributeComponentTestCase
+ assertEquals(1, component1.getAttribute().size());
+ assertEquals("componentAttribute1",
+ ((AttributeType)component1.getAttribute().get(0)).getId());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * check to see there is property listed in the input file
+ * @see ReadPropertyComponentTestCase for full test of component
+ * property
+ */
+ public void testProperty() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ assertEquals(1, component1.getProperty().size());
+ assertEquals("componentProperty1", ((PropertyType)component1.getProperty().get(0)).getId());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testFacet()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ assertEquals(1, component1.getFacet().size());
+ assertEquals("componentFacet1", ((FacetType)component1.getFacet().get(0)).getId());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Check for hte Component-Extension inside Component
+ */
+
+ public void testComponentExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ ComponentExtensionType extType =
+ (ComponentExtensionType) FacesConfigModelUtil
+ .findEObjectElementById(component1.getComponentExtension()
+ , "componentExtension1");
+ assertNotNull(extType);
+ //assertEquals("component-extension", extType.getAny().get(0));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadConverterTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadConverterTestCase.java
new file mode 100644
index 0000000..fa3b2ad
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadConverterTestCase.java
@@ -0,0 +1,194 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the Converter which is one of
+ * many items inside the root elemnt faces-config in the configuration
+ * information hierarchy of the faces-config.xml file
+ *
+ */
+public class ReadConverterTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadConverterTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * Check to see if this element exists. There sould be at least one
+ * of such kind listed in the file.
+ */
+ public void testSingleConverter() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertNotNull(getConverter1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ConverterType getConverter1(FacesConfigType facesConfig)
+ {
+ return
+ (ConverterType) FacesConfigModelUtil.
+ findEObjectElementById
+ (facesConfig.getConverter(), "converter1");
+ }
+
+ private ConverterType getConverter2(FacesConfigType facesConfig)
+ {
+
+ return
+ (ConverterType) FacesConfigModelUtil.
+ findEObjectElementById
+ (facesConfig.getConverter(), "converter2");
+ }
+
+ // Test for the Descirption
+ public void testDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ConverterType converter1 = getConverter1(edit.getFacesConfig());
+ assertNotNull(converter1);
+
+ // test descriptioni
+ {
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil.findEObjectElementById
+ (converter1.getDescription(), "converter1Description");
+ assertEquals("converter-description"
+ , descType.getTextContent());
+ }
+ // test displayname
+ {
+ DisplayNameType displayNameType =
+ (DisplayNameType) FacesConfigModelUtil.findEObjectElementById
+ (converter1.getDisplayName(), "converter1DisplayName");
+ assertEquals("converter-display-name"
+ , displayNameType.getTextContent());
+ }
+ // test icon
+ {
+ IconType iconType =
+ (IconType) FacesConfigModelUtil.findEObjectElementById
+ (converter1.getIcon(), "converter1Icon");
+ assertEquals("converter-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("converter-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testValidatorSingleValueProperties() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ // we need two different converters because converter-for-class
+ // and converter-id are mutually exclusive
+ final ConverterType converter1 = getConverter1(edit.getFacesConfig());
+ assertNotNull(converter1);
+
+ assertEquals("converter-for-class"
+ , converter1.getConverterForClass().getTextContent());
+ assertEquals("converter-class"
+ , converter1.getConverterClass().getTextContent());
+
+ final ConverterType converter2 = getConverter2(edit.getFacesConfig());
+ assertNotNull(converter2);
+
+ assertEquals("converter2-id"
+ , converter2.getConverterId().getTextContent());
+ assertEquals("converter2-class"
+ , converter2.getConverterClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test the attribute sub-property of validators.
+ * Note: the attribute itself is tested in ReadAttributeConverterTestCase
+ * this test case just tests the presence of the attribute
+ */
+ public void testAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ConverterType converter1 = getConverter1(edit.getFacesConfig());
+ assertEquals(1, converter1.getAttribute().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test the property sub-property of validators
+ * Note: the attribute itself is tested in ReadPropertyConverterTestCase
+ * this test case just tests for the presence of the property
+ */
+ public void testProperty() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ConverterType converter1 = getConverter1(edit.getFacesConfig());
+ assertEquals(1, converter1.getProperty().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadExtensionDataTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadExtensionDataTestCase.java
new file mode 100644
index 0000000..3459de9
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadExtensionDataTestCase.java
@@ -0,0 +1,86 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DynamicAttribute;
+import org.eclipse.jst.jsf.facesconfig.emf.DynamicElement;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class ReadExtensionDataTestCase extends TestCase
+{
+ IProject project = null;
+
+ public ReadExtensionDataTestCase(String name) {
+ super(name);
+ }
+
+
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * Check for hte Component-Extension inside Component
+ */
+
+ public void testSingleElementRoot() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project,
+ "WEB-INF/faces-config-ext-data1.xml");
+ assertNotNull(edit.getFacesConfig());
+ ComponentType component1 = getComponent1(edit.getFacesConfig());
+ assertNotNull(component1);
+
+ ComponentExtensionType extType =
+ (ComponentExtensionType) FacesConfigModelUtil
+ .findEObjectElementById(component1.getComponentExtension()
+ , "singleRootComponentExt");
+ assertNotNull(extType);
+ List elements = extType.getChildNodes();
+ assertEquals(1, elements.size());
+ DynamicElement singleRoot = (DynamicElement) elements.get(0);
+ assertEquals("any-data", singleRoot.getName());
+
+ assertEquals(1, singleRoot.getAttributes().size());
+ DynamicAttribute attribute =
+ (DynamicAttribute) singleRoot.getAttributes().get(0);
+ assertEquals("attribute", attribute.getName());
+ assertEquals("any-data-attribute", attribute.getValue());
+
+ assertEquals(2, singleRoot.getChildNodes().size());
+
+ DynamicElement firstChild =
+ (DynamicElement) singleRoot.getChildNodes().get(0);
+ assertEquals("first-child", firstChild.getName());
+// assertEquals("someData", firstChild.getTextContent());
+
+ DynamicElement secondChild =
+ (DynamicElement) singleRoot.getChildNodes().get(1);
+ assertEquals("second-child", secondChild.getName());
+// assertEquals("second Child's data", secondChild.getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ComponentType getComponent1(FacesConfigType facesConfig)
+ {
+ return (ComponentType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getComponent(), "component1");
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigElementsTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacesConfigElementsTestCase.java
index 1ae832a..d15e801 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigElementsTest.java
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacesConfigElementsTestCase.java
@@ -8,14 +8,14 @@
* Contributors:
* IBM Corporation - initial API and implementation
**************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
+package org.eclipse.jst.jsf.facesconfig.tests.read;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
/*
@@ -23,20 +23,21 @@ import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
* class.
*
*/
-public class FacesConfigElementsTest extends TestCase {
+public class ReadFacesConfigElementsTestCase extends TestCase {
IProject project = null;
- public FacesConfigElementsTest(String name) {
+ public ReadFacesConfigElementsTestCase(String name) {
super(name);
}
protected void setUp() throws Exception {
super.setUp();
+ WizardUtil.createProject(getName());
project = WizardUtil.getTestProject(getName());
}
public static Test suite() {
- return new TestSuite(FacesConfigElementsTest.class);
+ return new TestSuite(ReadFacesConfigElementsTestCase.class);
}
/*
@@ -49,10 +50,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList app = edit.getFacesConfig().getApplication();
- assertTrue(!app.isEmpty() && app.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getApplication().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -70,10 +69,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList factory = edit.getFacesConfig().getFactory();
- assertTrue(!factory.isEmpty() && factory.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getFactory().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -90,10 +87,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList component = edit.getFacesConfig().getComponent();
- assertTrue(!component.isEmpty() && component.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getComponent().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -111,10 +106,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList bean = edit.getFacesConfig().getManagedBean();
- assertTrue(!bean.isEmpty() && bean.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(3, edit.getFacesConfig().getManagedBean().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -133,10 +126,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList bean = edit.getFacesConfig().getReferencedBean();
- assertTrue(!bean.isEmpty() && bean.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getReferencedBean().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -155,10 +146,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList renderKit = edit.getFacesConfig().getRenderKit();
- assertTrue(!renderKit.isEmpty() && renderKit.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getRenderKit().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -175,10 +164,8 @@ public class FacesConfigElementsTest extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList validator = edit.getFacesConfig().getValidator();
- assertTrue(!validator.isEmpty() && validator.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getValidator().size());
} finally {
if (edit != null) {
edit.dispose();
@@ -191,20 +178,52 @@ public class FacesConfigElementsTest extends TestCase {
*/
public void testConverter() {
-
FacesConfigArtifactEdit edit = null;
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList converter = edit.getFacesConfig().getConverter();
- assertTrue(!converter.isEmpty() && converter.size() == 1);
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(2, edit.getFacesConfig().getConverter().size());
} finally {
if (edit != null) {
edit.dispose();
}
}
}
-
+
+ /**
+ * Testing for the navigation rule list population
+ */
+ public void testNavigationRule()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(2, edit.getFacesConfig().getNavigationRule().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Testing for the lifecycle list population
+ */
+ public void testLifecycle()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getLifecycle().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetComponentTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetComponentTestCase.java
new file mode 100644
index 0000000..e6d143f
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetComponentTestCase.java
@@ -0,0 +1,185 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/**
+ * Test the FacetType on a ComponentType
+ *
+ * @author cbateman
+ *
+ */
+public class ReadFacetComponentTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadFacetComponentTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the existence of a single
+ * attribute in the Compoenent Element. While testing I had just one with
+ * everything (all children) inside it
+ */
+ public void testSingleFacet() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facet1 = getFacet1(edit.getFacesConfig());
+ assertNotNull(facet1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ComponentType getComponent1(FacesConfigType facesConfigType)
+ {
+ return (ComponentType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getComponent(), "component1");
+ }
+
+ private FacetType getFacet1(FacesConfigType facesConfigType)
+ {
+ ComponentType component1 = getComponent1(facesConfigType);
+ assertNotNull(component1);
+ return (FacetType) FacesConfigModelUtil
+ .findEObjectElementById
+ (component1.getFacet(), "componentFacet1");
+ }
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType =
+ getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (facetType.getDescription()
+ ,"componentFacet1_descripton1");
+ assertEquals("Facet1 Description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType =
+ getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (facetType.getDisplayName()
+ ,"componentFacet1_displayName1");
+ assertEquals("Component Facet 1"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType = getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facetType.getIcon(), "componentFacet1_icon1");
+ assertNotNull(iconType);
+
+ assertEquals("facet-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("facet-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void testFacetName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facet1 = getFacet1(edit.getFacesConfig());
+ assertNotNull(facet1);
+
+ assertEquals("facetName_chieb_sieb"
+ ,facet1.getFacetName().getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetRendererTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetRendererTestCase.java
new file mode 100644
index 0000000..d3f15a5
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFacetRendererTestCase.java
@@ -0,0 +1,183 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class ReadFacetRendererTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadFacetRendererTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the existence of a single
+ * attribute in the Compoenent Element. While testing I had just one with
+ * everything (all children) inside it
+ */
+ public void testSingleFacet() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facet1 = getFacet1(edit.getFacesConfig());
+ assertNotNull(facet1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private FacetType getFacet1(FacesConfigType facesConfigType)
+ {
+ RenderKitType renderKit =
+ (RenderKitType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getRenderKit(), "renderKit1");
+ assertNotNull(renderKit);
+
+ RendererType renderer =
+ (RendererType) FacesConfigModelUtil
+ .findEObjectElementById
+ (renderKit.getRenderer(), "renderKit1Renderer");
+ assertNotNull(renderer);
+
+ return (FacetType) FacesConfigModelUtil
+ .findEObjectElementById
+ (renderer.getFacet(), "renderKit1Renderer1Facet1");
+ }
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType =
+ getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (facetType.getDescription()
+ ,"renderKit1Renderer1Facet1Description");
+ assertEquals("RendererFacetDescription"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType =
+ getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (facetType.getDisplayName()
+ ,"renderKit1Renderer1Facet1DisplayName");
+ assertEquals("RendererFacetDisplayName"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facetType = getFacet1(edit.getFacesConfig());
+ assertNotNull(facetType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facetType.getIcon(), "renderKit1Renderer1Facet1Icon");
+ assertNotNull(iconType);
+
+ assertEquals("facet-renderer-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("facet-renderer-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void testFacetName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ FacetType facet1 = getFacet1(edit.getFacesConfig());
+ assertNotNull(facet1);
+
+ assertEquals("rendererFacetName"
+ ,facet1.getFacetName().getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFactoryTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFactoryTestCase.java
new file mode 100644
index 0000000..f7c142b
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadFactoryTestCase.java
@@ -0,0 +1,179 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+/*
+* This Junit class is used to test the FacesConfigFactoryImpl
+* class.
+*
+*/
+public class ReadFactoryTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadFactoryTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public static Test suite() {
+ return new TestSuite(ReadFactoryTestCase.class);
+ }
+
+ /*
+ * Test the applicaion element of faces-config.xml
+ *
+ */
+ public void testEmptyFactory() {
+
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getFactory().size());
+ assertNotNull(getFactoryType1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private FactoryType getFactoryType1(FacesConfigType facesConfig)
+ {
+ return (FactoryType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getFactory(), "factory1");
+ }
+ /*
+ * Test the application-factory element of Factory in faces-config.xml
+ *
+ */
+ public void testApplicationFactory() {
+
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ FactoryType factoryType1 = getFactoryType1(edit.getFacesConfig());
+ assertNotNull(factoryType1);
+ ApplicationFactoryType applicationFactoryType1 =
+ (ApplicationFactoryType) FacesConfigModelUtil.findEObjectElementById
+ (factoryType1.getApplicationFactory(), "applicationFactory1");
+ assertNotNull(applicationFactoryType1);
+ assertEquals("application-factory",
+ applicationFactoryType1.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Test the faces-context-factory element of Factory in faces-config.xml
+ */
+ public void testFacesContextFactory() {
+
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ FactoryType factoryType1 = getFactoryType1(edit.getFacesConfig());
+ assertNotNull(factoryType1);
+ FacesContextFactoryType facesContextFactoryType1 =
+ (FacesContextFactoryType) FacesConfigModelUtil.findEObjectElementById
+ (factoryType1.getFacesContextFactory(), "facesContextFactory1");
+ assertNotNull(facesContextFactoryType1);
+ assertEquals("faces-context-factory",
+ facesContextFactoryType1.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * Test the application-factory element of Factory in faces-config.xml
+ *
+ */
+ public void testLifeCycleFactory() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ FactoryType factoryType1 = getFactoryType1(edit.getFacesConfig());
+ assertNotNull(factoryType1);
+ LifecycleFactoryType lifecycleFactoryType1 =
+ (LifecycleFactoryType) FacesConfigModelUtil.findEObjectElementById
+ (factoryType1.getLifecycleFactory(), "lifecycleFactory1");
+ assertNotNull(lifecycleFactoryType1);
+ assertEquals("lifecycle-factory",
+ lifecycleFactoryType1.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test the renderkit-factory element
+ */
+ public void testRenderkitFactory()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ FactoryType factoryType1 = getFactoryType1(edit.getFacesConfig());
+ assertNotNull(factoryType1);
+ RenderKitFactoryType renderKitFactoryType1 =
+ (RenderKitFactoryType) FacesConfigModelUtil.findEObjectElementById
+ (factoryType1.getRenderKitFactory(), "renderKitFactory1");
+ assertNotNull(renderKitFactoryType1);
+ assertEquals("render-kit-factory",
+ renderKitFactoryType1.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleLifecycle.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadLifecycleTestCase.java
index f73bf6c..9a0ff4e 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleLifecycle.java
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadLifecycleTestCase.java
@@ -8,13 +8,16 @@
* Contributors:
* IBM Corporation - initial API and implementation
**************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
+package org.eclipse.jst.jsf.facesconfig.tests.read;
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
-import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
+import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
/*
* This Junit class is used to test the lifecycle which is one of
@@ -22,10 +25,10 @@ import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
* information hierarchy of the faces-config.xml file
*
*/
-public class FacesConfigFactoryImplForReadSingleLifecycle extends TestCase {
+public class ReadLifecycleTestCase extends TestCase {
IProject project = null;
- public FacesConfigFactoryImplForReadSingleLifecycle(String name) {
+ public ReadLifecycleTestCase(String name) {
super(name);
}
@@ -46,10 +49,9 @@ public class FacesConfigFactoryImplForReadSingleLifecycle extends TestCase {
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList lifecycle = edit.getFacesConfig().getLifecycle();
- assertTrue(!lifecycle.isEmpty());
- }
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getLifecycle().size());
+ assertNotNull(getLifecycleType1(edit.getFacesConfig()));
} finally {
if (edit != null) {
edit.dispose();
@@ -57,26 +59,28 @@ public class FacesConfigFactoryImplForReadSingleLifecycle extends TestCase {
}
}
+ private LifecycleType getLifecycleType1(FacesConfigType facesConfig)
+ {
+ return (LifecycleType)
+ FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getLifecycle(),
+ "lifecycle1");
+ }
+
// Test for the Descirption
public void testPhaseListener() {
FacesConfigArtifactEdit edit = null;
try {
edit = FacesConfigArtifactEdit
.getFacesConfigArtifactEditForRead(project);
- if (edit.getFacesConfig() != null) {
- EList lifecycle = edit.getFacesConfig().getLifecycle();
- assertTrue(!lifecycle.isEmpty());
- for (int i = 0; i < lifecycle.size(); i++) {
- LifecycleType item = (LifecycleType) lifecycle.get(i);
-
- EList phaseListener = item.getPhaseListener();
-
- assertTrue(!phaseListener.isEmpty());
- // sassertEquals(2,navCases.size());
- System.out.println(" size of description is : "
- + phaseListener.size());
- }
- }
+ assertNotNull(edit.getFacesConfig());
+ LifecycleType lifecycle1 = getLifecycleType1(edit.getFacesConfig());
+ assertNotNull(lifecycle1);
+ PhaseListenerType phaseListener1 = (PhaseListenerType) FacesConfigModelUtil
+ .findEObjectElementById(lifecycle1.getPhaseListener(), "phaseListener1");
+ assertNotNull(phaseListener1);
+ assertEquals("org.eclipse.wtp.jsf.tests.ValueResourcePhaseListener",
+ phaseListener1.getTextContent().trim());
} finally {
if (edit != null) {
edit.dispose();
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanManagedPropertyTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanManagedPropertyTestCase.java
new file mode 100644
index 0000000..d5d50c1
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanManagedPropertyTestCase.java
@@ -0,0 +1,293 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntryType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the Managed-Property
+ * of the Managed-Bean Element
+ *
+ */
+public class ReadManagedBeanManagedPropertyTestCase extends
+ TestCase {
+ IProject project = null;
+
+ public ReadManagedBeanManagedPropertyTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * Check to see there is at least one property that exists within attribute
+ *
+ */
+ public void testSingleManagedProperty() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ assertNotNull(getManagedProperty(
+ "managedBean1Property1", edit.getFacesConfig()));
+ assertNotNull(getManagedProperty("managedBean1Property2"
+ , edit.getFacesConfig()));
+ assertNotNull(getManagedProperty("managedBeanMapProperty"
+ , edit.getFacesConfig()));
+ assertNotNull(getManagedProperty("managedBeanListProperty"
+ , edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ManagedPropertyType getManagedProperty(String property, FacesConfigType facesConfig)
+ {
+ ManagedBeanType bean = (ManagedBeanType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getManagedBean(), "managedBean1");
+ assertNotNull(bean);
+ return (ManagedPropertyType)
+ FacesConfigModelUtil
+ .findEObjectElementById(bean.getManagedProperty(), property);
+ }
+
+ /*
+ * Get the Description. It simply checks to see if there is at least
+ * one such item
+ *
+ */
+
+ public void testManagedBeanDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedPropertyType property =
+ getManagedProperty("managedBean1Property1"
+ , edit.getFacesConfig());
+ assertNotNull(property);
+
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil
+ .findEObjectElementById(property.getDescription()
+ , "managedBean1Property1_description");
+ assertNotNull(descType);
+ assertEquals("managed-property-description", descType.getTextContent());
+
+ DisplayNameType displayName =
+ (DisplayNameType) FacesConfigModelUtil
+ .findEObjectElementById(property.getDisplayName()
+ , "managedBean1Property1_displayName");
+ assertNotNull(displayName);
+ assertEquals("managed-property-display-name"
+ , displayName.getTextContent());
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById(property.getIcon()
+ , "managedBean1Property1_icon");
+ assertNotNull(iconType);
+ assertEquals("managedBean1-property-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("managedBean1-property-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * Get both the Property-name and Property-class. It simply checks to see if
+ * there is at least one each items and check if the names are identical
+ * as given in the input xml file.
+ *
+ */
+ public void testValueManagedProperty() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedPropertyType property =
+ getManagedProperty("managedBean1Property1"
+ , edit.getFacesConfig());
+ assertNotNull(property);
+
+ assertEquals("bean-property-name"
+ , property.getPropertyName().getTextContent());
+ assertEquals("bean-property-class"
+ , property.getPropertyClass().getTextContent());
+ assertEquals("bean-propertyValue1"
+ , property.getValue().getTextContent());
+ assertNull(property.getNullValue());
+ assertNull(property.getMapEntries());
+ assertNull(property.getListEntries());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testNullValueManagedProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedPropertyType property =
+ getManagedProperty("managedBean1Property2"
+ , edit.getFacesConfig());
+ assertNotNull(property);
+
+ assertEquals("bean-property2-name"
+ , property.getPropertyName().getTextContent());
+ assertEquals("bean-property2-class"
+ , property.getPropertyClass().getTextContent());
+ assertNotNull(property.getNullValue());
+ assertNull(property.getValue());
+ assertNull(property.getMapEntries());
+ assertNull(property.getListEntries());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testMapValueManagedProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedPropertyType property =
+ getManagedProperty("managedBeanMapProperty"
+ , edit.getFacesConfig());
+ assertNotNull(property);
+
+ assertEquals("map-bean-name"
+ , property.getPropertyName().getTextContent());
+ assertEquals("map-bean-class"
+ , property.getPropertyClass().getTextContent());
+ assertNotNull(property.getMapEntries());
+
+ MapEntriesType mapEntries = property.getMapEntries();
+ assertEquals("propertyMapEntryKey",
+ mapEntries.getKeyClass().getTextContent());
+ assertEquals("propertyMapEntryValueClass",
+ mapEntries.getValueClass().getTextContent());
+
+ MapEntryType mapEntry =
+ (MapEntryType) FacesConfigModelUtil
+ .findEObjectElementById(mapEntries.getMapEntry(), "mapPropertyEntryWithValue");
+ assertNotNull(mapEntry);
+ assertEquals("propertyMapKey1"
+ , mapEntry.getKey().getTextContent());
+ assertEquals("propertyMapValue1"
+ , mapEntry.getValue().getTextContent());
+ assertNull(mapEntry.getNullValue());
+ mapEntry =
+ (MapEntryType) FacesConfigModelUtil
+ .findEObjectElementById(mapEntries.getMapEntry(), "mapPropertyEntryWithNullValue");
+ assertNotNull(mapEntry);
+ assertEquals("propertyMapKey2"
+ , mapEntry.getKey().getTextContent());
+ assertNotNull(mapEntry.getNullValue());
+ assertNull(mapEntry.getValue());
+
+ assertNull(property.getNullValue());
+ assertNull(property.getValue());
+ assertNull(property.getListEntries());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testListValueManagedProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedPropertyType property =
+ getManagedProperty("managedBeanListProperty"
+ , edit.getFacesConfig());
+ assertNotNull(property);
+
+ assertEquals("list-bean-name"
+ , property.getPropertyName().getTextContent());
+ assertEquals("list-bean-class"
+ , property.getPropertyClass().getTextContent());
+ assertNotNull(property.getListEntries());
+
+ ListEntriesType listEntries = property.getListEntries();
+ assertEquals(1, listEntries.getValue().size());
+ assertEquals(1, listEntries.getNullValue().size());
+
+ ValueType valueType =
+ (ValueType) FacesConfigModelUtil
+ .findEObjectElementById(listEntries.getValue()
+ , "managedBeanListProperty_value");
+
+ assertEquals("managedBeanListPropertyValue",
+ valueType.getTextContent());
+
+ assertNull(property.getNullValue());
+ assertNull(property.getValue());
+ assertNull(property.getMapEntries());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanTestCase.java
new file mode 100644
index 0000000..a329550
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadManagedBeanTestCase.java
@@ -0,0 +1,246 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntryType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the managed-bean which is one of
+ * many items inside the root elemnt faces-config in the configuration
+ * information hierarchy of the faces-config.xml file
+ *
+ */
+public class ReadManagedBeanTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadManagedBeanTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ *Test to see if there is at least one managed-bean.
+ *This should be specified in the file for reading (faces-config)
+ */
+ public void testManagedBean() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertNotNull(getManagedBean("managedBean1", edit.getFacesConfig()));
+ assertNotNull(getManagedBean("mapBean1", edit.getFacesConfig()));
+ assertNotNull(getManagedBean("listBean1", edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ManagedBeanType getManagedBean(String name, FacesConfigType facesConfig)
+ {
+ return (ManagedBeanType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getManagedBean(), name);
+ }
+
+ // Test for the Descirption
+ public void testDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ final ManagedBeanType managedBean1 =
+ getManagedBean("managedBean1", edit.getFacesConfig());
+
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil
+ .findEObjectElementById(managedBean1.getDescription()
+ , "managedBean1Description");
+ assertNotNull(descType);
+ assertEquals("managed-bean-description", descType.getTextContent());
+
+ DisplayNameType displayName =
+ (DisplayNameType) FacesConfigModelUtil
+ .findEObjectElementById(managedBean1.getDisplayName()
+ , "managedBean1DisplayName");
+ assertNotNull(displayName);
+ assertEquals("managed-bean-display-name"
+ , displayName.getTextContent());
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById(managedBean1.getIcon()
+ , "managedBean1Icon");
+ assertNotNull(iconType);
+ assertEquals("managedBean1-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("managedBean1-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * Check for a managed-bean-class
+ */
+ public void testSingleValuedProperties() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ {
+ final ManagedBeanType managedBean1 =
+ getManagedBean("managedBean1", edit.getFacesConfig());
+
+ assertEquals("managed-bean-name",
+ managedBean1.getManagedBeanName().getTextContent());
+ assertEquals("managed-bean-class",
+ managedBean1.getManagedBeanClass().getTextContent());
+ assertEquals("request",
+ managedBean1.getManagedBeanScope().getTextContent());
+ }
+
+ {
+ final ManagedBeanType mapBean1 =
+ getManagedBean("mapBean1", edit.getFacesConfig());
+
+ assertEquals("mapBean1",
+ mapBean1.getManagedBeanName().getTextContent());
+ assertEquals("mapBean1-class",
+ mapBean1.getManagedBeanClass().getTextContent());
+ assertEquals("mapBean1-scope",
+ mapBean1.getManagedBeanScope().getTextContent());
+ }
+
+ {
+ final ManagedBeanType listBean1 =
+ getManagedBean("listBean1", edit.getFacesConfig());
+
+ assertEquals("listBean1",
+ listBean1.getManagedBeanName().getTextContent());
+ assertEquals("listBean1-class",
+ listBean1.getManagedBeanClass().getTextContent());
+ assertEquals("listBean1-scope",
+ listBean1.getManagedBeanScope().getTextContent());
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testMapBeanProperties()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedBeanType bean =
+ getManagedBean("mapBean1"
+ , edit.getFacesConfig());
+ assertNotNull(bean);
+
+ MapEntriesType mapEntries = bean.getMapEntries();
+
+ assertEquals("mapBeanEntryKey",
+ mapEntries.getKeyClass().getTextContent());
+ assertEquals("mapBeanEntryValueClass",
+ mapEntries.getValueClass().getTextContent());
+
+ MapEntryType mapEntry =
+ (MapEntryType) FacesConfigModelUtil
+ .findEObjectElementById(mapEntries.getMapEntry(), "mapBeanEntryWithValue");
+ assertNotNull(mapEntry);
+ assertEquals("mapBeanKey1"
+ , mapEntry.getKey().getTextContent());
+ assertEquals("mapBeanValue1"
+ , mapEntry.getValue().getTextContent());
+ assertNull(mapEntry.getNullValue());
+
+ mapEntry =
+ (MapEntryType) FacesConfigModelUtil
+ .findEObjectElementById(mapEntries.getMapEntry(), "mapBeanEntryWithNullValue");
+ assertNotNull(mapEntry);
+ assertEquals("mapBeanKey2"
+ , mapEntry.getKey().getTextContent());
+ assertNotNull(mapEntry.getNullValue());
+ assertNull(mapEntry.getValue());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testListBeanProperties()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedBeanType bean =
+ getManagedBean("listBean1"
+ , edit.getFacesConfig());
+ assertNotNull(bean);
+
+ ListEntriesType listEntries = bean.getListEntries();
+
+ assertEquals("listBeanListPropertyClass",
+ listEntries.getValueClass().getTextContent());
+ assertEquals(1, listEntries.getValue().size());
+ assertEquals(1, listEntries.getNullValue().size());
+
+ ValueType valueType =
+ (ValueType) FacesConfigModelUtil
+ .findEObjectElementById(listEntries.getValue()
+ , "listBeanListProperty_value");
+ assertNotNull(valueType);
+ assertEquals("listBeanListPropertyValue", valueType.getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadNavigationRuleTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadNavigationRuleTestCase.java
new file mode 100644
index 0000000..38e8789
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadNavigationRuleTestCase.java
@@ -0,0 +1,320 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the FacesConfigFactoryImpl
+ * class.
+ *
+ */
+
+
+public class ReadNavigationRuleTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadNavigationRuleTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the existence of at least
+ * one navigation-rule
+ */
+ public void testSingleNavigationRule() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Verify that display is populated
+ */
+ public void testDisplayName()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit);
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+ NavigationRuleType navRule =
+ FacesConfigModelUtil.
+ findNavigationHandlerRuleByDisplayName(navRules, "display name 1");
+ assertNotNull(navRule);
+
+ // verify that xml:lang's are being populated
+ navRule = FacesConfigModelUtil.
+ findNavigationHandlerRuleByDescriptionText(navRules,
+ "A navigation rule with lang attributes");
+ assertNotNull(navRule);
+
+ DisplayNameType displayNameType = FacesConfigModelUtil.
+ findDisplayNameType(navRule.getDisplayName(), "English Display Name");
+ assertNotNull(displayNameType);
+ assertEquals("en", displayNameType.getLang());
+
+ displayNameType = FacesConfigModelUtil.
+ findDisplayNameType(navRule.getDisplayName(), "Nom D'Affichage De Français");
+ assertNotNull(displayNameType);
+ assertEquals("fr", displayNameType.getLang());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ // Test for the Descirption
+
+ public void testNonEmptyDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit);
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+ NavigationRuleType navRule =
+ FacesConfigModelUtil.
+ findNavigationHandlerRuleByDescriptionText(navRules,
+ "Descri 1");
+ assertNotNull(navRule);
+
+ // verify that xml:lang's are being populated
+ navRule = FacesConfigModelUtil.
+ findNavigationHandlerRuleByDescriptionText(navRules,
+ "A navigation rule with lang attributes");
+ assertNotNull(navRule);
+
+ DescriptionType descType = FacesConfigModelUtil.
+ findDescriptionType(navRule.getDescription(), "A navigation rule with lang attributes");
+ assertNotNull(descType);
+ assertEquals("en", descType.getLang());
+
+ descType = FacesConfigModelUtil.
+ findDescriptionType(navRule.getDescription(), "What color is it?");
+ assertNotNull(descType);
+ assertEquals("en-US", descType.getLang());
+
+ descType = FacesConfigModelUtil.
+ findDescriptionType(navRule.getDescription(), "What colour is it?");
+ assertNotNull(descType);
+ assertEquals("en-GB", descType.getLang());
+
+ descType = FacesConfigModelUtil.
+ findDescriptionType(navRule.getDescription(), "Quelle couleur est lui?");
+ assertNotNull(descType);
+ assertEquals("fr", descType.getLang());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Test for the exisence of navigation-cases
+ */
+
+ public void testNonEmptyNavigationCases() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+
+ // test first navigation rule
+ NavigationRuleType navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "display name 1");
+ assertNotNull(navRule);
+
+ assertEquals(2, navRule.getNavigationCase().size());
+ NavigationCaseType navCase = FacesConfigModelUtil.
+ findNavigationCaseByDisplayName(navRule.getNavigationCase(),
+ "what display name");
+ assertNotNull(navCase);
+
+ assertNotNull(navCase.getFromAction());
+ assertEquals("#{from-action}", navCase.getFromAction().getTextContent());
+
+ assertNotNull(navCase.getFromOutcome());
+ assertEquals("drilldown", navCase.getFromOutcome().getTextContent());
+
+ assertNotNull(navCase.getToViewId());
+ assertEquals("/edit.jsp", navCase.getToViewId().getTextContent());
+
+ assertNotNull(navCase.getRedirect());
+
+
+ navCase = FacesConfigModelUtil.
+ findNavigationCaseByDisplayName(navRule.getNavigationCase(),
+ "second navigation case");
+ assertNotNull(navCase);
+
+
+ assertNotNull(navCase.getFromAction());
+ assertEquals("action2", navCase.getFromAction().getTextContent());
+
+ assertNotNull(navCase.getFromOutcome());
+ assertEquals("outcome2", navCase.getFromOutcome().getTextContent());
+
+ assertNotNull(navCase.getToViewId());
+ assertEquals("/edit2.jsp", navCase.getToViewId().getTextContent());
+
+ assertNull(navCase.getRedirect());
+
+ // test second navigation rule
+ navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "English Display Name");
+ assertNotNull(navRule);
+
+ navCase = FacesConfigModelUtil.
+ findNavigationCaseByDisplayName(navRule.getNavigationCase(),
+ "second navigation rule navcase");
+ assertNotNull(navCase);
+
+ assertNotNull(navCase.getFromAction());
+ assertEquals("action3", navCase.getFromAction().getTextContent());
+
+ assertNotNull(navCase.getFromOutcome());
+ assertEquals("outcome3", navCase.getFromOutcome().getTextContent());
+
+ assertNotNull(navCase.getToViewId());
+ assertEquals("/edit3.jsp", navCase.getToViewId().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+ /*
+ * assert the existence of icon
+ */
+
+ public void testNonEmptyIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+ NavigationRuleType navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "display name 1");
+
+ assertNotNull(navRule);
+ EList icons = navRule.getIcon();
+ assertEquals(1, icons.size());
+ IconType iconType = (IconType) icons.get(0);
+ assertNotNull(iconType.getSmallIcon());
+ assertEquals("myicon", iconType.getSmallIcon().getTextContent());
+ assertNull(iconType.getLargeIcon());
+
+ navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "English Display Name");
+ assertNotNull(navRule);
+
+ icons = navRule.getIcon();
+ assertEquals(2, icons.size());
+
+ IconType icon =
+ FacesConfigModelUtil.
+ findIconTypeByLang(icons, null);
+ assertNotNull(icon);
+ assertNotNull(icon.getSmallIcon());
+ assertEquals("small-icon", icon.getSmallIcon().getTextContent());
+ assertNotNull(icon.getLargeIcon());
+ assertEquals("large-icon", icon.getLargeIcon().getTextContent());
+
+ icon = FacesConfigModelUtil.
+ findIconTypeByLang(icons, "en");
+ assertNotNull(icon);
+ assertNotNull(icon.getSmallIcon());
+ assertEquals("en_small-icon", icon.getSmallIcon().getTextContent());
+ assertNotNull(icon.getLargeIcon());
+ assertEquals("en_large-icon", icon.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testFromViewIdType()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ EList navRules = edit.getFacesConfig().getNavigationRule();
+ assertTrue(!navRules.isEmpty());
+ NavigationRuleType navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "display name 1");
+ assertNotNull(navRule);
+ assertEquals("/Page1.jsp",navRule.getFromViewId().getTextContent());
+
+ navRule =
+ FacesConfigModelUtil
+ .findNavigationHandlerRuleByDisplayName
+ (navRules, "English Display Name");
+ assertNotNull(navRule);
+ assertEquals("/Page1.jsp",navRule.getFromViewId().getTextContent());
+ }
+ finally
+ {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyComponentTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyComponentTestCase.java
new file mode 100644
index 0000000..a92a29a
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyComponentTestCase.java
@@ -0,0 +1,267 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/**
+ * Test component property
+ *
+ * @author cbateman
+ *
+ */
+public class ReadPropertyComponentTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadPropertyComponentTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType attribute1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(attribute1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+
+ }
+
+ private ComponentType getComponent1(FacesConfigType facesConfigType)
+ {
+ return (ComponentType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getComponent(), "component1");
+ }
+
+ private PropertyType getProperty1(FacesConfigType facesConfigType)
+ {
+ ComponentType component1 = getComponent1(facesConfigType);
+ assertNotNull(component1);
+ return (PropertyType) FacesConfigModelUtil
+ .findEObjectElementById
+ (component1.getProperty(), "componentProperty1");
+ }
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDescription()
+ ,"componentProperty1_descripton1");
+ assertEquals("myDescript blah blah"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDisplayName()
+ ,"componentProperty1_displayName1");
+ assertEquals("Component Property 1"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType = getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (propertyType.getIcon(), "componentProperty1_icon1");
+ assertNotNull(iconType);
+
+ assertEquals("property-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("property-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testPropertyNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType property1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(property1);
+
+ assertEquals("property1"
+ ,property1.getPropertyName().getTextContent());
+ assertEquals("ComponentProperty"
+ ,property1.getPropertyClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("suggestedValue"
+ ,propertyType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("defaultValue6"
+ , propertyType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+// public void testPropertyExtension() {
+// FacesConfigArtifactEdit edit = null;
+// try {
+// edit = FacesConfigArtifactEdit
+// .getFacesConfigArtifactEditForRead(project);
+// if (edit.getFacesConfig() != null) {
+// EList comp = edit.getFacesConfig().getComponent();
+// assertTrue(!comp.isEmpty());
+// for (int i = 0; i < comp.size(); i++) {
+// ComponentType compType = (ComponentType) comp
+// .get(i);
+// assertTrue(!compType.getAttribute().isEmpty());
+//
+// EList attr = compType.getAttribute();
+// for (int k = 0; k < attr.size(); k++) {
+// AttributeType attrType = (AttributeType) attr.get(k);
+// EList ext= attrType.getAttributeExtension();
+// assertTrue(ext.size()!=0);
+// System.out.println("The size of attribute-extension is >>?? " + ext.size() );
+// }
+// }
+// }
+// } finally {
+// if (edit != null) {
+// edit.dispose();
+// }
+// }
+// }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyConverterTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyConverterTestCase.java
new file mode 100644
index 0000000..bbcf1ad
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyConverterTestCase.java
@@ -0,0 +1,267 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/**
+ * Tests the property on a converter
+ *
+ * @author cbateman
+ */
+public class ReadPropertyConverterTestCase extends TestCase
+{
+ IProject project = null;
+
+ public ReadPropertyConverterTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType property1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(property1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ConverterType getConverter1(FacesConfigType facesConfigType)
+ {
+ return (ConverterType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getConverter(), "converter1");
+ }
+
+ private PropertyType getProperty1(FacesConfigType facesConfigType)
+ {
+ ConverterType converter1 = getConverter1(facesConfigType);
+ assertNotNull(converter1);
+
+ return (PropertyType) FacesConfigModelUtil
+ .findEObjectElementById
+ (converter1.getProperty(), "converter1Property");
+ }
+
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDescription()
+ ,"converter1_property_description");
+ assertEquals("converter-property-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDisplayName()
+ ,"converter1_property_display-name");
+ assertEquals("converter-property-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType = getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (propertyType.getIcon(), "converter1_property_icon");
+ assertNotNull(iconType);
+
+ assertEquals("converter1-property-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("converter1-property-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testPropertyNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType property1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(property1);
+
+ assertEquals("converter-property-name"
+ ,property1.getPropertyName().getTextContent());
+ assertEquals("converter-property-propertyClass"
+ ,property1.getPropertyClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("converter-property-suggested-value"
+ ,propertyType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("converter-property-default-value"
+ , propertyType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+// public void testPropertyExtension() {
+// FacesConfigArtifactEdit edit = null;
+// try {
+// edit = FacesConfigArtifactEdit
+// .getFacesConfigArtifactEditForRead(project);
+// if (edit.getFacesConfig() != null) {
+// EList comp = edit.getFacesConfig().getComponent();
+// assertTrue(!comp.isEmpty());
+// for (int i = 0; i < comp.size(); i++) {
+// ComponentType compType = (ComponentType) comp
+// .get(i);
+// assertTrue(!compType.getAttribute().isEmpty());
+//
+// EList attr = compType.getAttribute();
+// for (int k = 0; k < attr.size(); k++) {
+// AttributeType attrType = (AttributeType) attr.get(k);
+// EList ext= attrType.getAttributeExtension();
+// assertTrue(ext.size()!=0);
+// System.out.println("The size of attribute-extension is >>?? " + ext.size() );
+// }
+// }
+// }
+// } finally {
+// if (edit != null) {
+// edit.dispose();
+// }
+// }
+// }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyValidatorTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyValidatorTestCase.java
new file mode 100644
index 0000000..355d1c7
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadPropertyValidatorTestCase.java
@@ -0,0 +1,261 @@
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class ReadPropertyValidatorTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadPropertyValidatorTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testProperty()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType property1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(property1);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+
+ }
+
+ private ValidatorType getValidator1(FacesConfigType facesConfigType)
+ {
+ return (ValidatorType) FacesConfigModelUtil
+ .findEObjectElementById
+ (facesConfigType.getValidator(), "validator1");
+ }
+
+ private PropertyType getProperty1(FacesConfigType facesConfigType)
+ {
+ ValidatorType validator1 = getValidator1(facesConfigType);
+ assertNotNull(validator1);
+ return (PropertyType) FacesConfigModelUtil
+ .findEObjectElementById
+ (validator1.getProperty(), "validator1_property");
+ }
+ /*
+ * This is to test the description child inside of Attribute
+ *
+ */
+
+ public void testDescription() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ DescriptionType descType =
+ (DescriptionType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDescription()
+ ,"validator1_property_description");
+ assertEquals("validator-property-description"
+ , descType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * A simple test to check if the Display Name is present
+ * within the faces-config.xml file
+ */
+
+ public void testDisplayName() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ final DisplayNameType displayNameType =
+ (DisplayNameType)FacesConfigModelUtil.findEObjectElementById
+ (propertyType.getDisplayName()
+ ,"validator1_property_displayName");
+ assertEquals("validator-property-display-name"
+ , displayNameType.getTextContent().trim());
+ }
+ finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks to see if there is an icon defined
+ *
+ */
+ public void testIcon() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType = getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById
+ (propertyType.getIcon(), "validator1_property_icon");
+ assertNotNull(iconType);
+
+ assertEquals("validator-property-small-icon",
+ iconType.getSmallIcon().getTextContent());
+ assertEquals("validator-property-large-icon",
+ iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of two items.
+ * They are the required items by all renderers
+ * They are : attribute-name and attribute-class.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for each of them.
+ *Simply, extract the names and check if same the one
+ *in faces-config.xml
+ */
+ public void testPropertyNameAndClass() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType property1 = getProperty1(edit.getFacesConfig());
+ assertNotNull(property1);
+
+ assertEquals("validator-property-name"
+ ,property1.getPropertyName().getTextContent());
+ assertEquals("validator-property-class"
+ ,property1.getPropertyClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * Checks for the item suggested-value within attribute
+ *
+ */
+ public void testSuggestedValue() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("validator property suggested value"
+ ,propertyType.getSuggestedValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testDefaultValue()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ PropertyType propertyType =
+ getProperty1(edit.getFacesConfig());
+ assertNotNull(propertyType);
+
+ assertEquals("validator property default value"
+ , propertyType.getDefaultValue().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks for the item attribute-extension within attribute
+ * TODO: not currently supported
+ */
+// public void testPropertyExtension() {
+// FacesConfigArtifactEdit edit = null;
+// try {
+// edit = FacesConfigArtifactEdit
+// .getFacesConfigArtifactEditForRead(project);
+// if (edit.getFacesConfig() != null) {
+// EList comp = edit.getFacesConfig().getComponent();
+// assertTrue(!comp.isEmpty());
+// for (int i = 0; i < comp.size(); i++) {
+// ComponentType compType = (ComponentType) comp
+// .get(i);
+// assertTrue(!compType.getAttribute().isEmpty());
+//
+// EList attr = compType.getAttribute();
+// for (int k = 0; k < attr.size(); k++) {
+// AttributeType attrType = (AttributeType) attr.get(k);
+// EList ext= attrType.getAttributeExtension();
+// assertTrue(ext.size()!=0);
+// System.out.println("The size of attribute-extension is >>?? " + ext.size() );
+// }
+// }
+// }
+// } finally {
+// if (edit != null) {
+// edit.dispose();
+// }
+// }
+// }
+
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadReferencedBeanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadReferencedBeanTestCase.java
new file mode 100644
index 0000000..fcdb3d5
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadReferencedBeanTestCase.java
@@ -0,0 +1,139 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+/*
+ * This Junit class is used to test the referenced-bean which is one of
+ * many items inside the root elemnt faces-config in the configuration
+ * information hierarchy of the faces-config.xml file
+ *
+ */
+public class ReadReferencedBeanTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadReferencedBeanTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * check for the existence of referenced-bean with in
+ * the root element - faces-config. There should be at least
+ * one of such kind (item)
+ */
+ public void testSingleReferncedBean() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ assertNotNull(getReferencedBean1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ReferencedBeanType getReferencedBean1(FacesConfigType facesConfig)
+ {
+ return (ReferencedBeanType)
+ FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getReferencedBean()
+ , "referencedBean1");
+ }
+
+ // Test for the Descirption
+ public void testDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ReferencedBeanType referencedBean =
+ getReferencedBean1(edit.getFacesConfig());
+ assertNotNull(referencedBean);
+
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil
+ .findEObjectElementById(referencedBean.getDescription()
+ , "referencedBean1Description");
+ assertNotNull(descType);
+ assertEquals("Referenced Bean Desc", descType.getTextContent());
+
+ DisplayNameType displayName =
+ (DisplayNameType) FacesConfigModelUtil
+ .findEObjectElementById(referencedBean.getDisplayName()
+ , "referencedBean1DisplayName");
+ assertNotNull(displayName);
+ assertEquals("referenced-bean-display"
+ , displayName.getTextContent());
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById(referencedBean.getIcon()
+ , "referencedBean1Icon");
+ assertNotNull(iconType);
+ assertEquals("referenced-bean-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("referenced-bean-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+ /*
+ * check for refrenced-bean-name
+ */
+ public void testSingleValuedProperties(){
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ReferencedBeanType referencedBean =
+ getReferencedBean1(edit.getFacesConfig());
+ assertNotNull(referencedBean);
+
+ assertEquals("referenced-bean-name"
+ ,referencedBean.getReferencedBeanName().getTextContent().trim());
+ assertEquals("referenced-bean-class"
+ ,referencedBean.getReferencedBeanClass().getTextContent().trim());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRenderKitTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRenderKitTestCase.java
new file mode 100644
index 0000000..0ef5c2b
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRenderKitTestCase.java
@@ -0,0 +1,159 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the render which is one of
+ * many items inside the root elemnt faces-config in the configuration
+ * information hierarchy of the faces-config.xml file
+ *
+ */
+public class ReadRenderKitTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadRenderKitTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ *Test to see if there is at least one render-kit.
+ *This should be specified in the file for reading (faces-config)
+ */
+ public void testSingleRenderKit() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ assertNotNull(getRenderKit1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private RenderKitType getRenderKit1(FacesConfigType facesConfig)
+ {
+ return (RenderKitType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getRenderKit(), "renderKit1");
+ }
+
+ // Test for the Descirption
+ public void testDescriptionGroup()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RenderKitType renderKit = getRenderKit1(edit.getFacesConfig());
+ assertNotNull(renderKit);
+
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getDescription()
+ , "renderKit1Description");
+ assertNotNull(descType);
+ assertEquals("Render kit Desc", descType.getTextContent());
+
+ DisplayNameType displayName =
+ (DisplayNameType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getDisplayName()
+ , "renderKit1DisplayName");
+ assertNotNull(displayName);
+ assertEquals("Render kit disp name"
+ , displayName.getTextContent());
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getIcon()
+ , "renderKit1Icon");
+ assertNotNull(iconType);
+ assertEquals("small-renderkit-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("large-renderkit-icon"
+ , iconType.getLargeIcon().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * chech for hte render-kit-id element
+ */
+
+ public void testSingleValuedProperties() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RenderKitType renderKit = getRenderKit1(edit.getFacesConfig());
+ assertNotNull(renderKit);
+
+ assertEquals("render-kit-Id"
+ ,renderKit.getRenderKitId().getTextContent());
+ assertEquals("render-kit-class"
+ ,renderKit.getRenderKitClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Checks to see if there is at least one renderer
+ * Note: testing of the renderer is done in ReadRendererTestCase
+ */
+ public void testRenderer() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ RenderKitType renderKit = getRenderKit1(edit.getFacesConfig());
+ assertNotNull(renderKit);
+
+ assertEquals(1, renderKit.getRenderer().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+
+ }
+
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRendererTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRendererTestCase.java
new file mode 100644
index 0000000..8b6c237
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadRendererTestCase.java
@@ -0,0 +1,228 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the for the existence of
+ * renderer
+ */
+public class ReadRendererTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadRendererTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * Check to see if there at least one Renderer in place
+ */
+ public void testSingleRenderer() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ assertNotNull(getRenderer1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private RendererType getRenderer1(FacesConfigType facesConfig)
+ {
+ RenderKitType renderKitType =
+ (RenderKitType) FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getRenderKit()
+ , "renderKit1");
+ assertNotNull(renderKitType);
+
+ return
+ (RendererType) FacesConfigModelUtil
+ .findEObjectElementById(renderKitType.getRenderer()
+ , "renderKit1Renderer");
+ }
+
+ /*
+ * check for Description. It simply checks to see if there is at least
+ * one such item
+ *
+ */
+
+ public void testDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RendererType renderKit = getRenderer1(edit.getFacesConfig());
+ assertNotNull(renderKit);
+
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getDescription()
+ , "renderKit1RendererDescription");
+ assertNotNull(descType);
+ assertEquals("my renderer description", descType.getTextContent());
+
+ DisplayNameType displayName =
+ (DisplayNameType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getDisplayName()
+ , "renderKit1RendererDisplayName");
+ assertNotNull(displayName);
+ assertEquals("my renderer display name"
+ , displayName.getTextContent());
+
+ IconType iconType =
+ (IconType) FacesConfigModelUtil
+ .findEObjectElementById(renderKit.getIcon()
+ , "renderKit1RendererIcon");
+ assertNotNull(iconType);
+ assertEquals("renderer-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("renderer-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * This one tests for the existence of three items
+ * They are the required items by all renderers
+ * They are : renderer-type, renderer-class and component-family.
+ * It thought it was better to put them together instead of
+ * writing single -separate methods for all of them.
+ */
+ public void testStringForRequiredEntries() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RendererType renderer = getRenderer1(edit.getFacesConfig());
+ assertNotNull(renderer);
+
+ assertEquals("renderer-type"
+ , renderer.getRendererType().getTextContent());
+ assertEquals("renderer-class"
+ , renderer.getRendererClass().getTextContent());
+ assertEquals("component-family"
+ ,renderer.getComponentFamily().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Basic check. See ReadAttributeRendererTestCase for detailed
+ * testing
+ */
+ public void testAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RendererType renderer = getRenderer1(edit.getFacesConfig());
+ assertNotNull(renderer);
+
+ assertEquals(1, renderer.getAttribute().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testFacet()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ RendererType renderer = getRenderer1(edit.getFacesConfig());
+ assertNotNull(renderer);
+
+ assertEquals(1, renderer.getFacet().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /*
+ * check for Renderer-Extension. It simply checks to see if there is at least
+ * one such item
+ *
+ */
+
+ public void testRendererExtension() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ if (edit.getFacesConfig() != null) {
+ EList renderKit = edit.getFacesConfig().getRenderKit();
+ assertTrue(!renderKit.isEmpty());
+ for (int i = 0; i < renderKit.size(); i++) {
+ RenderKitType rendererType = (RenderKitType) renderKit
+ .get(i);
+ assertTrue(!rendererType.getRenderer().isEmpty());
+ EList rend = rendererType.getRenderer();
+ for (int k = 0; k < rend.size(); k++) {
+ RendererType rendType = (RendererType) rend.get(k);
+ EList ext= rendType.getRendererExtension();
+ assertTrue(ext.size()!=0);
+ }
+ }
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadValidatorTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadValidatorTestCase.java
new file mode 100644
index 0000000..74f22a8
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/read/ReadValidatorTestCase.java
@@ -0,0 +1,176 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.read;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.FacesConfigModelUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the validator which is one of
+ * many items inside the root elemnt faces-config in the configuration
+ * information hierarchy of the faces-config.xml file
+ *
+ */
+public class ReadValidatorTestCase extends TestCase {
+ IProject project = null;
+
+ public ReadValidatorTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ /*
+ * The following method is used to test for the empty navigation rule. Since
+ * I am supplying a single faces-config.xml file as a testing file, I had to
+ * testcases fit in to it by controlling the conditions
+ *
+ */
+ public void testSingleValidator() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ assertNotNull(getValidator1(edit.getFacesConfig()));
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ValidatorType getValidator1(FacesConfigType facesConfig)
+ {
+ return (ValidatorType)
+ FacesConfigModelUtil
+ .findEObjectElementById(facesConfig.getValidator(), "validator1");
+ }
+
+ // Test for the Descirption
+ public void testDescriptionGroup() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+ ValidatorType validator1 = getValidator1(edit.getFacesConfig());
+ assertNotNull(validator1);
+
+ // test descriptioni
+ {
+ DescriptionType descType =
+ (DescriptionType) FacesConfigModelUtil.findEObjectElementById
+ (validator1.getDescription(), "validator1_description");
+ assertEquals("validator-description"
+ , descType.getTextContent());
+ }
+ // test displayname
+ {
+ DisplayNameType displayNameType =
+ (DisplayNameType) FacesConfigModelUtil.findEObjectElementById
+ (validator1.getDisplayName(), "validator1_displayName");
+ assertEquals("validator-display-name"
+ , displayNameType.getTextContent());
+ }
+ // test icon
+ {
+ IconType iconType =
+ (IconType) FacesConfigModelUtil.findEObjectElementById
+ (validator1.getIcon(), "validator1_icon");
+ assertEquals("validator-small-icon"
+ , iconType.getSmallIcon().getTextContent());
+ assertEquals("validator-large-icon"
+ , iconType.getLargeIcon().getTextContent());
+ }
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testValidatorSingleValueProperties() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ValidatorType validator1 = getValidator1(edit.getFacesConfig());
+ assertNotNull(validator1);
+
+ assertEquals("validator-Id", validator1.getValidatorId().getTextContent());
+ assertEquals("validator-class", validator1.getValidatorClass().getTextContent());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+
+
+ /**
+ * Test the attribute sub-property of validators.
+ * Note: the attribute itself is tested in ReadAttributeValidatorTestCase
+ * this test case just tests the presence of the attribute
+ */
+ public void testAttribute() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ValidatorType validator = getValidator1(edit.getFacesConfig());
+ assertEquals(1, validator.getAttribute().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ /**
+ * Test the property sub-property of validators
+ * Note: the attribute itself is tested in ReadPropertyValidatorTestCase
+ * this test case just tests for the presence of the property
+ */
+ public void testProperty() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit
+ .getFacesConfigArtifactEditForRead(project);
+ assertNotNull(edit.getFacesConfig());
+
+ ValidatorType validator = getValidator1(edit.getFacesConfig());
+ assertEquals(1, validator.getProperty().size());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/CommonStructuresUtil.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/CommonStructuresUtil.java
new file mode 100644
index 0000000..aae9e65
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/CommonStructuresUtil.java
@@ -0,0 +1,654 @@
+package org.eclipse.jst.jsf.facesconfig.tests.util;
+
+import junit.framework.TestCase;
+
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.DefaultValueType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.KeyClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.KeyType;
+import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntryType;
+import org.eclipse.jst.jsf.facesconfig.emf.NullValueType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
+import org.eclipse.jst.jsf.facesconfig.emf.SuggestedValueType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValueClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
+
+/**
+ * Provides utility methods to quickly create and match common structures using
+ * a specific prefix
+ *
+ */
+public final class CommonStructuresUtil extends TestCase {
+ private static final String TEST_SANITY = "testSanity";
+ private final static FacesConfigPackage _facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ private final static FacesConfigFactory _facesConfigFactory = _facesConfigPackage
+ .getFacesConfigFactory();
+
+ public static final String ID = "id";
+ public static final String LANG = "lang";
+ public static final String NAME = "name";
+ public static final String CLASS = "class";
+ public static final String VALUE = "value";
+ private static final String KEY = "key";
+
+ private static final String DESCRIPTION_VALUE = "description";
+ private static final String DISPLAY_VALUE = "displayValue";
+ private static final String ICON = "icon";
+ private static final String SMALL_ICON = createPreficedString("small", ICON);
+ private static final String LARGE_ICON = createPreficedString("large", ICON);;
+
+ private static final String SUGGESTED_VALUE = createPreficedString(
+ "suggested", VALUE);
+ private static final String DEFAULT_VALUE = createPreficedString("default",
+ VALUE);;
+
+ private static final String ATTRIBUTE = "attribute";
+ private static final String ATTRIBUTE_NAME = createPreficedString(
+ ATTRIBUTE, NAME);
+ private static final String ATTRIBUTE_CLASS = createPreficedString(
+ ATTRIBUTE, CLASS);
+
+ private static final String PROPERTY = "property";
+ private static final String PROPERTY_NAME = createPreficedString(PROPERTY,
+ NAME);
+ private static final String PROPERTY_CLASS = createPreficedString(PROPERTY,
+ CLASS);
+
+ private static final String FACET = "facet";
+ private static final String FACET_NAME = createPreficedString(FACET, NAME);
+
+ private static final String MANAGED_PROPERTY = "managed-property";
+ private static final String MAP_ENTRIES = "map-entries";
+ private static final String MAP_ENTRIES_KEY_CLASS =
+ createPreficedString(MAP_ENTRIES, "key-class");
+ private static final String MAP_ENTRIES_VALUE_CLASS =
+ createPreficedString(MAP_ENTRIES, "value-class");
+ private static final String MAP_ENTRY = "map-entry";
+
+ private static final String LIST_ENTRIES = "list-entries";
+ private static final String LIST_ENTRIES_VALUE_CLASS =
+ createPreficedString(LIST_ENTRIES, "value-class");
+
+ public static DescriptionType createDescription(final String prefix) {
+ DescriptionType description = _facesConfigFactory
+ .createDescriptionType();
+ description.setTextContent(createPreficedString(prefix,
+ DESCRIPTION_VALUE));
+ description.setId(createPreficedString(prefix, ID));
+ description.setLang(createPreficedString(prefix, LANG));
+ return description;
+ }
+
+ public static void assertMatchesDescription(String prefix,
+ DescriptionType description) {
+ assertEquals(createPreficedString(prefix, DESCRIPTION_VALUE),
+ description.getTextContent());
+ assertEquals(createPreficedString(prefix, ID), description.getId());
+ assertEquals(createPreficedString(prefix, LANG), description.getLang());
+ }
+
+ public static DisplayNameType createDisplayName(final String prefix) {
+ DisplayNameType displayName = _facesConfigFactory
+ .createDisplayNameType();
+ displayName.setTextContent(createPreficedString(prefix, DISPLAY_VALUE));
+ displayName.setId(createPreficedString(prefix, ID));
+ displayName.setLang(createPreficedString(prefix, LANG));
+ return displayName;
+ }
+
+ public static void assertMatchesDisplayName(String prefix,
+ DisplayNameType displayName) {
+ assertEquals(createPreficedString(prefix, DISPLAY_VALUE), displayName
+ .getTextContent());
+ assertEquals(createPreficedString(prefix, ID), displayName.getId());
+ assertEquals(createPreficedString(prefix, LANG), displayName.getLang());
+ }
+
+ public static IconType createIcon(final String prefix) {
+ IconType iconType = _facesConfigFactory.createIconType();
+ iconType.setId(createPreficedString(prefix, createPreficedString(ICON,
+ ID)));
+ iconType.setLang(createPreficedString(prefix, LANG));
+ SmallIconType smallIconType = _facesConfigFactory.createSmallIconType();
+ smallIconType.setTextContent(createPreficedString(prefix, SMALL_ICON));
+
+ LargeIconType largeIconType = _facesConfigFactory.createLargeIconType();
+ largeIconType.setTextContent(createPreficedString(prefix, LARGE_ICON));
+
+ iconType.setSmallIcon(smallIconType);
+ iconType.setLargeIcon(largeIconType);
+ return iconType;
+ }
+
+ public static void assertMatchesIcon(final String prefix,
+ final IconType iconType) {
+ assertEquals(createPreficedString(prefix,
+ createPreficedString(ICON, ID)), iconType.getId());
+ assertEquals(createPreficedString(prefix, LANG), iconType.getLang());
+
+ SmallIconType smallIconType = iconType.getSmallIcon();
+ assertEquals(createPreficedString(prefix, SMALL_ICON), smallIconType
+ .getTextContent());
+
+ LargeIconType largeIconType = iconType.getLargeIcon();
+ assertEquals(createPreficedString(prefix, LARGE_ICON), largeIconType
+ .getTextContent());
+ }
+
+ public static AttributeType createAttribute(String prefix) {
+ final String ATTRIBUTE_PREFIX = createPreficedString(prefix, ATTRIBUTE);
+
+ AttributeType attrType = _facesConfigFactory.createAttributeType();
+
+ attrType.getDescription().add(createDescription(ATTRIBUTE_PREFIX));
+ attrType.getDisplayName().add(createDisplayName(ATTRIBUTE_PREFIX));
+ attrType.getIcon().add(createIcon(ATTRIBUTE_PREFIX));
+
+ AttributeNameType attributeNameType = _facesConfigFactory
+ .createAttributeNameType();
+ attributeNameType.setTextContent(createPreficedString(prefix,
+ ATTRIBUTE_NAME));
+ attributeNameType.setId(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE_NAME, ID)));
+ attrType.setAttributeName(attributeNameType);
+
+ AttributeClassType attributeClassType = _facesConfigFactory
+ .createAttributeClassType();
+ attributeClassType.setTextContent(createPreficedString(prefix,
+ ATTRIBUTE_CLASS));
+ attributeClassType.setId(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE_CLASS, ID)));
+ attrType.setAttributeClass(attributeClassType);
+
+ DefaultValueType defaultValueType = _facesConfigFactory
+ .createDefaultValueType();
+ defaultValueType.setTextContent(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE, DEFAULT_VALUE)));
+ defaultValueType.setId(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE, createPreficedString(
+ DEFAULT_VALUE, ID))));
+ attrType.setDefaultValue(defaultValueType);
+
+ SuggestedValueType suggestedValueType = _facesConfigFactory
+ .createSuggestedValueType();
+ suggestedValueType.setTextContent(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE, SUGGESTED_VALUE)));
+ suggestedValueType.setId(createPreficedString(prefix,
+ createPreficedString(ATTRIBUTE, createPreficedString(
+ SUGGESTED_VALUE, ID))));
+
+ attrType.setSuggestedValue(suggestedValueType);
+
+ attrType.setId(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, ID)));
+
+ return attrType;
+ }
+
+ public static void assertMatchAttribute(String prefix,
+ AttributeType attrType) {
+ final String ATTRIBUTE_PREFIX = createPreficedString(prefix, ATTRIBUTE);
+
+ assertEquals(1, attrType.getDescription().size());
+ assertMatchesDescription(ATTRIBUTE_PREFIX, (DescriptionType) attrType
+ .getDescription().get(0));
+
+ assertEquals(1, attrType.getDisplayName().size());
+ assertMatchesDisplayName(ATTRIBUTE_PREFIX, (DisplayNameType) attrType
+ .getDisplayName().get(0));
+
+ assertEquals(1, attrType.getIcon().size());
+ assertMatchesIcon(ATTRIBUTE_PREFIX, (IconType) attrType.getIcon()
+ .get(0));
+
+ AttributeNameType attributeNameType = attrType.getAttributeName();
+ assertEquals(createPreficedString(prefix, ATTRIBUTE_NAME),
+ attributeNameType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE_NAME, ID)), attributeNameType.getId());
+
+ AttributeClassType attributeClassType = attrType.getAttributeClass();
+ assertEquals(createPreficedString(prefix, ATTRIBUTE_CLASS),
+ attributeClassType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE_CLASS, ID)), attributeClassType.getId());
+
+ DefaultValueType defaultValueType = attrType.getDefaultValue();
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, DEFAULT_VALUE)), defaultValueType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, createPreficedString(DEFAULT_VALUE, ID))),
+ defaultValueType.getId());
+
+ SuggestedValueType suggestedValueType = attrType.getSuggestedValue();
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, SUGGESTED_VALUE)), suggestedValueType
+ .getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, createPreficedString(SUGGESTED_VALUE, ID))),
+ suggestedValueType.getId());
+
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ ATTRIBUTE, ID)), attrType.getId());
+ }
+
+ public static PropertyType createProperty(final String prefix) {
+ final String PROPERTY_PREFIX = createPreficedString(prefix, PROPERTY);
+
+ PropertyType propertyType = _facesConfigFactory.createPropertyType();
+
+ propertyType.getDescription().add(createDescription(PROPERTY_PREFIX));
+ propertyType.getDisplayName().add(createDisplayName(PROPERTY_PREFIX));
+ propertyType.getIcon().add(createIcon(PROPERTY_PREFIX));
+
+ PropertyNameType propertyNameType = _facesConfigFactory
+ .createPropertyNameType();
+ propertyNameType.setTextContent(createPreficedString(prefix,
+ PROPERTY_NAME));
+ propertyNameType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY_NAME, ID)));
+ propertyType.setPropertyName(propertyNameType);
+
+ PropertyClassType propertyClassType = _facesConfigFactory
+ .createPropertyClassType();
+ propertyClassType.setTextContent(createPreficedString(prefix,
+ PROPERTY_CLASS));
+ propertyClassType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY_CLASS, ID)));
+ propertyType.setPropertyClass(propertyClassType);
+
+ DefaultValueType defaultValueType = _facesConfigFactory
+ .createDefaultValueType();
+ defaultValueType.setTextContent(createPreficedString(prefix,
+ createPreficedString(PROPERTY, DEFAULT_VALUE)));
+ defaultValueType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY, createPreficedString(
+ DEFAULT_VALUE, ID))));
+ propertyType.setDefaultValue(defaultValueType);
+
+ SuggestedValueType suggestedValueType = _facesConfigFactory
+ .createSuggestedValueType();
+ suggestedValueType.setTextContent(createPreficedString(prefix,
+ createPreficedString(PROPERTY, SUGGESTED_VALUE)));
+ suggestedValueType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY, createPreficedString(
+ SUGGESTED_VALUE, ID))));
+ propertyType.setSuggestedValue(suggestedValueType);
+
+ propertyType.setId(createPreficedString(prefix, createPreficedString(
+ PROPERTY, ID)));
+
+ return propertyType;
+ }
+
+ public static void assertMatchProperty(final String prefix,
+ final PropertyType property) {
+ final String PROPERTY_PREFIX = createPreficedString(prefix, PROPERTY);
+
+ assertEquals(1, property.getDescription().size());
+ assertMatchesDescription(PROPERTY_PREFIX, (DescriptionType) property
+ .getDescription().get(0));
+
+ assertEquals(1, property.getDisplayName().size());
+ assertMatchesDisplayName(PROPERTY_PREFIX, (DisplayNameType) property
+ .getDisplayName().get(0));
+
+ assertEquals(1, property.getIcon().size());
+ assertMatchesIcon(PROPERTY_PREFIX, (IconType) property.getIcon().get(0));
+
+ PropertyNameType propertyNameType = property.getPropertyName();
+ assertEquals(createPreficedString(prefix, PROPERTY_NAME),
+ propertyNameType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY_NAME, ID)), propertyNameType.getId());
+
+ PropertyClassType propertyClassType = property.getPropertyClass();
+ assertEquals(createPreficedString(prefix, PROPERTY_CLASS),
+ propertyClassType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY_CLASS, ID)), propertyClassType.getId());
+
+ DefaultValueType defaultValueType = property.getDefaultValue();
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY, DEFAULT_VALUE)), defaultValueType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY, createPreficedString(DEFAULT_VALUE, ID))),
+ defaultValueType.getId());
+
+ SuggestedValueType suggestedValueType = property.getSuggestedValue();
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY, SUGGESTED_VALUE)), suggestedValueType
+ .getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY, createPreficedString(SUGGESTED_VALUE, ID))),
+ suggestedValueType.getId());
+
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY, ID)), property.getId());
+
+ }
+
+ public static FacetType createFacet(final String prefix) {
+ final String FACET_PREFIX = createPreficedString(prefix, FACET);
+
+ final FacetType facet = _facesConfigFactory.createFacetType();
+
+ facet.getDescription().add(createDescription(FACET_PREFIX));
+ facet.getDisplayName().add(createDisplayName(FACET_PREFIX));
+ facet.getIcon().add(createIcon(FACET_PREFIX));
+
+ FacetNameType facetNameType = _facesConfigFactory.createFacetNameType();
+ facetNameType.setTextContent(createPreficedString(prefix, FACET_NAME));
+ facetNameType.setId(createPreficedString(prefix, createPreficedString(
+ FACET_NAME, ID)));
+ facet.setFacetName(facetNameType);
+
+ facet.setId(createPreficedString(prefix,
+ createPreficedString(FACET, ID)));
+
+ return facet;
+ }
+
+ public static void assertMatchFacet(final String prefix, FacetType facet) {
+ final String FACET_PREFIX = createPreficedString(prefix, FACET);
+
+ assertEquals(1, facet.getDescription().size());
+ assertMatchesDescription(FACET_PREFIX, (DescriptionType) facet
+ .getDescription().get(0));
+
+ assertEquals(1, facet.getDisplayName().size());
+ assertMatchesDisplayName(FACET_PREFIX, (DisplayNameType) facet
+ .getDisplayName().get(0));
+
+ assertEquals(1, facet.getIcon().size());
+ assertMatchesIcon(FACET_PREFIX, (IconType) facet.getIcon().get(0));
+
+ FacetNameType propertyNameType = facet.getFacetName();
+ assertEquals(createPreficedString(prefix, FACET_NAME), propertyNameType
+ .getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ FACET_NAME, ID)), propertyNameType.getId());
+
+ assertEquals(createPreficedString(prefix, createPreficedString(FACET,
+ ID)), facet.getId());
+ }
+
+ public static ManagedPropertyType createManagedPropertyBase(
+ final String prefix) {
+ final String MANAGED_PROPERTY_PREFIX = createPreficedString(prefix,
+ MANAGED_PROPERTY);
+
+ final ManagedPropertyType managedProperty = _facesConfigFactory
+ .createManagedPropertyType();
+
+ managedProperty.getDescription().add(
+ createDescription(MANAGED_PROPERTY_PREFIX));
+ managedProperty.getDisplayName().add(
+ createDisplayName(MANAGED_PROPERTY_PREFIX));
+ managedProperty.getIcon().add(createIcon(MANAGED_PROPERTY_PREFIX));
+
+ PropertyNameType propertyNameType = _facesConfigFactory
+ .createPropertyNameType();
+ propertyNameType.setTextContent(createPreficedString(prefix,
+ PROPERTY_NAME));
+ propertyNameType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY_NAME, ID)));
+ managedProperty.setPropertyName(propertyNameType);
+
+ PropertyClassType propertyClassType = _facesConfigFactory
+ .createPropertyClassType();
+ propertyClassType.setTextContent(createPreficedString(prefix,
+ PROPERTY_CLASS));
+ propertyClassType.setId(createPreficedString(prefix,
+ createPreficedString(PROPERTY_CLASS, ID)));
+ managedProperty.setPropertyClass(propertyClassType);
+
+ return managedProperty;
+ }
+
+ public static void assertMatchManagedPropertyBase(final String prefix,
+ final ManagedPropertyType managedProperty) {
+ final String MANAGED_PROPERTY_PREFIX = createPreficedString(prefix,
+ MANAGED_PROPERTY);
+
+ assertEquals(1, managedProperty.getDescription().size());
+ assertMatchesDescription(MANAGED_PROPERTY_PREFIX,
+ (DescriptionType) managedProperty.getDescription().get(0));
+
+ assertEquals(1, managedProperty.getDisplayName().size());
+ assertMatchesDisplayName(MANAGED_PROPERTY_PREFIX,
+ (DisplayNameType) managedProperty.getDisplayName().get(0));
+
+ assertEquals(1, managedProperty.getIcon().size());
+ assertMatchesIcon(MANAGED_PROPERTY_PREFIX, (IconType) managedProperty
+ .getIcon().get(0));
+
+ {
+ PropertyNameType propertyNameType = managedProperty
+ .getPropertyName();
+ assertEquals(createPreficedString(prefix, PROPERTY_NAME),
+ propertyNameType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY_NAME, ID)), propertyNameType.getId());
+ }
+
+ {
+ PropertyClassType propertyClassType = managedProperty
+ .getPropertyClass();
+
+ assertEquals(createPreficedString(prefix, PROPERTY_CLASS),
+ propertyClassType.getTextContent());
+ assertEquals(createPreficedString(prefix, createPreficedString(
+ PROPERTY_CLASS, ID)), propertyClassType.getId());
+ }
+
+ }
+
+ public static ValueType createValue(final String prefix) {
+ final String VALUE_PREFIX = createPreficedString(prefix, VALUE);
+ final ValueType value = _facesConfigFactory.createValueType();
+
+ value.setTextContent(VALUE_PREFIX);
+ value.setId(createPreficedString(VALUE_PREFIX, ID));
+
+ return value;
+ }
+
+ public static void assertMatchValue(final String prefix, ValueType value)
+ {
+ final String VALUE_PREFIX = createPreficedString(prefix, VALUE);
+
+ assertEquals(VALUE_PREFIX, value.getTextContent());
+ assertEquals(createPreficedString(VALUE_PREFIX, ID), value.getId());
+ }
+
+ public static MapEntriesType createMapEntries(final String prefix)
+ {
+ final String MAP_ENTRIES_PREFIX =
+ createPreficedString(prefix,
+ createPreficedString(MANAGED_PROPERTY, MAP_ENTRIES));
+ final MapEntriesType mapEntries =
+ _facesConfigFactory.createMapEntriesType();
+
+ {
+ KeyClassType keyClass = _facesConfigFactory.createKeyClassType();
+ keyClass.setTextContent(createPreficedString(prefix,MAP_ENTRIES_KEY_CLASS));
+ keyClass.setId(createPreficedString(prefix,
+ createPreficedString(MAP_ENTRIES_KEY_CLASS, ID)));
+ mapEntries.setKeyClass(keyClass);
+ }
+
+ {
+ ValueClassType valueClass = _facesConfigFactory.createValueClassType();
+ valueClass.setTextContent(MAP_ENTRIES_VALUE_CLASS);
+ valueClass.setId(createPreficedString(MAP_ENTRIES_VALUE_CLASS, ID));
+ mapEntries.setValueClass(valueClass);
+ }
+
+ {
+ MapEntryType mapEntry = _facesConfigFactory.createMapEntryType();
+ mapEntry.setId(createPreficedString(MAP_ENTRY, ID));
+ KeyType keyType = _facesConfigFactory.createKeyType();
+ keyType.setId(createPreficedString(createPreficedString(MAP_ENTRY, ID), KEY));
+ keyType.setTextContent(createPreficedString(MAP_ENTRY, KEY));
+ mapEntry.setKey(keyType);
+ mapEntry.setValue(createValue(MAP_ENTRIES_PREFIX));
+
+ mapEntries.getMapEntry().add(mapEntry);
+ }
+
+ {
+ MapEntryType mapEntry = _facesConfigFactory.createMapEntryType();
+ mapEntry.setId(createPreficedString(createPreficedString(MAP_ENTRY, ID), "2"));
+ KeyType keyType = _facesConfigFactory.createKeyType();
+ keyType.setId(createPreficedString(createPreficedString(createPreficedString(MAP_ENTRY, ID), KEY),"2"));
+ keyType.setTextContent(createPreficedString(createPreficedString(MAP_ENTRY, KEY), "2"));
+ mapEntry.setKey(keyType);
+ NullValueType nullValue = _facesConfigFactory.createNullValueType();
+ nullValue.setId(createPreficedString("null", MAP_ENTRY));
+ mapEntry.setNullValue(nullValue);
+
+ mapEntries.getMapEntry().add(mapEntry);
+ }
+
+ mapEntries.setId(createPreficedString(MAP_ENTRIES_PREFIX, ID));
+
+ return mapEntries;
+ }
+
+ public static void assertMatchMapEntries(final String prefix, MapEntriesType mapEntries)
+ {
+ final String MAP_ENTRIES_PREFIX =
+ createPreficedString(prefix,
+ createPreficedString(MANAGED_PROPERTY, MAP_ENTRIES));
+
+ {
+ KeyClassType keyClass = mapEntries.getKeyClass();
+ assertEquals(createPreficedString(prefix,MAP_ENTRIES_KEY_CLASS)
+ , keyClass.getTextContent());
+ assertEquals(createPreficedString(prefix,
+ createPreficedString(MAP_ENTRIES_KEY_CLASS, ID))
+ , keyClass.getId());
+ }
+
+ {
+ ValueClassType valueClass = mapEntries.getValueClass();
+ assertEquals(MAP_ENTRIES_VALUE_CLASS, valueClass.getTextContent());
+ assertEquals(createPreficedString(MAP_ENTRIES_VALUE_CLASS, ID)
+ , valueClass.getId());
+ }
+
+ assertEquals(2, mapEntries.getMapEntry().size());
+ {
+ MapEntryType mapEntry =
+ (MapEntryType) mapEntries.getMapEntry().get(0);
+ assertEquals(createPreficedString(MAP_ENTRY, ID)
+ , mapEntry.getId());
+
+ KeyType keyType = mapEntry.getKey();
+ assertEquals(createPreficedString(createPreficedString(MAP_ENTRY, ID), KEY)
+ , keyType.getId());
+ assertEquals(createPreficedString(MAP_ENTRY, KEY)
+ , keyType.getTextContent());
+ assertMatchValue(MAP_ENTRIES_PREFIX, mapEntry.getValue());
+ }
+
+ {
+ MapEntryType mapEntry =
+ (MapEntryType) mapEntries.getMapEntry().get(1);
+ assertEquals(createPreficedString(createPreficedString(MAP_ENTRY, ID), "2")
+ , mapEntry.getId());
+
+ KeyType keyType = mapEntry.getKey();
+ assertEquals(createPreficedString(
+ createPreficedString(createPreficedString(MAP_ENTRY, ID), KEY), "2")
+ , keyType.getId());
+
+ NullValueType nullValue = mapEntry.getNullValue();
+ assertEquals(createPreficedString("null", MAP_ENTRY), nullValue.getId());
+ }
+
+ assertEquals(createPreficedString(MAP_ENTRIES_PREFIX, ID)
+ , mapEntries.getId());
+ }
+
+ public static ListEntriesType createListEntries(final String prefix)
+ {
+ final String LIST_ENTRIES_PREFIX =
+ createPreficedString(prefix,
+ createPreficedString(MANAGED_PROPERTY, LIST_ENTRIES));
+ final ListEntriesType listEntries =
+ _facesConfigFactory.createListEntriesType();
+
+ {
+ ValueClassType valueClass = _facesConfigFactory.createValueClassType();
+ valueClass.setTextContent(LIST_ENTRIES_VALUE_CLASS);
+ valueClass.setId(createPreficedString(LIST_ENTRIES_VALUE_CLASS, ID));
+ listEntries.setValueClass(valueClass);
+ }
+
+ listEntries.getValue().add(createValue(LIST_ENTRIES_PREFIX));
+ listEntries.setId(createPreficedString(LIST_ENTRIES_PREFIX, ID));
+
+ return listEntries;
+ }
+
+ public static void assertMatchListEntries(final String prefix, ListEntriesType listEntries)
+ {
+ final String LIST_ENTRIES_PREFIX =
+ createPreficedString(prefix,
+ createPreficedString(MANAGED_PROPERTY, LIST_ENTRIES));
+
+ {
+ ValueClassType valueClass = listEntries.getValueClass();
+ assertEquals(LIST_ENTRIES_VALUE_CLASS, valueClass.getTextContent());
+ assertEquals(createPreficedString(LIST_ENTRIES_VALUE_CLASS, ID)
+ , valueClass.getId());
+ }
+
+ assertEquals(1,listEntries.getValue().size());
+ ValueType value = (ValueType) listEntries.getValue().get(0);
+ assertMatchValue(LIST_ENTRIES_PREFIX, value);
+
+ assertEquals(createPreficedString(LIST_ENTRIES_PREFIX, ID), listEntries.getId());
+ }
+
+ public static String createPreficedString(final String prefix,
+ final String value) {
+ return prefix + "-" + value;
+ }
+
+ /**
+ * Tests that what is created by each method is successfully matched by the
+ * corresponding match method
+ */
+ public void testSanity() {
+ assertMatchesDescription(TEST_SANITY, createDescription(TEST_SANITY));
+ assertMatchesDisplayName(TEST_SANITY, createDisplayName(TEST_SANITY));
+ assertMatchesIcon(TEST_SANITY, createIcon(TEST_SANITY));
+ assertMatchAttribute(TEST_SANITY, createAttribute(TEST_SANITY));
+ assertMatchProperty(TEST_SANITY, createProperty(TEST_SANITY));
+ assertMatchFacet(TEST_SANITY, createFacet(TEST_SANITY));
+ assertMatchManagedPropertyBase(TEST_SANITY,
+ createManagedPropertyBase(TEST_SANITY));
+ assertMatchValue(TEST_SANITY, createValue(TEST_SANITY));
+ assertMatchMapEntries(TEST_SANITY, createMapEntries(TEST_SANITY));
+ assertMatchListEntries(TEST_SANITY, createListEntries(TEST_SANITY));
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/FacesConfigModelUtil.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/FacesConfigModelUtil.java
new file mode 100644
index 0000000..6109379
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/FacesConfigModelUtil.java
@@ -0,0 +1,264 @@
+package org.eclipse.jst.jsf.facesconfig.tests.util;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jst.jsf.facesconfig.emf.ActionListenerType;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.facesconfig.emf.DefaultRenderKitIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
+
+/**
+ * Utility methods for model handling in tests
+ *
+ */
+public final class FacesConfigModelUtil
+{
+ /**
+ * @param navHandlers
+ * @param descriptionText
+ * @return the navigation rule from the list navRules
+ * whose description text matches descriptionText or null if
+ * not found
+ */
+ public static NavigationRuleType findNavigationHandlerRuleByDescriptionText(List navRules, String descriptionText)
+ {
+ if (descriptionText == null)
+ {
+ return null;
+ }
+
+ for (final Iterator it = navRules.iterator(); it.hasNext();)
+ {
+ final NavigationRuleType navHandlerType =
+ (NavigationRuleType) it.next();
+
+ if (findDescriptionType(navHandlerType.getDescription(), descriptionText) != null)
+ {
+ return navHandlerType;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ /**
+ * @param navRules
+ * @param displayName
+ * @return the the navigation rule from the list navRules
+ * whose display nmae text matches displayName or null if
+ * not found
+ */
+ public static NavigationRuleType findNavigationHandlerRuleByDisplayName(List navRules, String displayName)
+ {
+ if (displayName == null)
+ {
+ return null;
+ }
+
+ for (final Iterator it = navRules.iterator(); it.hasNext();)
+ {
+ final NavigationRuleType navHandlerType =
+ (NavigationRuleType) it.next();
+
+ if (findDisplayNameType(navHandlerType.getDisplayName(), displayName) != null)
+ {
+ return navHandlerType;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+
+ /**
+ * @param descTypes
+ * @param matchText
+ * @return the DisplayNameType from descTypes corresponding to
+ * matchText or null if not in list. String.equals() is used
+ * to match
+ */
+ public static DisplayNameType findDisplayNameType(List descTypes, String matchText)
+ {
+ if (matchText == null)
+ {
+ return null;
+ }
+
+ for (final Iterator it = descTypes.iterator(); it.hasNext();)
+ {
+ final DisplayNameType descType = (DisplayNameType) it.next();
+ if (matchText.equals(descType.getTextContent()))
+ {
+ return descType;
+ }
+ }
+
+ // if get through list and not found, then return null
+ return null;
+ }
+
+ /**
+ * @param descTypes
+ * @param matchText
+ * @return the DescriptionType from descTypes corresponding to
+ * matchText or null if not in list. String.equals() is used
+ * to match
+ */
+ public static DescriptionType findDescriptionType(List descTypes, String matchText)
+ {
+ if (matchText == null)
+ {
+ return null;
+ }
+
+ for (final Iterator it = descTypes.iterator(); it.hasNext();)
+ {
+ final DescriptionType descType = (DescriptionType) it.next();
+ if (matchText.equals(descType.getTextContent()))
+ {
+ return descType;
+ }
+ }
+
+ // if get through list and not found, then return null
+ return null;
+ }
+
+ public static IconType findIconTypeByLang(List iconTypes, String xmlLangMatch)
+ {
+ for (final Iterator it = iconTypes.iterator(); it.hasNext();)
+ {
+ final IconType icon = (IconType) it.next();
+ if (xmlLangMatch == null && icon.getLang() == null)
+ {
+ return icon;
+ }
+ else if (xmlLangMatch != null && xmlLangMatch.equals(icon.getLang()))
+ {
+ return icon;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ public static NavigationCaseType findNavigationCaseByDisplayName(List navigationCases, String displayName)
+ {
+ for (final Iterator it = navigationCases.iterator(); it.hasNext();)
+ {
+ final NavigationCaseType navCase = (NavigationCaseType) it.next();
+
+ if (displayName != null &&
+ findDisplayNameType(navCase.getDisplayName(), displayName) != null)
+ {
+ return navCase;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ public static ApplicationType findApplicationById(List applications, String id)
+ {
+ for (final Iterator it = applications.iterator(); it.hasNext();)
+ {
+ final ApplicationType app = (ApplicationType) it.next();
+
+ if (id != null && id.equals(app.getId()))
+ {
+ return app;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ public static ActionListenerType findActionListenerById(List actionListeners, String id)
+ {
+ for (final Iterator it = actionListeners.iterator(); it.hasNext();)
+ {
+ final ActionListenerType app = (ActionListenerType) it.next();
+
+ if (id != null && id.equals(app.getId()))
+ {
+ return app;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ /**
+ * @param defaultRenderKits
+ * @param id
+ * @return
+ */
+ public static DefaultRenderKitIdType findDefaultRenderKitIdTypeById(List defaultRenderKits, String id)
+ {
+ for (final Iterator it = defaultRenderKits.iterator(); it.hasNext();)
+ {
+ final DefaultRenderKitIdType renderKitId = (DefaultRenderKitIdType) it.next();
+
+ if (id != null && id.equals(renderKitId.getId()))
+ {
+ return renderKitId;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ public static MessageBundleType findMessageBundleTypeById(List messageBundles, String id)
+ {
+ for (final Iterator it = messageBundles.iterator(); it.hasNext();)
+ {
+ final MessageBundleType messageBundle = (MessageBundleType) it.next();
+
+ if (id != null && id.equals(messageBundle.getId()))
+ {
+ return messageBundle;
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ public static EObject findEObjectElementById(List eObjects, String id)
+ {
+ for (final Iterator it = eObjects.iterator(); it.hasNext();)
+ {
+ final EObject eObject = (EObject) it.next();
+
+ final EStructuralFeature feature =
+ eObject.eClass().getEStructuralFeature("id");
+ if (feature != null)
+ {
+ Object value = eObject.eGet(feature);
+
+ if (value instanceof String
+ && value.equals(id))
+ {
+ return eObject;
+ }
+ }
+ }
+ // not found
+ return null;
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/WizardUtil.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/WizardUtil.java
index 950e526..797cd88 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/WizardUtil.java
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/util/WizardUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
**************************************************************************************************/
-package org.eclipse.jst.jsf.facesconfig.tests;
+package org.eclipse.jst.jsf.facesconfig.tests.util;
import java.io.File;
import java.io.FileInputStream;
@@ -122,7 +122,8 @@ public class WizardUtil {
IFile facesConfigFile = ResourcesPlugin.getWorkspace().getRoot().getFile(container.getFullPath().append(new Path("faces-config.xml"))); //$NON-NLS-1$
IFile facesConfigFile1 = ResourcesPlugin.getWorkspace().getRoot().getFile(container.getFullPath().append(new Path("faces-config1.xml"))); //$NON-NLS-1$
IFile facesConfigFile2 = ResourcesPlugin.getWorkspace().getRoot().getFile(container.getFullPath().append(new Path("faces-config2.xml"))); //$NON-NLS-1$
-
+ IFile facesConfigFileExtData = ResourcesPlugin.getWorkspace().getRoot().getFile(container.getFullPath().append(new Path("faces-config-ext-data1.xml"))); //$NON-NLS-1$
+
if(facesConfigFile.exists()) {
return;
}
@@ -130,26 +131,42 @@ public class WizardUtil {
final IPath facesConfigPath = new Path("/template/faces-config.xml");
final IPath facesConfig1Path = new Path("/template/faces-config1.xml");
final IPath facesConfig2Path = new Path("/template/faces-config2.xml");
+ final IPath facesConfigExtData1Path = new Path("/template/faces-config-ext-data1.xml");
+
final Bundle myBundle = Platform.getBundle("org.eclipse.jst.jsf.facesconfig.tests");
// there is no faces-config, so add our starting template
try {
- final String sourcePath = FileLocator.toFileURL(FileLocator.find(myBundle, facesConfigPath,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
- final File f = new File(sourcePath);
- final FileInputStream sourceStream = new FileInputStream(f);
- facesConfigFile.create(sourceStream, true, null);
- sourceStream.close();
-
- final String sourcePath1 = FileLocator.toFileURL(FileLocator.find(myBundle,facesConfig1Path,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
- final File f1 = new File(sourcePath1);
- final FileInputStream sourceStream1 = new FileInputStream(f1);
- facesConfigFile1.create(sourceStream1, true, null);
- sourceStream1.close();
+
+ {
+ final String sourcePath = FileLocator.toFileURL(FileLocator.find(myBundle, facesConfigPath,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ final File f = new File(sourcePath);
+ final FileInputStream sourceStream = new FileInputStream(f);
+ facesConfigFile.create(sourceStream, true, null);
+ sourceStream.close();
+ }
+ {
+ final String sourcePath1 = FileLocator.toFileURL(FileLocator.find(myBundle,facesConfig1Path,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ final File f1 = new File(sourcePath1);
+ final FileInputStream sourceStream1 = new FileInputStream(f1);
+ facesConfigFile1.create(sourceStream1, true, null);
+ sourceStream1.close();
+ }
+ {
+ final String sourcePath2 = FileLocator.toFileURL(FileLocator.find(myBundle, facesConfig2Path,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ final File f2 = new File(sourcePath2);
+ final FileInputStream sourceStream2 = new FileInputStream(f2);
+ facesConfigFile2.create(sourceStream2, true, null);
+ sourceStream2.close();
+ }
- final String sourcePath2 = FileLocator.toFileURL(FileLocator.find(myBundle, facesConfig2Path,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
- final File f2 = new File(sourcePath2);
- final FileInputStream sourceStream2 = new FileInputStream(f2);
- facesConfigFile2.create(sourceStream2, true, null);
- sourceStream2.close();
+ {
+ final String sourcePathExtData1 = FileLocator.toFileURL(FileLocator.find(myBundle, facesConfigExtData1Path,null)).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$
+ final File fext = new File(sourcePathExtData1);
+ final FileInputStream sourceStreamExt1 = new FileInputStream(fext);
+ facesConfigFileExtData.create(sourceStreamExt1, true, null);
+ sourceStreamExt1.close();
+ }
+
} catch (IOException ioe) {
ioe.printStackTrace(System.err);
} catch (CoreException ce) {
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/AllWriteTests.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/AllWriteTests.java
new file mode 100644
index 0000000..54a695e
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/AllWriteTests.java
@@ -0,0 +1,66 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Wrapper suite for all the tests against the .util package.
+ *
+ * @author spaxton
+ * @author le-ake m. G kristos
+ */
+public class AllWriteTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Test FacesConfig - writing");
+
+ suite.addTest(new TestSuite(
+ CommonStructuresUtil.class,
+ "Sanity Test"));
+ suite.addTest(new TestSuite(
+ WriteApplicationTestCase.class,
+ "Write application"));
+ suite.addTest(new TestSuite(
+ WriteComponentTestCase.class,
+ "Write Component Test"));
+ suite.addTest(new TestSuite(
+ WriteConverterTestCase.class,
+ "Write converter Test"));
+ suite.addTest(new TestSuite(
+ WriteFactoryTestCase.class,
+ "Write factory "));
+ suite.addTest(new TestSuite(
+ WriteLifecycleTestCase.class,
+ "Write Lifecycle Test"));
+ suite.addTest(new TestSuite(
+ WriteManagedBeanTestCase.class,
+ "Write Managed-bean Test"));
+ suite.addTest(new TestSuite(
+ WriteNavigationRuleTestCase.class,
+ "Write navigation rule "));
+ suite.addTest(new TestSuite(
+ WriteRenderKitTestCase.class,
+ "Write Render-kit Test"));
+ suite.addTest(new TestSuite(
+ WriteReferencedBeanTestCase.class,
+ "Write ReferencedBean Test"));
+ suite.addTest(new TestSuite(
+ WriteValidatorTestCase.class,
+ "Write Validator Test"));
+
+ return suite;
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteApplicationTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteApplicationTestCase.java
new file mode 100644
index 0000000..1570f6e
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteApplicationTestCase.java
@@ -0,0 +1,208 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ActionListenerType;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationType;
+import org.eclipse.jst.jsf.facesconfig.emf.DefaultLocaleType;
+import org.eclipse.jst.jsf.facesconfig.emf.DefaultRenderKitIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.LocaleConfigType;
+import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationHandlerType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyResolverType;
+import org.eclipse.jst.jsf.facesconfig.emf.StateManagerType;
+import org.eclipse.jst.jsf.facesconfig.emf.SupportedLocaleType;
+import org.eclipse.jst.jsf.facesconfig.emf.VariableResolverType;
+import org.eclipse.jst.jsf.facesconfig.emf.ViewHandlerType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+/*
+ * This class is used to test wether the writing into the faces-config.xml
+ * file is being done propertly and the outputs are as expected
+ *
+ */
+public class WriteApplicationTestCase extends TestCase {
+ private static final String SUPPORTED_LOCALE_TYPE = "supported-locale-type";
+
+ private static final String DEFAULT_LOCALE = "default-locale";
+
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+
+ private final static String actionListener = "action-listener";
+ private final static String variableResolver = "variable-resolver";
+ private final static String defaultRenderKitId = "default-render-kit-id";
+ private final static String messageBundle= "message-bundle";
+ private final static String navigationHandler = "navigation-handler";
+ private final static String viewHandler = "view-handler";
+ private final static String stateManager="state-manager";
+ private final static String propertyResolver="property-resolver";
+
+ IProject project = null;
+
+ public WriteApplicationTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+ /*
+ * Do the writing here to all the attributes
+ *
+ */
+
+ public void testWriteApplication() {
+ FacesConfigArtifactEdit edit2 = null;
+
+ try {
+ edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+
+ assertNotNull(edit2);
+ assertNotNull(edit2.getFacesConfig());
+
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+
+ ApplicationType newApplication = facesConfigFactory.createApplicationType();
+
+
+ ActionListenerType actionList= facesConfigFactory.createActionListenerType();
+ actionList.setTextContent(actionListener);
+ newApplication.getActionListener().add(actionList);
+
+
+
+ VariableResolverType variableResolverType= facesConfigFactory.createVariableResolverType();
+ variableResolverType.setTextContent(variableResolver);
+ newApplication.getVariableResolver().add(variableResolverType);
+
+
+ DefaultRenderKitIdType renderKitIdType= facesConfigFactory.createDefaultRenderKitIdType();
+ renderKitIdType.setTextContent(defaultRenderKitId);
+ newApplication.getDefaultRenderKitId().add(renderKitIdType);
+
+
+ MessageBundleType messageBundleType= facesConfigFactory.createMessageBundleType();
+ messageBundleType.setTextContent(messageBundle);
+ newApplication.getMessageBundle().add(messageBundleType);
+
+
+ NavigationHandlerType navigationHandlerType= facesConfigFactory.createNavigationHandlerType();
+ navigationHandlerType.setTextContent(navigationHandler);
+ newApplication.getNavigationHandler().add(navigationHandlerType);
+
+
+ ViewHandlerType viewHandlerType= facesConfigFactory.createViewHandlerType();
+ viewHandlerType.setTextContent(viewHandler);
+ newApplication.getViewHandler().add(viewHandlerType);
+
+ StateManagerType stateManagerType= facesConfigFactory.createStateManagerType();
+ stateManagerType.setTextContent(stateManager);
+ newApplication.getStateManager().add(stateManagerType);
+
+
+ PropertyResolverType propertyResolverType= facesConfigFactory.createPropertyResolverType();
+ propertyResolverType.setTextContent(propertyResolver);
+ newApplication.getPropertyResolver().add(propertyResolverType);
+
+
+ LocaleConfigType localConfigType = facesConfigFactory.createLocaleConfigType();
+ DefaultLocaleType defaultLocaleType = facesConfigFactory.createDefaultLocaleType();
+ defaultLocaleType.setTextContent(DEFAULT_LOCALE);
+ localConfigType.setDefaultLocale(defaultLocaleType);
+
+ SupportedLocaleType supportedLocalType = facesConfigFactory.createSupportedLocaleType();
+ supportedLocalType.setTextContent(SUPPORTED_LOCALE_TYPE);
+ localConfigType.getSupportedLocale().add(supportedLocalType);
+
+ newApplication.getLocaleConfig().add(localConfigType);
+
+ edit2.getFacesConfig().getApplication().add(newApplication);
+ edit2.save(null);
+ } finally {
+ if (edit2 != null) {
+ edit2.dispose();
+ // assert that the file has been disposed
+ assertTrue(edit2.isDisposed());
+ edit2 = null;
+ }
+ }
+
+
+ // now read back the file
+ try {
+ edit2 = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit2);
+ assertNotNull(edit2.getFacesConfig());
+ assertEquals(1, edit2.getFacesConfig().getApplication().size());
+ ApplicationType application =
+ (ApplicationType) edit2.getFacesConfig().getApplication().get(0);
+
+ assertEquals(1, application.getActionListener().size());
+ assertEquals(actionListener
+ , ((ActionListenerType)application.getActionListener().get(0)).getTextContent());
+
+ assertEquals(1, application.getVariableResolver().size());
+ assertEquals(variableResolver
+ , ((VariableResolverType)application.getVariableResolver().get(0)).getTextContent());
+
+ assertEquals(1, application.getDefaultRenderKitId().size());
+ assertEquals(defaultRenderKitId
+ , ((DefaultRenderKitIdType)application.getDefaultRenderKitId().get(0)).getTextContent());
+
+ assertEquals(1, application.getMessageBundle().size());
+ assertEquals(messageBundle
+ , ((MessageBundleType)application.getMessageBundle().get(0)).getTextContent());
+
+ assertEquals(1, application.getNavigationHandler().size());
+ assertEquals(navigationHandler
+ , ((NavigationHandlerType)application.getNavigationHandler().get(0)).getTextContent());
+
+ assertEquals(1, application.getViewHandler().size());
+ assertEquals(viewHandler
+ , ((ViewHandlerType)application.getViewHandler().get(0)).getTextContent());
+
+ assertEquals(1, application.getStateManager().size());
+ assertEquals(stateManager
+ , ((StateManagerType)application.getStateManager().get(0)).getTextContent());
+
+ assertEquals(1, application.getPropertyResolver().size());
+ assertEquals(propertyResolver
+ , ((PropertyResolverType)application.getPropertyResolver().get(0)).getTextContent());
+
+
+ assertEquals(1, application.getLocaleConfig().size());
+ LocaleConfigType localConfigType =
+ (LocaleConfigType) application.getLocaleConfig().get(0);
+
+ assertEquals(DEFAULT_LOCALE, localConfigType.getDefaultLocale().getTextContent());
+ assertEquals(1, localConfigType.getSupportedLocale().size());
+
+ assertEquals(SUPPORTED_LOCALE_TYPE
+ , ((SupportedLocaleType)localConfigType.getSupportedLocale().get(0)).getTextContent());
+ } finally {
+
+ if (edit2 != null) {
+ edit2.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentExtensionDataTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentExtensionDataTestCase.java
new file mode 100644
index 0000000..8307c0f
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentExtensionDataTestCase.java
@@ -0,0 +1,108 @@
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
+import org.eclipse.jst.jsf.facesconfig.emf.DynamicAttribute;
+import org.eclipse.jst.jsf.facesconfig.emf.DynamicElement;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+import org.eclipse.jst.jsf.test.util.JSFTestUtil;
+
+public class WriteComponentExtensionDataTestCase extends TestCase {
+ private static final String COMPONENT = "component";
+
+ private static final String COMPONENT_CLASS = "component-class";
+
+ private static final String COMPONENT_TYPE = "component-type";
+
+ private static final String WEB_INF_FACES_CONFIG1_XML = "WEB-INF/faces-config1.xml";
+
+ IProject project = null;
+
+ public WriteComponentExtensionDataTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ JSFTestUtil.setValidationEnabled(false);
+
+ JSFTestUtil.setInternetProxyPreferences(true, "www-proxy.uk.oracle.com", "80");
+
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteExtensionData()
+ {
+ FacesConfigArtifactEdit edit = null;
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG1_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage
+ .getFacesConfigFactory();
+
+ ComponentType newComponent = facesConfigFactory
+ .createComponentType();
+
+ {
+ ComponentTypeType componentTypeType = facesConfigFactory.createComponentTypeType();
+ componentTypeType.setTextContent(COMPONENT_TYPE);
+ componentTypeType.setId(CommonStructuresUtil.createPreficedString(COMPONENT_TYPE
+ , CommonStructuresUtil.ID));
+ newComponent.setComponentType(componentTypeType);
+ }
+
+ {
+ ComponentClassType componentClassType = facesConfigFactory.createComponentClassType();
+ componentClassType.setTextContent(COMPONENT_CLASS);
+ componentClassType.setId(CommonStructuresUtil.createPreficedString(COMPONENT_CLASS
+ , CommonStructuresUtil.ID));
+ newComponent.setComponentClass(componentClassType);
+ }
+
+ ComponentExtensionType extType =
+ facesConfigFactory.createComponentExtensionType();
+ extType.setId(CommonStructuresUtil.createPreficedString(COMPONENT, "extension-id"));
+
+ DynamicElement singleRoot = facesConfigFactory.createDynamicElement();
+ singleRoot.setName("any-data");
+ DynamicAttribute attribute = facesConfigFactory.createDynamicAttribute();
+ attribute.setName("some-attribute");
+ attribute.setValue("some-value");
+ singleRoot.getAttributes().add(attribute);
+
+ DynamicElement firstChild = facesConfigFactory.createDynamicElement();
+ firstChild.setName("first-child");
+ singleRoot.getChildNodes().add(firstChild);
+
+ DynamicElement secondChild =
+ facesConfigFactory.createDynamicElement();
+ secondChild.setName("second-child");
+ //secondChild.setTextContent("secondChild text content");
+ singleRoot.getChildNodes().add(secondChild);
+ extType.getChildNodes().add(singleRoot);
+ newComponent.getComponentExtension().add(extType);
+
+ edit.getFacesConfig().getComponent().add(newComponent);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentTestCase.java
new file mode 100644
index 0000000..58ecd2c
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteComponentTestCase.java
@@ -0,0 +1,185 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentExtensionType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.DynamicElement;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+public class WriteComponentTestCase extends TestCase {
+
+ private static final String COMPONENT = "component";
+
+ private static final String COMPONENT_CLASS = "component-class";
+
+ private static final String COMPONENT_TYPE = "component-type";
+
+ private static final String WEB_INF_FACES_CONFIG1_XML = "WEB-INF/faces-config1.xml";
+
+ IProject project = null;
+
+ public WriteComponentTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteComponent() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG1_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage
+ .getFacesConfigFactory();
+
+ ComponentType newComponent = facesConfigFactory
+ .createComponentType();
+
+ newComponent.getDescription().add(CommonStructuresUtil.createDescription(COMPONENT));
+ newComponent.getDisplayName().add(CommonStructuresUtil.createDisplayName(COMPONENT));
+ newComponent.getIcon().add(CommonStructuresUtil.createIcon(COMPONENT));
+
+ {
+ ComponentTypeType componentTypeType = facesConfigFactory.createComponentTypeType();
+ componentTypeType.setTextContent(COMPONENT_TYPE);
+ componentTypeType.setId(CommonStructuresUtil.createPreficedString(COMPONENT_TYPE
+ , CommonStructuresUtil.ID));
+ newComponent.setComponentType(componentTypeType);
+ }
+
+ {
+ ComponentClassType componentClassType = facesConfigFactory.createComponentClassType();
+ componentClassType.setTextContent(COMPONENT_CLASS);
+ componentClassType.setId(CommonStructuresUtil.createPreficedString(COMPONENT_CLASS
+ , CommonStructuresUtil.ID));
+ newComponent.setComponentClass(componentClassType);
+ }
+
+ // attributes
+ newComponent.getAttribute().add(CommonStructuresUtil.createAttribute(COMPONENT));
+
+ // property section
+ newComponent.getProperty().add(CommonStructuresUtil.createProperty(COMPONENT));
+
+ // facets
+ newComponent.getFacet().add(CommonStructuresUtil.createFacet(COMPONENT));
+
+ // component-extension
+ ComponentExtensionType ext =
+ facesConfigFactory.createComponentExtensionType();
+
+ DynamicElement element = facesConfigFactory.createDynamicElement();
+ element.setName("some-meta-data");
+ ext.getChildNodes().add(element);
+ newComponent.getComponentExtension().add(ext);
+
+ edit.getFacesConfig().getComponent().add(newComponent);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG1_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getComponent().size());
+
+ final ComponentType component =
+ (ComponentType) edit.getFacesConfig().getComponent().get(0);
+
+ assertEquals(1, component.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription
+ (COMPONENT, (DescriptionType) component.getDescription().get(0));
+
+ assertEquals(1, component.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName
+ (COMPONENT, (DisplayNameType)component.getDisplayName().get(0));
+
+ assertEquals(1, component.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon
+ (COMPONENT, (IconType)component.getIcon().get(0));
+ {
+ ComponentTypeType componentTypeType = component.getComponentType();
+ assertEquals(COMPONENT_TYPE
+ , componentTypeType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(COMPONENT_TYPE
+ , CommonStructuresUtil.ID)
+ , componentTypeType.getId());
+ }
+
+ {
+ ComponentClassType componentClassType = component.getComponentClass();
+ assertEquals(COMPONENT_CLASS
+ , componentClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(COMPONENT_CLASS
+ , CommonStructuresUtil.ID)
+ , componentClassType.getId());
+ }
+
+ assertEquals(1, component.getAttribute().size());
+ CommonStructuresUtil.assertMatchAttribute(COMPONENT
+ ,(AttributeType) component.getAttribute().get(0));
+
+ assertEquals(1, component.getProperty().size());
+ CommonStructuresUtil.assertMatchProperty(COMPONENT
+ ,(PropertyType) component.getProperty().get(0));
+
+ assertEquals(1, component.getFacet().size());
+ CommonStructuresUtil.assertMatchFacet(COMPONENT
+ ,(FacetType) component.getFacet().get(0));
+
+ // component-extension
+ assertEquals(1, component.getComponentExtension().size());
+ ComponentExtensionType ext =
+ (ComponentExtensionType) component.getComponentExtension().get(0);
+
+ assertEquals(1, ext.getChildNodes().size());
+ DynamicElement element =
+ (DynamicElement)ext.getChildNodes().get(0);
+ assertEquals("some-meta-data", element.getName());
+
+ } finally {
+
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteConverterTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteConverterTestCase.java
new file mode 100644
index 0000000..e623490
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteConverterTestCase.java
@@ -0,0 +1,160 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterForClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class WriteConverterTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+ IProject project = null;
+
+ private static final String CONVERTER = "converter";
+ private static final String CONVERTER_CLASS =
+ CommonStructuresUtil.createPreficedString(CONVERTER, CommonStructuresUtil.CLASS);
+ private static final String CONVERTER_CLASS_FOR =
+ CommonStructuresUtil.createPreficedString(CONVERTER
+ , CommonStructuresUtil.createPreficedString(CommonStructuresUtil.CLASS, "for"));
+ private static final String CONVERTER_ID =
+ CommonStructuresUtil.createPreficedString(CONVERTER, CommonStructuresUtil.ID);
+
+ public WriteConverterTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteConverter() {
+ FacesConfigArtifactEdit edit = null;
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ ConverterType converter = facesConfigFactory.createConverterType();
+
+ converter.getDescription().add(CommonStructuresUtil.createDescription(CONVERTER));
+ converter.getDisplayName().add(CommonStructuresUtil.createDisplayName(CONVERTER));
+ converter.getIcon().add(CommonStructuresUtil.createIcon(CONVERTER));
+
+ {
+ ConverterClassType converterClassType = facesConfigFactory.createConverterClassType();
+ converterClassType.setTextContent(CONVERTER_CLASS);
+ converterClassType.setId(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS
+ , CommonStructuresUtil.ID));
+ converter.setConverterClass(converterClassType);
+ }
+
+ {
+ ConverterForClassType converterForClassType = facesConfigFactory.createConverterForClassType();
+ converterForClassType.setTextContent(CONVERTER_CLASS_FOR);
+ converterForClassType.setId(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS_FOR
+ , CommonStructuresUtil.ID));
+ converter.setConverterForClass(converterForClassType);
+ }
+ {
+ ConverterIdType converterId = facesConfigFactory.createConverterIdType();
+ converterId.setTextContent(CONVERTER_ID);
+ converterId.setId(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS_FOR
+ , CommonStructuresUtil.ID));
+ converter.setConverterId(converterId);
+ }
+
+ converter.getAttribute().add(CommonStructuresUtil.createAttribute(CONVERTER));
+ converter.getProperty().add(CommonStructuresUtil.createProperty(CONVERTER));
+
+ converter.setId(CommonStructuresUtil.createPreficedString(CONVERTER
+ , CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getConverter().add(converter);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getConverter().size());
+ ConverterType converter =
+ (ConverterType) edit.getFacesConfig().getConverter().get(0);
+
+ assertEquals(1, converter.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription
+ (CONVERTER, (DescriptionType) converter.getDescription().get(0));
+
+ assertEquals(1, converter.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName
+ (CONVERTER, (DisplayNameType) converter.getDisplayName().get(0));
+
+ assertEquals(1, converter.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon
+ (CONVERTER, (IconType) converter.getIcon().get(0));
+
+ ConverterClassType converterClassType = converter.getConverterClass();
+ assertEquals(CONVERTER_CLASS, converterClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS
+ , CommonStructuresUtil.ID)
+ , converterClassType.getId());
+
+ ConverterForClassType converterForClassType = converter.getConverterForClass();
+ assertEquals(CONVERTER_CLASS_FOR, converterForClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS_FOR
+ , CommonStructuresUtil.ID)
+ , converterForClassType.getId());
+
+ ConverterIdType converterId = converter.getConverterId();
+ assertEquals(CONVERTER_ID, converterId.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(CONVERTER_CLASS_FOR
+ , CommonStructuresUtil.ID)
+ , converterId.getId());
+
+ converter.getAttribute().add(CommonStructuresUtil.createAttribute(CONVERTER));
+ converter.getProperty().add(CommonStructuresUtil.createProperty(CONVERTER));
+
+ assertEquals(CommonStructuresUtil.createPreficedString(CONVERTER
+ , CommonStructuresUtil.ID)
+ , converter.getId());
+ } finally {
+ //assertTrue(result != null && result.equals(sTestString));
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+}
+
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteFactoryTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteFactoryTestCase.java
new file mode 100644
index 0000000..8e9910b
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteFactoryTestCase.java
@@ -0,0 +1,171 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.ApplicationFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesContextFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.FactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.LifecycleFactoryType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitFactoryType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the FacesConfigFactoryImpl
+ * class.
+ */
+public class WriteFactoryTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+ IProject project = null;
+
+ private final static String FACTORY = "factory";
+ private final static String APPLICATION_FACTORY = "application-factory";
+ private final static String FACESCONTEXT_FACTORY = "faces-context-factory";
+ private final static String LIFECYCLE_FACTORY = "lifecycle-factory";
+ private final static String RENDERKIT_FACTORY = "render-kit-factory";
+
+ public WriteFactoryTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteFacesconfigFile() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ FactoryType newfactory = facesConfigFactory.createFactoryType();
+
+ {
+ ApplicationFactoryType newApplicationFactory = facesConfigFactory.createApplicationFactoryType();
+ newApplicationFactory.setTextContent(APPLICATION_FACTORY);
+ newApplicationFactory.setId(CommonStructuresUtil
+ .createPreficedString(APPLICATION_FACTORY, CommonStructuresUtil.ID));
+ newfactory.getApplicationFactory().add(newApplicationFactory);
+ }
+
+ {
+ FacesContextFactoryType facesContextFactory = facesConfigFactory.createFacesContextFactoryType();
+ facesContextFactory.setTextContent(FACESCONTEXT_FACTORY);
+ facesContextFactory.setId(CommonStructuresUtil
+ .createPreficedString(FACESCONTEXT_FACTORY, CommonStructuresUtil.ID));
+ newfactory.getFacesContextFactory().add(facesContextFactory);
+ }
+
+ {
+ LifecycleFactoryType lifecycleFactory = facesConfigFactory.createLifecycleFactoryType();
+ lifecycleFactory.setTextContent(LIFECYCLE_FACTORY);
+ lifecycleFactory.setId(CommonStructuresUtil
+ .createPreficedString(LIFECYCLE_FACTORY, CommonStructuresUtil.ID));
+ newfactory.getLifecycleFactory().add(lifecycleFactory);
+ }
+
+ {
+ RenderKitFactoryType renderKit = facesConfigFactory.createRenderKitFactoryType();
+ renderKit.setTextContent(RENDERKIT_FACTORY);
+ renderKit.setId(CommonStructuresUtil
+ .createPreficedString(RENDERKIT_FACTORY, CommonStructuresUtil.ID));
+ newfactory.getRenderKitFactory().add(renderKit);
+ }
+
+ newfactory.setId(CommonStructuresUtil
+ .createPreficedString(FACTORY, CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getFactory().add(newfactory);
+ edit.save(null);
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getFactory().size());
+
+ FactoryType newFactory =
+ (FactoryType) edit.getFacesConfig().getFactory().get(0);
+
+ {
+ assertEquals(1, newFactory.getApplicationFactory().size());
+ ApplicationFactoryType newApplicationFactory =
+ (ApplicationFactoryType) newFactory.getApplicationFactory().get(0);
+
+ assertEquals(APPLICATION_FACTORY, newApplicationFactory.getTextContent());
+ assertEquals(CommonStructuresUtil
+ .createPreficedString(APPLICATION_FACTORY, CommonStructuresUtil.ID)
+ , newApplicationFactory.getId());
+ }
+
+ {
+ assertEquals(1, newFactory.getFacesContextFactory().size());
+ FacesContextFactoryType facesContextFactory =
+ (FacesContextFactoryType) newFactory.getFacesContextFactory().get(0);
+
+ assertEquals(FACESCONTEXT_FACTORY, facesContextFactory.getTextContent());
+ assertEquals(CommonStructuresUtil
+ .createPreficedString(FACESCONTEXT_FACTORY, CommonStructuresUtil.ID)
+ , facesContextFactory.getId());
+ }
+
+ {
+ assertEquals(1, newFactory.getLifecycleFactory().size());
+ LifecycleFactoryType lifecycleFactory =
+ (LifecycleFactoryType) newFactory.getLifecycleFactory().get(0);
+
+ assertEquals(LIFECYCLE_FACTORY, lifecycleFactory.getTextContent());
+ assertEquals(CommonStructuresUtil
+ .createPreficedString(LIFECYCLE_FACTORY, CommonStructuresUtil.ID)
+ , lifecycleFactory.getId());
+ }
+
+ {
+ assertEquals(1, newFactory.getRenderKitFactory().size());
+ RenderKitFactoryType renderKit =
+ (RenderKitFactoryType) newFactory.getRenderKitFactory().get(0);
+
+ assertEquals(RENDERKIT_FACTORY, renderKit.getTextContent());
+ assertEquals(CommonStructuresUtil
+ .createPreficedString(RENDERKIT_FACTORY, CommonStructuresUtil.ID)
+ ,renderKit.getId());
+ }
+
+ assertEquals(CommonStructuresUtil
+ .createPreficedString(FACTORY, CommonStructuresUtil.ID)
+ ,newFactory.getId());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteLifecycleTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteLifecycleTestCase.java
new file mode 100644
index 0000000..072d025
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteLifecycleTestCase.java
@@ -0,0 +1,101 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.LifecycleType;
+import org.eclipse.jst.jsf.facesconfig.emf.PhaseListenerType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class WriteLifecycleTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+ IProject project = null;
+
+ private final static String LIFECYCLE = "lifecycle";
+ private final static String PHASELISTENER = "phase-listener";
+
+ public WriteLifecycleTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteLifecycle() {
+ FacesConfigArtifactEdit edit = null;
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage
+ .getFacesConfigFactory();
+
+ LifecycleType newLifecycle = facesConfigFactory
+ .createLifecycleType();
+ PhaseListenerType newPhaseListener = facesConfigFactory
+ .createPhaseListenerType();
+ newPhaseListener.setTextContent(PHASELISTENER);
+ newPhaseListener.setId(CommonStructuresUtil.createPreficedString(
+ PHASELISTENER, CommonStructuresUtil.ID));
+ newLifecycle.getPhaseListener().add(newPhaseListener);
+
+ newLifecycle.setId(CommonStructuresUtil.createPreficedString(
+ LIFECYCLE, CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getLifecycle().add(newLifecycle);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getLifecycle().size());
+ LifecycleType newLifecycle =
+ (LifecycleType) edit.getFacesConfig().getLifecycle().get(0);
+
+ assertEquals(1, newLifecycle.getPhaseListener().size());
+ PhaseListenerType newPhaseListener =
+ (PhaseListenerType) newLifecycle.getPhaseListener().get(0);
+
+ assertEquals(PHASELISTENER, newPhaseListener.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(
+ PHASELISTENER, CommonStructuresUtil.ID)
+ , newPhaseListener.getId());
+
+ assertEquals(CommonStructuresUtil.createPreficedString(
+ LIFECYCLE, CommonStructuresUtil.ID)
+ , newLifecycle.getId());
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteManagedBeanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteManagedBeanTestCase.java
new file mode 100644
index 0000000..eefe202
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteManagedBeanTestCase.java
@@ -0,0 +1,412 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanScopeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
+import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
+import org.eclipse.jst.jsf.facesconfig.emf.NullValueType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+public class WriteManagedBeanTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+ IProject project = null;
+
+ private final static String MANAGED_BEAN = "managed-bean";
+ private final static String SCOPE = "scope";
+ private final static String MANAGED_BEAN_NAME =
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN, CommonStructuresUtil.NAME);
+ private final static String MANAGED_BEAN_SCOPE =
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN, SCOPE);
+ private final static String MANAGED_BEAN_CLASS =
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN, CommonStructuresUtil.CLASS);
+ private final static String MANAGED_BEAN_PROPERTY =
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN, "property");
+
+ public WriteManagedBeanTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+
+ FacesConfigArtifactEdit edit = null;
+ try
+ {
+ edit =
+ FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ edit.getFacesConfig().getManagedBean().clear();
+ edit.save(null);
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testWriteManagedBean()
+ {
+ FacesConfigArtifactEdit edit = null;
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ ManagedBeanType managedBean = createManagedBeanBase();
+
+
+ { // null value
+ ManagedPropertyType managedPropWithNullValue =
+ CommonStructuresUtil
+ .createManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("null", MANAGED_BEAN_PROPERTY));
+
+ NullValueType nullValue = facesConfigFactory.createNullValueType();
+ nullValue.setId(
+ CommonStructuresUtil.createPreficedString(
+ CommonStructuresUtil.createPreficedString("null", MANAGED_BEAN_PROPERTY)
+ , CommonStructuresUtil.ID));
+ managedPropWithNullValue.setNullValue(nullValue);
+ managedBean.getManagedProperty().add(managedPropWithNullValue);
+ }
+
+ { // value property
+ ManagedPropertyType managedPropWithValue =
+ CommonStructuresUtil
+ .createManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("value", MANAGED_BEAN_PROPERTY));
+
+ managedPropWithValue.setValue
+ (CommonStructuresUtil.createValue(MANAGED_BEAN_PROPERTY));
+ managedBean.getManagedProperty().add(managedPropWithValue);
+ }
+
+ { // map property
+ ManagedPropertyType managedMapProp =
+ CommonStructuresUtil
+ .createManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("map", MANAGED_BEAN_PROPERTY));
+
+ managedMapProp.setMapEntries(
+ (CommonStructuresUtil.createMapEntries(MANAGED_BEAN_PROPERTY)));
+ managedBean.getManagedProperty()
+ .add(managedMapProp);
+ }
+
+ { // list property
+ ManagedPropertyType managedListProp =
+ CommonStructuresUtil
+ .createManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("list", MANAGED_BEAN_PROPERTY));
+
+ managedListProp.setListEntries(
+ (CommonStructuresUtil.createListEntries(MANAGED_BEAN_PROPERTY)));
+ managedBean.getManagedProperty()
+ .add(managedListProp);
+ }
+
+ edit.getFacesConfig().getManagedBean().add(managedBean);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getManagedBean().size());
+
+ ManagedBeanType managedBean =
+ (ManagedBeanType) edit.getFacesConfig().getManagedBean().get(0);
+
+ assertMatchManagedBeanBase(managedBean);
+
+ assertEquals(4, managedBean.getManagedProperty().size());
+
+ { // null value
+ ManagedPropertyType managedPropWithNullValue =
+ (ManagedPropertyType) managedBean.getManagedProperty().get(0);
+
+ CommonStructuresUtil.assertMatchManagedPropertyBase
+ (CommonStructuresUtil.createPreficedString("null", MANAGED_BEAN_PROPERTY)
+ ,managedPropWithNullValue);
+
+ NullValueType nullValue = managedPropWithNullValue.getNullValue();
+ assertEquals(CommonStructuresUtil.createPreficedString(
+ CommonStructuresUtil.createPreficedString("null", MANAGED_BEAN_PROPERTY)
+ , CommonStructuresUtil.ID)
+ , nullValue.getId());
+ }
+
+ { // value property
+ ManagedPropertyType managedPropWithValue =
+ (ManagedPropertyType) managedBean.getManagedProperty().get(1);
+
+ CommonStructuresUtil.assertMatchManagedPropertyBase
+ (CommonStructuresUtil.createPreficedString("value", MANAGED_BEAN_PROPERTY)
+ ,managedPropWithValue);
+
+ ValueType valueType = managedPropWithValue.getValue();
+ CommonStructuresUtil.assertMatchValue(MANAGED_BEAN_PROPERTY, valueType);
+ }
+
+ { // map property
+ ManagedPropertyType managedMapProp =
+ (ManagedPropertyType) managedBean.getManagedProperty().get(2);
+
+ CommonStructuresUtil
+ .assertMatchManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("map", MANAGED_BEAN_PROPERTY)
+ , managedMapProp);
+
+ CommonStructuresUtil.assertMatchMapEntries(MANAGED_BEAN_PROPERTY
+ ,managedMapProp.getMapEntries());
+ }
+
+ { // list property
+ ManagedPropertyType managedListProp =
+ (ManagedPropertyType) managedBean.getManagedProperty().get(3);
+
+ CommonStructuresUtil
+ .assertMatchManagedPropertyBase(
+ CommonStructuresUtil.createPreficedString("list", MANAGED_BEAN_PROPERTY)
+ , managedListProp);
+
+ CommonStructuresUtil.assertMatchListEntries(MANAGED_BEAN_PROPERTY
+ , managedListProp.getListEntries());
+ }
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testWriteMapManagedBean()
+ {
+ FacesConfigArtifactEdit edit = null;
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedBeanType managedBean = createManagedBeanBase();
+ managedBean.setMapEntries(CommonStructuresUtil.createMapEntries(MANAGED_BEAN));
+
+ edit.getFacesConfig().getManagedBean().add(managedBean);
+ edit.save(null);
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getManagedBean().size());
+ ManagedBeanType managedBean =
+ (ManagedBeanType) edit.getFacesConfig().getManagedBean().get(0);
+
+ assertMatchManagedBeanBase(managedBean);
+ MapEntriesType mapEntries = managedBean.getMapEntries();
+ CommonStructuresUtil.assertMatchMapEntries(MANAGED_BEAN, mapEntries);
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ }
+ }
+ }
+
+ public void testWriteListManagedBean()
+ {
+ FacesConfigArtifactEdit edit = null;
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ ManagedBeanType managedBean = createManagedBeanBase();
+ managedBean.setListEntries(CommonStructuresUtil.createListEntries(MANAGED_BEAN));
+ edit.getFacesConfig().getManagedBean().add(managedBean);
+ edit.save(null);
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getManagedBean().size());
+ ManagedBeanType managedBean =
+ (ManagedBeanType) edit.getFacesConfig().getManagedBean().get(0);
+
+ assertMatchManagedBeanBase(managedBean);
+ ListEntriesType mapEntries = managedBean.getListEntries();
+ CommonStructuresUtil.assertMatchListEntries(MANAGED_BEAN, mapEntries);
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ }
+ }
+ }
+
+ private ManagedBeanType createManagedBeanBase()
+ {
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ ManagedBeanType managedBean = facesConfigFactory.createManagedBeanType();
+
+ managedBean.getDescription().add(CommonStructuresUtil.createDescription(MANAGED_BEAN));
+ managedBean.getDisplayName().add(CommonStructuresUtil.createDisplayName(MANAGED_BEAN));
+ managedBean.getIcon().add(CommonStructuresUtil.createIcon(MANAGED_BEAN));
+
+ {
+ ManagedBeanNameType managedBeanNameType = facesConfigFactory.createManagedBeanNameType();
+ managedBeanNameType.setTextContent(MANAGED_BEAN_NAME);
+ managedBeanNameType.setId(
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN_NAME
+ , CommonStructuresUtil.ID));
+ managedBean.setManagedBeanName(managedBeanNameType);
+ }
+
+ {
+ ManagedBeanClassType managedBeanClassType = facesConfigFactory.createManagedBeanClassType();
+ managedBeanClassType.setTextContent(MANAGED_BEAN_CLASS);
+ managedBeanClassType.setId(
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN_CLASS
+ , CommonStructuresUtil.ID));
+ managedBean.setManagedBeanClass(managedBeanClassType);
+ }
+
+ {
+ ManagedBeanScopeType managedBeanScopeType = facesConfigFactory.createManagedBeanScopeType();
+ managedBeanScopeType.setTextContent(MANAGED_BEAN_SCOPE);
+ managedBeanScopeType.setId(
+ CommonStructuresUtil.createPreficedString(MANAGED_BEAN_SCOPE
+ , CommonStructuresUtil.ID));
+ managedBean.setManagedBeanScope(managedBeanScopeType);
+ }
+
+ return managedBean;
+ }
+
+
+ private void assertMatchManagedBeanBase(ManagedBeanType managedBean)
+ {
+ {
+ assertEquals(1, managedBean.getDescription().size());
+ DescriptionType description =
+ (DescriptionType) managedBean.getDescription().get(0);
+ CommonStructuresUtil.assertMatchesDescription(MANAGED_BEAN, description);
+ }
+
+ {
+ assertEquals(1, managedBean.getDisplayName().size());
+ DisplayNameType displayName =
+ (DisplayNameType) managedBean.getDisplayName().get(0);
+ CommonStructuresUtil.assertMatchesDisplayName(MANAGED_BEAN, displayName);
+ }
+
+ {
+ assertEquals(1, managedBean.getIcon().size());
+ IconType icon =
+ (IconType) managedBean.getIcon().get(0);
+ CommonStructuresUtil.assertMatchesIcon(MANAGED_BEAN, icon);
+ }
+
+ {
+ ManagedBeanNameType managedBeanNameType = managedBean.getManagedBeanName();
+ assertEquals(MANAGED_BEAN_NAME, managedBeanNameType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(MANAGED_BEAN_NAME
+ , CommonStructuresUtil.ID)
+ ,managedBeanNameType.getId());
+ }
+
+ {
+ ManagedBeanClassType managedBeanClassType = managedBean.getManagedBeanClass();
+ assertEquals(MANAGED_BEAN_CLASS, managedBeanClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(MANAGED_BEAN_CLASS
+ , CommonStructuresUtil.ID)
+ , managedBeanClassType.getId());
+ }
+
+ {
+ ManagedBeanScopeType managedBeanScopeType = managedBean.getManagedBeanScope();
+ assertEquals(MANAGED_BEAN_SCOPE, managedBeanScopeType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(MANAGED_BEAN_SCOPE
+ , CommonStructuresUtil.ID)
+ , managedBeanScopeType.getId());
+ }
+ }
+}
+
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteNavigationRuleTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteNavigationRuleTestCase.java
new file mode 100644
index 0000000..f3bacd0
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteNavigationRuleTestCase.java
@@ -0,0 +1,210 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.FromActionType;
+import org.eclipse.jst.jsf.facesconfig.emf.FromOutcomeType;
+import org.eclipse.jst.jsf.facesconfig.emf.FromViewIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
+import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
+import org.eclipse.jst.jsf.facesconfig.emf.ToViewIdType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+public class WriteNavigationRuleTestCase extends TestCase {
+ private static final String NAVIGATION_RULE = "navigation-rule";
+ private static final String FROM_VIEW_ID = "from-view-id";
+ private static final String FROM_VIEW_ID_ID =
+ CommonStructuresUtil.createPreficedString(FROM_VIEW_ID, CommonStructuresUtil.ID);
+
+ private static final String NAVIGATION_CASE = "navigation-case";
+ private static final String FROM_ACTION = "from-action";
+ private static final String NAVIGATION_CASE_FROM_ACTION =
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE,FROM_ACTION);
+ private static final String FROM_OUTCOME = "from-outcome";
+ private static final String NAVIGATION_CASE_FROM_OUTCOME =
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE,FROM_OUTCOME);
+ private static final String TO_VIEW_ID = "from-view-id";
+ private static final String NAVIGATION_CASE_TO_VIEW_ID =
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE,TO_VIEW_ID);
+
+
+ IProject project = null;
+
+ public WriteNavigationRuleTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteNavigationCase() {
+ FacesConfigArtifactEdit edit = null;
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, "WEB-INF/faces-config2.xml");
+ assertNotNull(edit.getFacesConfig());
+
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ NavigationRuleType navigationRule = facesConfigFactory.createNavigationRuleType();
+
+ navigationRule.getDescription().add(CommonStructuresUtil.createDescription(NAVIGATION_RULE));
+ navigationRule.getDisplayName().add(CommonStructuresUtil.createDisplayName(NAVIGATION_RULE));
+ navigationRule.getIcon().add(CommonStructuresUtil.createIcon(NAVIGATION_RULE));
+
+
+ FromViewIdType fromViewIdType = facesConfigFactory.createFromViewIdType();
+ fromViewIdType.setTextContent(FROM_VIEW_ID);
+ fromViewIdType.setId(FROM_VIEW_ID_ID);
+ navigationRule.setFromViewId(fromViewIdType);
+
+ NavigationCaseType navCaseType = facesConfigFactory.createNavigationCaseType();
+
+ navCaseType.getDescription().add(CommonStructuresUtil.createDescription(NAVIGATION_CASE));
+ navCaseType.getDisplayName().add(CommonStructuresUtil.createDisplayName(NAVIGATION_CASE));
+ navCaseType.getIcon().add(CommonStructuresUtil.createIcon(NAVIGATION_CASE));
+
+ {
+ FromActionType fromActionType = facesConfigFactory.createFromActionType();
+ fromActionType.setTextContent(NAVIGATION_CASE_FROM_ACTION);
+ fromActionType.setId(
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_FROM_ACTION
+ , CommonStructuresUtil.ID));
+ navCaseType.setFromAction(fromActionType);
+ }
+
+ {
+ FromOutcomeType fromOutcomeType = facesConfigFactory.createFromOutcomeType();
+ fromOutcomeType.setTextContent(NAVIGATION_CASE_FROM_OUTCOME);
+ fromOutcomeType.setId(
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_FROM_OUTCOME
+ , CommonStructuresUtil.ID));
+ navCaseType.setFromOutcome(fromOutcomeType);
+ }
+
+ {
+ ToViewIdType toViewIdType = facesConfigFactory.createToViewIdType();
+ toViewIdType.setTextContent(NAVIGATION_CASE_TO_VIEW_ID);
+ toViewIdType.setId(
+ CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_TO_VIEW_ID
+ , CommonStructuresUtil.ID));
+ navCaseType.setToViewId(toViewIdType);
+ }
+
+ navigationRule.getNavigationCase().add(navCaseType);
+ navigationRule.setId(CommonStructuresUtil.createPreficedString(NAVIGATION_RULE, CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getNavigationRule().add(navigationRule);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, "WEB-INF/faces-config2.xml");
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getNavigationRule().size());
+ NavigationRuleType navigationRule = (NavigationRuleType)
+ edit.getFacesConfig().getNavigationRule().get(0);
+
+ assertEquals(1, navigationRule.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription
+ (NAVIGATION_RULE, (DescriptionType) navigationRule.getDescription().get(0));
+
+ assertEquals(1, navigationRule.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName
+ (NAVIGATION_RULE, (DisplayNameType) navigationRule.getDisplayName().get(0));
+
+ assertEquals(1, navigationRule.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon
+ (NAVIGATION_RULE, (IconType) navigationRule.getIcon().get(0));
+
+ FromViewIdType fromViewIdType = navigationRule.getFromViewId();
+ assertEquals(FROM_VIEW_ID, fromViewIdType.getTextContent());
+ assertEquals(FROM_VIEW_ID_ID, fromViewIdType.getId());
+
+ assertEquals(1, navigationRule.getNavigationCase().size());
+ NavigationCaseType navCaseType =
+ (NavigationCaseType) navigationRule.getNavigationCase().get(0);
+
+ assertEquals(1, navCaseType.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription(NAVIGATION_CASE
+ ,(DescriptionType)navCaseType.getDescription().get(0));
+
+ assertEquals(1, navCaseType.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName(NAVIGATION_CASE
+ ,(DisplayNameType)navCaseType.getDisplayName().get(0));
+
+ assertEquals(1, navCaseType.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon(NAVIGATION_CASE
+ ,(IconType)navCaseType.getIcon().get(0));
+
+ navCaseType.getIcon().add(CommonStructuresUtil.createIcon(NAVIGATION_CASE));
+
+ {
+ FromActionType fromActionType = navCaseType.getFromAction();
+ assertEquals(NAVIGATION_CASE_FROM_ACTION
+ ,fromActionType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_FROM_ACTION
+ , CommonStructuresUtil.ID)
+ ,fromActionType.getId());
+ }
+
+ {
+ FromOutcomeType fromOutcomeType = navCaseType.getFromOutcome();
+ assertEquals(NAVIGATION_CASE_FROM_OUTCOME, fromOutcomeType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_FROM_OUTCOME
+ , CommonStructuresUtil.ID)
+ ,fromOutcomeType.getId());
+ }
+
+ {
+ ToViewIdType toViewIdType = navCaseType.getToViewId();
+ assertEquals(NAVIGATION_CASE_TO_VIEW_ID, toViewIdType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(NAVIGATION_CASE_TO_VIEW_ID
+ , CommonStructuresUtil.ID)
+ ,toViewIdType.getId());
+ }
+
+ assertEquals(CommonStructuresUtil.createPreficedString(NAVIGATION_RULE, CommonStructuresUtil.ID)
+ , navigationRule.getId());
+ }
+ finally
+ {
+ if (edit != null)
+ {
+ edit.dispose();
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteReferencedBeanTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteReferencedBeanTestCase.java
new file mode 100644
index 0000000..fbed9ff
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteReferencedBeanTestCase.java
@@ -0,0 +1,147 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.ReferencedBeanType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+public class WriteReferencedBeanTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+
+ IProject project = null;
+
+ private final static String REFERENCED_BEAN = "referenced-bean";
+ private final static String REFERENCED_BEAN_NAME =
+ CommonStructuresUtil.createPreficedString(REFERENCED_BEAN, CommonStructuresUtil.NAME);
+ private final static String REFERENCED_BEAN_CLASS =
+ CommonStructuresUtil.createPreficedString(REFERENCED_BEAN, CommonStructuresUtil.CLASS);
+
+ public WriteReferencedBeanTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteReferencedBeanToFileTwo()
+ {
+ FacesConfigArtifactEdit edit = null;
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ ReferencedBeanType referencedBean = facesConfigFactory.createReferencedBeanType();
+
+ referencedBean.getDescription().add(CommonStructuresUtil.createDescription(REFERENCED_BEAN));
+ referencedBean.getDisplayName().add(CommonStructuresUtil.createDisplayName(REFERENCED_BEAN));
+ referencedBean.getIcon().add(CommonStructuresUtil.createIcon(REFERENCED_BEAN));
+
+ {
+ ReferencedBeanNameType referencedBeanNameType =
+ facesConfigFactory.createReferencedBeanNameType();
+ referencedBeanNameType.setTextContent(REFERENCED_BEAN_NAME);
+ referencedBeanNameType.setId(
+ CommonStructuresUtil.createPreficedString(
+ REFERENCED_BEAN_NAME, CommonStructuresUtil.ID));
+ referencedBean.setReferencedBeanName(referencedBeanNameType);
+ }
+
+ {
+ ReferencedBeanClassType referencedBeanClassType =
+ facesConfigFactory.createReferencedBeanClassType();
+ referencedBeanClassType.setTextContent(REFERENCED_BEAN_CLASS);
+ referencedBeanClassType.setId(
+ CommonStructuresUtil.createPreficedString(
+ REFERENCED_BEAN_CLASS, CommonStructuresUtil.ID));
+ referencedBean.setReferencedBeanClass(referencedBeanClassType);
+ }
+
+ referencedBean.setId(
+ CommonStructuresUtil.createPreficedString(REFERENCED_BEAN,CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getReferencedBean().add(referencedBean);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getReferencedBean().size());
+ ReferencedBeanType referencedBean = (ReferencedBeanType)
+ edit.getFacesConfig().getReferencedBean().get(0);
+
+ CommonStructuresUtil.assertMatchesDescription(REFERENCED_BEAN
+ , (DescriptionType) referencedBean.getDescription().get(0));
+ CommonStructuresUtil.assertMatchesDisplayName(REFERENCED_BEAN
+ , (DisplayNameType) referencedBean.getDisplayName().get(0));
+ CommonStructuresUtil.assertMatchesIcon(REFERENCED_BEAN
+ , (IconType) referencedBean.getIcon().get(0));
+
+ {
+ ReferencedBeanNameType referencedBeanNameType =
+ referencedBean.getReferencedBeanName();
+ assertEquals(REFERENCED_BEAN_NAME, referencedBeanNameType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(
+ REFERENCED_BEAN_NAME, CommonStructuresUtil.ID)
+ , referencedBeanNameType.getId());
+ }
+
+ {
+ ReferencedBeanClassType referencedBeanClassType =
+ referencedBean.getReferencedBeanClass();
+ assertEquals(REFERENCED_BEAN_CLASS, referencedBeanClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(
+ REFERENCED_BEAN_CLASS, CommonStructuresUtil.ID)
+ , referencedBeanClassType.getId());
+ }
+
+ assertEquals(CommonStructuresUtil.createPreficedString(REFERENCED_BEAN,CommonStructuresUtil.ID)
+ , referencedBean.getId());
+ }
+ finally
+ {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteRenderKitTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteRenderKitTestCase.java
new file mode 100644
index 0000000..7ce1f22
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteRenderKitTestCase.java
@@ -0,0 +1,241 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.ComponentFamilyType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
+import org.eclipse.jst.jsf.facesconfig.emf.RendererTypeType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+
+public class WriteRenderKitTestCase extends TestCase
+{
+ IProject project = null;
+
+ private final static String RENDER_KIT = "render-kit";
+ private final static String RENDER_KIT_CLASS =
+ CommonStructuresUtil.createPreficedString(RENDER_KIT, CommonStructuresUtil.CLASS);
+ private final static String RENDERER = "renderer";
+ private final static String COMPONENT_FAMILY = "component-family";
+ private final static String RENDERER_COMPONENT_FAMILY =
+ CommonStructuresUtil.createPreficedString(RENDERER, COMPONENT_FAMILY);
+ private final static String RENDERER_TYPE =
+ CommonStructuresUtil.createPreficedString(RENDERER, "type");
+ private final static String RENDERER_CLASS =
+ CommonStructuresUtil.createPreficedString(RENDERER, CommonStructuresUtil.CLASS);
+
+ public WriteRenderKitTestCase(String name) {
+ super(name);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteRenderKit() {
+ //IProject project = WizardUtil.getTestProject();
+ FacesConfigArtifactEdit edit = null;
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, "WEB-INF/faces-config2.xml");
+ assertNotNull(edit.getFacesConfig());
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ RenderKitType renderKit = facesConfigFactory.createRenderKitType();
+
+ renderKit.getDescription().add(CommonStructuresUtil.createDescription(RENDER_KIT));
+ renderKit.getDisplayName().add(CommonStructuresUtil.createDisplayName(RENDER_KIT));
+ renderKit.getIcon().add(CommonStructuresUtil.createIcon(RENDER_KIT));
+
+ {
+ RenderKitIdType renderKitIdType = facesConfigFactory.createRenderKitIdType();
+ renderKitIdType.setTextContent(RENDER_KIT);
+ renderKitIdType.setId
+ (CommonStructuresUtil.createPreficedString(RENDER_KIT, CommonStructuresUtil.ID));
+ renderKit.setRenderKitId(renderKitIdType);
+ }
+
+ {
+ RenderKitClassType renderKitClassType = facesConfigFactory.createRenderKitClassType();
+ renderKitClassType.setTextContent(RENDER_KIT_CLASS);
+ renderKitClassType.setId(
+ CommonStructuresUtil.createPreficedString(RENDER_KIT_CLASS, CommonStructuresUtil.ID));
+ renderKit.setRenderKitClass(renderKitClassType);
+ }
+
+ RendererType renderer = facesConfigFactory.createRendererType();
+
+ renderer.getDescription().add(CommonStructuresUtil.createDescription(RENDERER));
+ renderer.getDisplayName().add(CommonStructuresUtil.createDisplayName(RENDERER));
+ renderer.getIcon().add(CommonStructuresUtil.createIcon(RENDERER));
+
+ {
+ ComponentFamilyType componentFamily =
+ facesConfigFactory.createComponentFamilyType();
+ componentFamily.setTextContent(RENDERER_COMPONENT_FAMILY);
+ componentFamily.setId(
+ CommonStructuresUtil.createPreficedString(RENDERER_COMPONENT_FAMILY, CommonStructuresUtil.ID));
+ renderer.setComponentFamily(componentFamily);
+ }
+
+ {
+ RendererTypeType rendererTypeType = facesConfigFactory.createRendererTypeType();
+ rendererTypeType.setTextContent(RENDERER_TYPE);
+ rendererTypeType.setId(
+ CommonStructuresUtil.createPreficedString(RENDERER_TYPE, CommonStructuresUtil.ID));
+ renderer.setRendererType(rendererTypeType);
+ }
+
+ {
+ RendererClassType rendererClassType = facesConfigFactory.createRendererClassType();
+ rendererClassType.setTextContent(RENDERER_CLASS);
+ rendererClassType.setId(
+ CommonStructuresUtil.createPreficedString(RENDERER_CLASS, CommonStructuresUtil.ID));
+ renderer.setRendererClass(rendererClassType);
+ }
+
+ renderer.getAttribute().add(CommonStructuresUtil.createAttribute(RENDERER));
+ renderer.getFacet().add(CommonStructuresUtil.createFacet(RENDERER));
+ renderer.setId(CommonStructuresUtil.createPreficedString(RENDERER, CommonStructuresUtil.ID));
+
+ renderKit.getRenderer().add(renderer);
+ renderKit.setId(CommonStructuresUtil.createPreficedString(RENDER_KIT, CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getRenderKit().add(renderKit);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, "WEB-INF/faces-config2.xml");
+ assertNotNull(edit.getFacesConfig());
+ assertEquals(1, edit.getFacesConfig().getRenderKit().size());
+
+ RenderKitType renderKit =
+ (RenderKitType) edit.getFacesConfig().getRenderKit().get(0);
+
+ assertEquals(1, renderKit.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription(RENDER_KIT,
+ (DescriptionType) renderKit.getDescription().get(0));
+
+ assertEquals(1, renderKit.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName(RENDER_KIT,
+ (DisplayNameType) renderKit.getDisplayName().get(0));
+
+ assertEquals(1, renderKit.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon(RENDER_KIT,
+ (IconType) renderKit.getIcon().get(0));
+
+ {
+
+ RenderKitIdType renderKitIdType = renderKit.getRenderKitId();
+ assertEquals(RENDER_KIT, renderKitIdType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDER_KIT, CommonStructuresUtil.ID)
+ , renderKitIdType.getId());
+ }
+
+ {
+ RenderKitClassType renderKitClassType = renderKit.getRenderKitClass();
+ assertEquals(RENDER_KIT_CLASS, renderKitClassType.getTextContent());
+ assertEquals(
+ CommonStructuresUtil.createPreficedString(RENDER_KIT_CLASS, CommonStructuresUtil.ID)
+ ,renderKitClassType.getId());
+ }
+
+ assertEquals(1, renderKit.getRenderer().size());
+ RendererType renderer = (RendererType) renderKit.getRenderer().get(0);
+
+ assertEquals(1, renderer.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription(RENDERER
+ ,(DescriptionType) renderer.getDescription().get(0));
+
+ assertEquals(1, renderer.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName(RENDERER
+ , (DisplayNameType) renderer.getDisplayName().get(0));
+
+ assertEquals(1, renderer.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon(RENDERER
+ , (IconType) renderer.getIcon().get(0));
+
+ {
+ ComponentFamilyType componentFamily = renderer.getComponentFamily();
+
+ assertEquals(RENDERER_COMPONENT_FAMILY
+ , componentFamily.getTextContent());
+
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDERER_COMPONENT_FAMILY, CommonStructuresUtil.ID)
+ , componentFamily.getId());
+ }
+
+ {
+ RendererTypeType rendererTypeType = renderer.getRendererType();
+ assertEquals(RENDERER_TYPE
+ , rendererTypeType.getTextContent());
+
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDERER_TYPE, CommonStructuresUtil.ID)
+ , rendererTypeType.getId());
+ }
+
+ {
+ RendererClassType rendererClassType = renderer.getRendererClass();
+ assertEquals(RENDERER_CLASS, rendererClassType.getTextContent());
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDERER_CLASS, CommonStructuresUtil.ID)
+ , rendererClassType.getId());
+ }
+
+ assertEquals(1, renderer.getAttribute().size());
+ CommonStructuresUtil.assertMatchAttribute(RENDERER
+ , (AttributeType) renderer.getAttribute().get(0));
+
+ assertEquals(1, renderer.getFacet().size());
+ CommonStructuresUtil.assertMatchFacet(RENDERER
+ , (FacetType) renderer.getFacet().get(0));
+
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDERER, CommonStructuresUtil.ID)
+ , renderer.getId());
+
+ assertEquals(CommonStructuresUtil.createPreficedString(RENDER_KIT, CommonStructuresUtil.ID)
+ , renderKit.getId());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteValidatorTestCase.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteValidatorTestCase.java
new file mode 100644
index 0000000..ec1e4ec
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/write/WriteValidatorTestCase.java
@@ -0,0 +1,161 @@
+/***************************************************************************************************
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ **************************************************************************************************/
+package org.eclipse.jst.jsf.facesconfig.tests.write;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
+import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
+import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
+import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
+import org.eclipse.jst.jsf.facesconfig.emf.IconType;
+import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorClassType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorIdType;
+import org.eclipse.jst.jsf.facesconfig.emf.ValidatorType;
+import org.eclipse.jst.jsf.facesconfig.tests.util.CommonStructuresUtil;
+import org.eclipse.jst.jsf.facesconfig.tests.util.WizardUtil;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+
+public class WriteValidatorTestCase extends TestCase {
+ private static final String WEB_INF_FACES_CONFIG2_XML = "WEB-INF/faces-config2.xml";
+ IProject project = null;
+
+ private final static String VALIDATOR = "validator";
+ private final static String VALIDATOR_CLASS =
+ CommonStructuresUtil.createPreficedString(VALIDATOR, CommonStructuresUtil.CLASS);
+ private final static String VALIDATOR_ID =
+ CommonStructuresUtil.createPreficedString(VALIDATOR, CommonStructuresUtil.ID);
+
+ public WriteValidatorTestCase(String name) {
+ super(name);
+ }
+ protected void setUp() throws Exception {
+ super.setUp();
+ WizardUtil.createProject(getName());
+ project = WizardUtil.getTestProject(getName());
+ }
+
+ public void testWriteValidator()
+ {
+ FacesConfigArtifactEdit edit = null;
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForWrite(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ FacesConfigPackage facesConfigPackage = FacesConfigPackage.eINSTANCE;
+ FacesConfigFactory facesConfigFactory = facesConfigPackage.getFacesConfigFactory();
+
+ ValidatorType validator = facesConfigFactory.createValidatorType();
+
+ {
+ ValidatorIdType validatorIdType = facesConfigFactory.createValidatorIdType();
+ validatorIdType.setTextContent(VALIDATOR_ID);
+ validatorIdType.setId(
+ CommonStructuresUtil.createPreficedString(VALIDATOR_ID, CommonStructuresUtil.ID));
+ validator.setValidatorId(validatorIdType);
+ }
+
+ {
+ ValidatorClassType validatorClassType = facesConfigFactory.createValidatorClassType();
+ validatorClassType.setTextContent(VALIDATOR_CLASS);
+ validatorClassType.setId(
+ CommonStructuresUtil.createPreficedString(VALIDATOR_CLASS, CommonStructuresUtil.ID));
+ validator.setValidatorClass(validatorClassType);
+ }
+
+ validator.getDescription().add(
+ CommonStructuresUtil.createDescription(VALIDATOR));
+ validator.getDisplayName().add(
+ CommonStructuresUtil.createDisplayName(VALIDATOR));
+ validator.getIcon().add(
+ CommonStructuresUtil.createIcon(VALIDATOR));
+
+ validator.getAttribute().add(
+ CommonStructuresUtil.createAttribute(VALIDATOR));
+ validator.getProperty().add(
+ CommonStructuresUtil.createProperty(VALIDATOR));
+
+ validator.setId(CommonStructuresUtil.createPreficedString(VALIDATOR, CommonStructuresUtil.ID));
+
+ edit.getFacesConfig().getValidator().add(validator);
+ edit.save(null);
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ assertTrue(edit.isDisposed());
+ edit = null;
+ }
+ }
+
+ try
+ {
+ edit = FacesConfigArtifactEdit.getFacesConfigArtifactEditForRead(
+ project, WEB_INF_FACES_CONFIG2_XML);
+ assertNotNull(edit.getFacesConfig());
+
+ assertEquals(1, edit.getFacesConfig().getValidator().size());
+ ValidatorType validator =
+ (ValidatorType) edit.getFacesConfig().getValidator().get(0);
+
+ {
+ ValidatorIdType validatorIdType = validator.getValidatorId();
+ assertEquals(VALIDATOR_ID, validatorIdType.getTextContent());
+ assertEquals(
+ CommonStructuresUtil.createPreficedString(VALIDATOR_ID, CommonStructuresUtil.ID)
+ , validatorIdType.getId()
+ );
+ }
+
+ {
+ ValidatorClassType validatorClassType = validator.getValidatorClass();
+
+ assertEquals(VALIDATOR_CLASS, validatorClassType.getTextContent());
+ assertEquals(
+ CommonStructuresUtil.createPreficedString(VALIDATOR_CLASS, CommonStructuresUtil.ID)
+ , validatorClassType.getId());
+ }
+
+ assertEquals(1, validator.getDescription().size());
+ CommonStructuresUtil.assertMatchesDescription(VALIDATOR
+ , (DescriptionType) validator.getDescription().get(0));
+
+ assertEquals(1, validator.getDisplayName().size());
+ CommonStructuresUtil.assertMatchesDisplayName(VALIDATOR
+ , (DisplayNameType) validator.getDisplayName().get(0));
+
+ assertEquals(1, validator.getIcon().size());
+ CommonStructuresUtil.assertMatchesIcon(VALIDATOR
+ , (IconType) validator.getIcon().get(0));
+
+ assertEquals(1, validator.getAttribute().size());
+ CommonStructuresUtil.assertMatchAttribute(VALIDATOR
+ , (AttributeType) validator.getAttribute().get(0));
+
+ assertEquals(1, validator.getProperty().size());
+ CommonStructuresUtil.assertMatchProperty(VALIDATOR
+ , (PropertyType) validator.getProperty().get(0));
+
+ assertEquals(CommonStructuresUtil.createPreficedString(VALIDATOR, CommonStructuresUtil.ID)
+ , validator.getId());
+
+ } finally {
+ if (edit != null) {
+ edit.dispose();
+ }
+ }
+ }
+}
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config-ext-data1.xml b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config-ext-data1.xml
new file mode 100644
index 0000000..7c511c3
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config-ext-data1.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+
+<!--
+ Copyright 2003 Sun Microsystems, Inc. All rights reserved.
+ SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+-->
+
+<!DOCTYPE faces-config PUBLIC
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
+
+<!-- =========== FULL CONFIGURATION FILE ================================== -->
+
+<faces-config>
+ <component id="component1">
+ <component-type>component</component-type>
+ <component-class>componentClass</component-class>
+ <component-extension id="singleRootComponentExt">
+ <any-data attribute="any-data-attribute">
+ <first-child>someData</first-child>
+ <second-child>second Child's data</second-child>
+ </any-data>
+ </component-extension>
+ </component>
+
+</faces-config> \ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml
index a03e1ca..3b86aa2 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml
@@ -6,43 +6,55 @@
-->
<!DOCTYPE faces-config PUBLIC
- "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
- <lifecycle>
- <phase-listener>
+ <lifecycle id="lifecycle1">
+ <phase-listener id="phaseListener1">
org.eclipse.wtp.jsf.tests.ValueResourcePhaseListener
</phase-listener>
</lifecycle>
- <factory>
-
- <application-factory>application-factory</application-factory><faces-context-factory>
+ <factory id="factory1">
+ <application-factory id="applicationFactory1">application-factory</application-factory>
+ <faces-context-factory id="facesContextFactory1">
faces-context-factory
</faces-context-factory>
- <lifecycle-factory>lifecycle-factory</lifecycle-factory>
- <render-kit-factory>render-kit-factory</render-kit-factory>
+ <lifecycle-factory id="lifecycleFactory1">lifecycle-factory</lifecycle-factory>
+ <render-kit-factory id="renderKitFactory1">render-kit-factory</render-kit-factory>
</factory>
<!-- Component -->
- <component>
- <description>my component</description>
- <display-name>My component</display-name>
- <icon>
- <small-icon>icon2</small-icon>
+ <component id="component1">
+ <description id="componentDescription1">my component</description>
+ <display-name id="componentDisplayName1">My component</display-name>
+ <icon id="componentIcon1">
+ <small-icon>small-icon</small-icon>
+ <large-icon>large-icon</large-icon>
</icon>
<component-type>component-type</component-type>
<component-class>ComponentClass</component-class>
- <attribute>
- <description>attribute-description</description>
- <display-name>attribute-display-name</display-name>
- <icon>
- <small-icon>attribute-icon</small-icon>
+ <facet id="componentFacet1">
+ <description id="componentFacet1_descripton1">Facet1 Description</description>
+ <display-name id="componentFacet1_displayName1">Component Facet 1</display-name>
+ <icon id="componentFacet1_icon1">
+ <small-icon>facet-small-icon</small-icon>
+ <large-icon>facet-large-icon</large-icon>
+ </icon>
+ <facet-name>facetName_chieb_sieb</facet-name>
+ <facet-extension><extendedBlah></extendedBlah></facet-extension>
+ </facet>
+ <attribute id="componentAttribute1">
+ <description id="componentAttribute1_descripton1">attribute-description</description>
+ <display-name id="componentAttribute1_displayName1">attribute-display-name</display-name>
+ <icon id="componentAttribute1_icon1">
+ <small-icon>attribute-small-icon</small-icon>
+ <large-icon>attribute-large-icon</large-icon>
</icon>
<attribute-name>attribute-name</attribute-name>
<attribute-class>attribute-class</attribute-class>
@@ -50,83 +62,155 @@
<suggested-value>attribute-suggested-value</suggested-value>
<attribute-extension>attr - extension</attribute-extension>
</attribute>
- <property>
- <property-name>property1</property-name>
- <property-class>ComponentProperty</property-class>
- <default-value>value6</default-value>
+ <property id="componentProperty1">
+ <description id="componentProperty1_descripton1">myDescript blah blah</description>
+ <display-name id="componentProperty1_displayName1">Component Property 1</display-name>
+ <icon id="componentProperty1_icon1">
+ <small-icon>property-small-icon</small-icon>
+ <large-icon>property-large-icon</large-icon>
+ </icon>
+ <property-name id="componentProperty1_propertyName">property1</property-name>
+ <property-class id="componentProperty1_propertyClass">ComponentProperty</property-class>
+ <default-value>defaultValue6</default-value>
+ <suggested-value>suggestedValue</suggested-value>
</property>
- <component-extension>component-extension</component-extension>
-
+ <component-extension id="componentExtension1"><foo></foo></component-extension>
</component>
<!-- managed-bean -->
- <managed-bean>
- <description>managed-bean-description</description>
- <display-name>managed-bean-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+ <managed-bean id="managedBean1">
+ <description id="managedBean1Description">managed-bean-description</description>
+ <display-name id="managedBean1DisplayName">managed-bean-display-name</display-name>
+ <icon id="managedBean1Icon">
+ <small-icon>managedBean1-small-icon</small-icon>
+ <large-icon>managedBean1-large-icon</large-icon>
</icon>
<managed-bean-name>managed-bean-name</managed-bean-name>
<managed-bean-class>managed-bean-class</managed-bean-class>
- <managed-bean-scope>managed-bean-scope</managed-bean-scope>
- <managed-property>
- <description>managed-property-description</description>
- <display-name>managed-property-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+ <managed-bean-scope>request</managed-bean-scope>
+ <managed-property id="managedBean1Property1">
+ <description id="managedBean1Property1_description">managed-property-description</description>
+ <display-name id="managedBean1Property1_displayName">managed-property-display-name</display-name>
+ <icon id="managedBean1Property1_icon">
+ <small-icon>managedBean1-property-small-icon</small-icon>
+ <large-icon>managedBean1-property-large-icon</large-icon>
</icon>
- <property-name>property-name</property-name>
- <property-class>property-class</property-class>
- <null-value />
+ <property-name>bean-property-name</property-name>
+ <property-class>bean-property-class</property-class>
+ <value>bean-propertyValue1</value>
+ </managed-property>
+ <managed-property id="managedBean1Property2">
+ <property-name>bean-property2-name</property-name>
+ <property-class>bean-property2-class</property-class>
+ <null-value/>
+ </managed-property>
+ <managed-property id="managedBeanMapProperty">
+ <property-name>map-bean-name</property-name>
+ <property-class>map-bean-class</property-class>
+ <map-entries>
+ <key-class>propertyMapEntryKey</key-class>
+ <value-class>propertyMapEntryValueClass</value-class>
+ <map-entry id="mapPropertyEntryWithValue">
+ <key>propertyMapKey1</key>
+ <value>propertyMapValue1</value>
+ </map-entry>
+ <map-entry id="mapPropertyEntryWithNullValue">
+ <key>propertyMapKey2</key>
+ <null-value/>
+ </map-entry>
+ </map-entries>
+ </managed-property>
+ <managed-property id="managedBeanListProperty">
+ <property-name>list-bean-name</property-name>
+ <property-class>list-bean-class</property-class>
+ <list-entries>
+ <value-class>managedBeanListPropertyClass</value-class>
+ <value id="managedBeanListProperty_value">managedBeanListPropertyValue</value>
+ <null-value/>
+ </list-entries>
</managed-property>
</managed-bean>
- <converter>
- <description>converter-description</description>
- <display-name>converter-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+
+ <managed-bean id="mapBean1">
+ <managed-bean-name>mapBean1</managed-bean-name>
+ <managed-bean-class>mapBean1-class</managed-bean-class>
+ <managed-bean-scope>mapBean1-scope</managed-bean-scope>
+ <map-entries>
+ <key-class>mapBeanEntryKey</key-class>
+ <value-class>mapBeanEntryValueClass</value-class>
+ <map-entry id="mapBeanEntryWithValue">
+ <key>mapBeanKey1</key>
+ <value>mapBeanValue1</value>
+ </map-entry>
+ <map-entry id="mapBeanEntryWithNullValue">
+ <key>mapBeanKey2</key>
+ <null-value/>
+ </map-entry>
+ </map-entries>
+ </managed-bean>
+
+ <managed-bean id="listBean1">
+ <managed-bean-name>listBean1</managed-bean-name>
+ <managed-bean-class>listBean1-class</managed-bean-class>
+ <managed-bean-scope>listBean1-scope</managed-bean-scope>
+ <list-entries>
+ <value-class>listBeanListPropertyClass</value-class>
+ <value id="listBeanListProperty_value">listBeanListPropertyValue</value>
+ <null-value/>
+ </list-entries>
+ </managed-bean>
+
+ <converter id="converter1">
+ <description id="converter1Description">converter-description</description>
+ <display-name id="converter1DisplayName">converter-display-name</display-name>
+ <icon id="converter1Icon">
+ <small-icon>converter-small-icon</small-icon>
+ <large-icon>converter-large-icon</large-icon>
</icon>
-
<converter-for-class>converter-for-class</converter-for-class>
<converter-class>converter-class</converter-class>
- <attribute>
- <description>attribute-description</description>
- <description>desc 2</description>
- <description>desc 3</description>
-
- <description>desc 4</description>
- <description>desc 5</description>
- <description>desc 6</description>
- <description>desc 7</description>
-
-
-
- <display-name>attribute-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+ <attribute id="converter1Attribute">
+ <description id="converter1_attribute_description">converter-attribute-description</description>
+ <display-name id="converter1_attribute_display-name">converter-attribute-display-name</display-name>
+ <icon id="converter1_attribute_icon">
+ <small-icon>converter1-attribute-small-icon</small-icon>
+ <large-icon>converter1-attribute-large-icon</large-icon>
</icon>
- <attribute-name>attribute-name</attribute-name>
- <attribute-class>attribute-class</attribute-class>
- <default-value>default-value</default-value>
- <suggested-value>attribute-suggested-value</suggested-value>
+ <attribute-name>converter1-attribute-name</attribute-name>
+ <attribute-class>converter1-attribute-class</attribute-class>
+ <default-value>converter1-default-value</default-value>
+ <suggested-value>converter1-attribute-suggested-value</suggested-value>
<attribute-extension>
attribute-extension
</attribute-extension>
</attribute>
- <property>
- <property-name>property1</property-name>
- <property-class>MyPropertyClass</property-class>
- <default-value>value4</default-value>
+ <property id="converter1Property">
+ <description id="converter1_property_description">converter-property-description</description>
+ <display-name id="converter1_property_display-name">converter-property-display-name</display-name>
+ <icon id="converter1_property_icon">
+ <small-icon>converter1-property-small-icon</small-icon>
+ <large-icon>converter1-property-large-icon</large-icon>
+ </icon>
+ <property-name>converter-property-name</property-name>
+ <property-class>converter-property-propertyClass</property-class>
+ <default-value>converter-property-default-value</default-value>
+ <suggested-value>converter-property-suggested-value</suggested-value>
</property>
</converter>
+ <converter id="converter2">
+ <converter-id>converter2-id</converter-id>
+ <converter-class>converter2-class</converter-class>
+ </converter>
+
<!-- Referenced-bean -->
- <referenced-bean>
- <description>Bean Desc</description>
- <display-name>referenced-bean-display</display-name>
- <icon>
- <small-icon>referenced-bean-myicon</small-icon>
+ <referenced-bean id="referencedBean1">
+ <description id="referencedBean1Description">Referenced Bean Desc</description>
+ <display-name id="referencedBean1DisplayName">referenced-bean-display</display-name>
+ <icon id="referencedBean1Icon">
+ <small-icon>referenced-bean-small-icon</small-icon>
+ <large-icon>referenced-bean-large-icon</large-icon>
</icon>
<referenced-bean-name>
referenced-bean-name
@@ -137,33 +221,46 @@
</referenced-bean>
<!-- Render kit -->
- <render-kit>
- <description>Render kit Desc</description>
- <display-name>Render kit disp name</display-name>
- <icon>
- <small-icon>icon</small-icon>
+ <render-kit id="renderKit1">
+ <description id="renderKit1Description">Render kit Desc</description>
+ <display-name id="renderKit1DisplayName">Render kit disp name</display-name>
+ <icon id="renderKit1Icon">
+ <small-icon>small-renderkit-icon</small-icon>
+ <large-icon>large-renderkit-icon</large-icon>
</icon>
<render-kit-id>render-kit-Id</render-kit-id>
<render-kit-class>render-kit-class</render-kit-class>
- <renderer>
- <description>my renderer</description>
-
- <display-name>my renderer</display-name>
- <icon>
- <small-icon>new icon</small-icon>
+ <renderer id="renderKit1Renderer">
+ <description id="renderKit1RendererDescription">my renderer description</description>
+ <display-name id="renderKit1RendererDisplayName">my renderer display name</display-name>
+ <icon id="renderKit1RendererIcon">
+ <small-icon>renderer-small-icon</small-icon>
+ <large-icon>renderer-large-icon</large-icon>
</icon>
<component-family>component-family</component-family>
<renderer-type>renderer-type</renderer-type>
<renderer-class>renderer-class</renderer-class>
- <attribute>
- <description>attribute-description</description>
- <display-name>attribute-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+ <facet id="renderKit1Renderer1Facet1">
+ <description id="renderKit1Renderer1Facet1Description">RendererFacetDescription</description>
+ <display-name id="renderKit1Renderer1Facet1DisplayName">RendererFacetDisplayName</display-name>
+ <icon id="renderKit1Renderer1Facet1Icon">
+ <small-icon>facet-renderer-small-icon</small-icon>
+ <large-icon>facet-renderer-large-icon</large-icon>
+ </icon>
+ <facet-name>rendererFacetName</facet-name>
+ <facet-extension></facet-extension>
+ </facet>
+ <attribute id="renderKit1RendererAttribute1">
+ <description id="renderKit1RendererAttribute1Description">renderer-attribute-attribute-description</description>
+ <display-name id="renderKit1RendererAttribute1DisplayName">renderer-attribute-display-name</display-name>
+ <icon id="renderKit1RendererAttribute1Icon">
+ <small-icon>renderer-attribute-small-icon</small-icon>
+ <large-icon>renderer-attribute-large-icon</large-icon>
</icon>
- <attribute-name>attribute name</attribute-name>
- <attribute-class>Attribute Class</attribute-class>
- <default-value>default value</default-value>
+ <attribute-name>renderer attribute name</attribute-name>
+ <attribute-class>renderer Attribute Class</attribute-class>
+ <default-value>renderer attribute default value</default-value>
+ <suggested-value>renderer attribute suggested value</suggested-value>
<attribute-extension>
renderer-extension
</attribute-extension>
@@ -185,55 +282,64 @@
</render-kit>
<!-- Validator rules -->
- <validator>
- <description>validator-description</description>
- <display-name>validator-display-name</display-name>
- <icon>
- <small-icon>icon1</small-icon>
+ <validator id="validator1">
+ <description id="validator1_description">validator-description</description>
+ <display-name id="validator1_displayName">validator-display-name</display-name>
+ <icon id="validator1_icon">
+ <small-icon>validator-small-icon</small-icon>
+ <large-icon>validator-large-icon</large-icon>
</icon>
<validator-id>validator-Id</validator-id>
<validator-class>validator-class</validator-class>
- <attribute>
- <description>attribute-description</description>
- <display-name>attribute-display-name</display-name>
- <icon>
- <large-icon>large-icon</large-icon>
+ <attribute id="validator1_attribute">
+ <description id="validator1_attribute_description">validator-attribute-description</description>
+ <display-name id="validator1_attribute_displayName">validator-attribute-display-name</display-name>
+ <icon id="validator1_attribute_icon">
+ <small-icon>validator-attribute-small-icon</small-icon>
+ <large-icon>validator-attribute-large-icon</large-icon>
</icon>
<attribute-name>validator-attribute-name</attribute-name>
<attribute-class>validator-attribute-class</attribute-class>
- <default-value>default-value</default-value>
- <suggested-value>attribute-suggested-value</suggested-value>
+ <default-value>validator-default-value</default-value>
+ <suggested-value>validator-attribute-suggested-value</suggested-value>
<attribute-extension>
attribute-extension
</attribute-extension>
</attribute>
- <property>
- <property-name>property-name</property-name>
- <property-class>property-class</property-class>
- <default-value>value4</default-value>
+ <property id="validator1_property">
+ <description id="validator1_property_description">validator-property-description</description>
+ <display-name id="validator1_property_displayName">validator-property-display-name</display-name>
+ <icon id="validator1_property_icon">
+ <small-icon>validator-property-small-icon</small-icon>
+ <large-icon>validator-property-large-icon</large-icon>
+ </icon>
+ <property-name>validator-property-name</property-name>
+ <property-class>validator-property-class</property-class>
+ <default-value>validator property default value</default-value>
+ <suggested-value>validator property suggested value</suggested-value>
+ <property-extension>future</property-extension>
</property>
</validator>
<!-- variable/property resolver registration -->
- <application>
- <action-listener>Action listener</action-listener>
- <variable-resolver>
+ <application id="application1">
+ <action-listener id="actionListener1">Action listener</action-listener>
+ <variable-resolver id="variableResolver1">
com.ibm.faces.databind.SelectItemsVarResolver
</variable-resolver>
- <default-render-kit-id>some renderer kit</default-render-kit-id>
- <message-bundle>some messeage bundle goes here</message-bundle>
- <navigation-handler>navigation handler</navigation-handler>
- <view-handler>view handler</view-handler>
- <state-manager>state manager</state-manager>
+ <default-render-kit-id id="defaultRenderKit1">some renderer kit</default-render-kit-id>
+ <message-bundle id="messageBundle1">some messeage bundle goes here</message-bundle>
+ <navigation-handler id="navigationHandler1">navigation handler</navigation-handler>
+ <view-handler id="viewHandler1">view handler</view-handler>
+ <state-manager id="stateManager1">state manager</state-manager>
- <property-resolver>
+ <property-resolver id="propertyResolver1">
com.ibm.faces.databind.SelectItemsPropResolver
</property-resolver>
- <locale-config>
- <default-locale>en</default-locale>
- <supported-locale>en</supported-locale>
- <supported-locale>de</supported-locale>
-
+ <locale-config id="localeConfig1">
+ <default-locale id="defaultLocale1">en</default-locale>
+ <supported-locale id="supportedLocale_en">en</supported-locale>
+ <supported-locale id="supportedLocale_de">de</supported-locale>
</locale-config>
</application>
@@ -254,11 +360,56 @@
<icon>
<small-icon>small-icon</small-icon>
</icon>
- <from-action>from-action</from-action>
+ <from-action>#{from-action}</from-action>
<from-outcome>drilldown</from-outcome>
<to-view-id>/edit.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <display-name>second navigation case</display-name>
+ <icon>
+ <small-icon>small-icon</small-icon>
+ </icon>
+ <from-action>action2</from-action>
+ <from-outcome>outcome2</from-outcome>
+ <to-view-id>/edit2.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
-
+ <navigation-rule>
+ <description xml:lang="en">A navigation rule with lang attributes</description>
+ <description xml:lang="en-US">What color is it?</description>
+ <description xml:lang="en-GB">What colour is it?</description>
+ <description xml:lang="fr">Quelle couleur est lui?</description>
+ <display-name xml:lang="en">English Display Name</display-name>
+ <display-name xml:lang="fr">Nom D'Affichage De Français</display-name>
+
+ <icon xml:lang="en">
+ <small-icon>en_small-icon</small-icon>
+ <large-icon>en_large-icon</large-icon>
+ </icon>
+ <icon>
+ <small-icon>small-icon</small-icon>
+ <large-icon>large-icon</large-icon>
+ </icon>
+ <from-view-id>/Page1.jsp</from-view-id>
+ <navigation-case>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <description>nav case descr 2</description>
+ <display-name>second navigation rule navcase</display-name>
+ <icon>
+ <small-icon>small-icon</small-icon>
+ </icon>
+ <from-action>action3</from-action>
+ <from-outcome>outcome3</from-outcome>
+ <to-view-id>/edit3.jsp</to-view-id>
</navigation-case>
</navigation-rule>
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml
index b16a446..d369f6c 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml
@@ -6,8 +6,8 @@
-->
<!DOCTYPE faces-config PUBLIC
- "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml
index 17ec73c..894a088 100644
--- a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml
@@ -6,8 +6,8 @@
-->
<!DOCTYPE faces-config PUBLIC
- "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
- "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+ "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
+ "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->

Back to the top