diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.classpath b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.cvsignore b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.project b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.project
new file mode 100644
index 0000000..1af8ce9
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.jst.jsf.facesconfig.tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
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
new file mode 100644
index 0000000..b7e696a
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JSF FacesConfig Tests Plug-in
+Bundle-SymbolicName: org.eclipse.jst.jsf.facesconfig.tests;singleton:=true
+Bundle-Version: 0.5.0.qualifier
+Bundle-Activator: org.eclipse.jst.jsf.facesconfig.tests.TestsPlugin
+Bundle-Vendor: Eclipse.org
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.emf.edit.ui;visibility:=reexport,
+ org.eclipse.gef,
+ org.eclipse.jst.common.frameworks,
+ org.eclipse.jst.j2ee,
+ org.eclipse.jst.j2ee.core,
+ org.eclipse.jst.j2ee.web,
+ org.eclipse.ui,
+ org.eclipse.ui.ide;visibility:=reexport,
+ org.eclipse.ui.views,
+ org.eclipse.wst.common.emf,
+ org.eclipse.wst.common.emfworkbench.integration,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.wst.common.frameworks.ui,
+ org.eclipse.wst.common.modulecore,
+ org.eclipse.wst.sse.core,
+ org.eclipse.wst.validation,
+ org.eclipse.wst.xml.core,
+ org.junit,
+ org.eclipse.jst.jsf.facesconfig
+Eclipse-AutoStart: true
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/_readme.txt b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/_readme.txt
new file mode 100644
index 0000000..10c9fc4
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/_readme.txt
@@ -0,0 +1 @@
+Requires plugin "org.eclipse.wst.common.tests.collector" in same workbench instance.
\ No newline at end of file
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/plugin.xml b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/plugin.xml
new file mode 100644
index 0000000..071b965
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/plugin.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+   <extension
+         point="org.eclipse.wst.common.tests.collector.suites">
+         <suite
+            class="org.eclipse.jst.jsf.facesconfig.tests.AllFacesConfigTests"
+            name="org.eclipse.jst.jsf.facesconfig.tests">
+         </suite>
+   </extension>
+</plugin>
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
new file mode 100644
index 0000000..8348bd8
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/AllFacesConfigTests.java
@@ -0,0 +1,40 @@
+/***************************************************************************************************
+ * 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;
+import junit.textui.TestRunner;
+
+
+/**
+ * Container for all JSF tooling unit tests.
+ *
+ * @author spaxton
+ */
+public class AllFacesConfigTests extends TestSuite {
+
+	public static void main(String[] args) {
+		TestRunner.run(suite());
+	}
+
+	public static Test suite() {
+		return new AllFacesConfigTests();
+	}
+
+	public AllFacesConfigTests() {
+		super();
+		addTest(FacesConfigTests.suite());
+		addTest(FacesConfigTestsForWrite.suite());
+		//FacesConfigTestsForWriteMultipleFiles
+		addTest(FacesConfigTestsForWriteMultipleFiles.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
new file mode 100644
index 0000000..3ee9fb8
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigApplicationTest.java
@@ -0,0 +1,31 @@
+/***************************************************************************************************
+ * 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/FacesConfigElementsTest.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigElementsTest.java
new file mode 100644
index 0000000..6209e86
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigElementsTest.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;
+
+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.util.FacesConfigArtifactEdit;
+
+/*
+ * This Junit class is used to test the FacesConfigFactoryImpl
+ * class. 
+ * 
+ */
+public class FacesConfigElementsTest extends TestCase {
+	IProject project = null;
+
+	public FacesConfigElementsTest(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		project = WizardUtil.getTestProject();
+	}
+
+	public static Test suite() {
+		return new TestSuite(FacesConfigElementsTest.class);
+	}
+
+	/*
+	 * Test the applicaion element of faces-config.xml
+	 * 
+	 */
+	public void testApplication() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList app = edit.getFacesConfig().getApplication();
+				assertTrue(!app.isEmpty() && app.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+
+	/*
+	 * Test the factory element of faces-config.xml
+	 * 
+	 */
+	public void testFactory() {
+
+		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 component element of faces-config.xml
+	 * 
+	 */
+	public void testComponent() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList component = edit.getFacesConfig().getComponent();
+				assertTrue(!component.isEmpty() && component.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+
+	/*
+	 * Test the managed-bean element of faces-config.xml
+	 * 
+	 */
+	public void testManagedBean() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList bean = edit.getFacesConfig().getManagedBean();
+				assertTrue(!bean.isEmpty() && bean.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+
+
+	/*
+	 * Test the referenced-bean element of faces-config.xml
+	 * 
+	 */
+	public void testReferencedBean() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList bean = edit.getFacesConfig().getReferencedBean();
+				assertTrue(!bean.isEmpty() && bean.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+
+
+	/*
+	 * Test the render-kit element of faces-config.xml
+	 * 
+	 */
+	public void testRenderKit() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList renderKit = edit.getFacesConfig().getRenderKit();
+				assertTrue(!renderKit.isEmpty() && renderKit.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+	/*
+	 * Testing for the validator elment of the config file
+	 */
+	
+	public void testValidator() {
+
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList validator = edit.getFacesConfig().getValidator();
+				assertTrue(!validator.isEmpty() && validator.size() == 1);
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+	
+	/*
+	 * Testing for the converter elment of the config file
+	 */
+	
+	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);
+			}
+		} 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/FacesConfigFactoryImplForReadApplication.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java
new file mode 100644
index 0000000..3b6ca5b
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadApplication.java
@@ -0,0 +1,282 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..33835d0
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeComponent.java
@@ -0,0 +1,301 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..9abd2cf
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeConverter.java
@@ -0,0 +1,308 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..d58dae9
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadAttributeValidator.java
@@ -0,0 +1,346 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..2891822
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadEmptyNavigationRule.java
@@ -0,0 +1,55 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+/*
+* 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
new file mode 100644
index 0000000..af761b6
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadManagedBeanManagedProperty.java
@@ -0,0 +1,222 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+/*
+ * 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
new file mode 100644
index 0000000..085d34a
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadRenderer.java
@@ -0,0 +1,290 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..fd056c2
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationCase.java
@@ -0,0 +1,280 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..590a7ec
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingeNavigationRule.java
@@ -0,0 +1,175 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..7477321
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleComponent.java
@@ -0,0 +1,255 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..3457b9c
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleConverter.java
@@ -0,0 +1,261 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..d266667
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleFactory.java
@@ -0,0 +1,195 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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/FacesConfigFactoryImplForReadSingleLifecycle.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleLifecycle.java
new file mode 100644
index 0000000..35ed15e
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleLifecycle.java
@@ -0,0 +1,87 @@
+/***************************************************************************************************
+ * 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.LifecycleType;
+import org.eclipse.jst.jsf.facesconfig.util.FacesConfigArtifactEdit;
+/*
+ * This Junit class is used to test the lifecycle 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 FacesConfigFactoryImplForReadSingleLifecycle extends TestCase {
+	IProject project = null;
+
+	public FacesConfigFactoryImplForReadSingleLifecycle(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		WizardUtil.createProject();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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 testLifecycle() {
+		FacesConfigArtifactEdit edit = null;
+		try {
+			edit = FacesConfigArtifactEdit
+					.getFacesConfigArtifactEditForRead(project);
+			if (edit.getFacesConfig() != null) {
+				EList lifecycle = edit.getFacesConfig().getLifecycle();
+				assertTrue(!lifecycle.isEmpty());
+			}
+		} finally {
+			if (edit != null) {
+				edit.dispose();
+			}
+		}
+	}
+
+	// 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());
+				}
+			}
+		} 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
new file mode 100644
index 0000000..f406831
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleManagedBean.java
@@ -0,0 +1,221 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 *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
new file mode 100644
index 0000000..bdb4e28
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleReferencedBean.java
@@ -0,0 +1,193 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..27836dc
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleRenderKit.java
@@ -0,0 +1,222 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 *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
new file mode 100644
index 0000000..ded383b
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForReadSingleValidator.java
@@ -0,0 +1,240 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..c16f214
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplication.java
@@ -0,0 +1,403 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	/*
+	 * 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
new file mode 100644
index 0000000..0b25154
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteApplicationTwoFiles.java
@@ -0,0 +1,763 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	/*
+	 * 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
new file mode 100644
index 0000000..89461a0
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponent.java
@@ -0,0 +1,177 @@
+/***************************************************************************************************
+ * 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.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.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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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++) {
+						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
new file mode 100644
index 0000000..cd5d602
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteComponentTwoFiles.java
@@ -0,0 +1,453 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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
new file mode 100644
index 0000000..f246ccc
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverter.java
@@ -0,0 +1,152 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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++) {
+						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
new file mode 100644
index 0000000..a225c82
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteConverterTwoFiles.java
@@ -0,0 +1,859 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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
new file mode 100644
index 0000000..cf09bc9
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactory.java
@@ -0,0 +1,288 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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++) {
+						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++) {
+						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++) {
+						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++) {
+						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
new file mode 100644
index 0000000..c47aaf1
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteFactoryTwoFiles.java
@@ -0,0 +1,526 @@
+/***************************************************************************************************
+ * 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;
+	
+	String applicationFactory = "application-factory";
+	String facesContext = "Faces-Contexto";
+	String lifecyclefactory = "lifecycle-factory";
+	String renderKitFactory = "render-kit-factory";
+	
+
+	public FacesConfigFactoryImplForWriteFactoryTwoFiles(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		WizardUtil.createProject();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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();
+			}
+		}
+		String result = null;
+		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);
+						result = app.getTextContent();
+						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++) {
+						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++) {
+						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++) {
+						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++) {
+						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++) {
+						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;
+		
+		String renderKitFactory=null;
+	
+		renderKitFactory = "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(renderKitFactory);
+				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++) {
+						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;
+		
+		String renderKitFactory=null;
+	
+		renderKitFactory = "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(renderKitFactory);
+				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++) {
+						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
new file mode 100644
index 0000000..350b1a9
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycle.java
@@ -0,0 +1,145 @@
+/***************************************************************************************************
+ * 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.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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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();
+			}
+		}
+		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);
+						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();
+			}
+		}
+		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++) {
+						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
new file mode 100644
index 0000000..9678df8
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteLifecycleTwoFiles.java
@@ -0,0 +1,141 @@
+/***************************************************************************************************
+ * 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;	
+
+	String phaseListener1 = "test1";
+	String phaseListener2 = "test2";
+	
+	public FacesConfigFactoryImplForWriteLifecycleTwoFiles(String name) {
+		super(name);
+	}
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		WizardUtil.createProject();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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();
+				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(phaseListener2,result);
+						break;
+					}
+				}
+			}
+		} 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
new file mode 100644
index 0000000..1122263
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBean.java
@@ -0,0 +1,158 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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();
+			}
+		}
+		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.getTextContent();
+						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
new file mode 100644
index 0000000..a8d5e8a
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteManagedBeanTwoFiles.java
@@ -0,0 +1,507 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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
new file mode 100644
index 0000000..2cb6a94
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRule.java
@@ -0,0 +1,134 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..5a4638f
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteNavigationRuleTwoFiles.java
@@ -0,0 +1,595 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..5063187
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBean.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;
+
+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.LargeIconType;
+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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..d4d904d
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteReferencedBeanTwoFiles.java
@@ -0,0 +1,321 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..09f3cb2
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKit.java
@@ -0,0 +1,197 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..274bf13
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteRenderKitTwoFiles.java
@@ -0,0 +1,1171 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList names = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList icons = rendererType.getIcon();
+						for (int k = 0; k < icons.size(); k++) {
+							IconType icon = (IconType) icons.get(k);
+							rendererIconResult = icon.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererComponentFmaily = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererTyp = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererClassResult = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 icon = (IconType) icons.get(k);
+								iconResult = icon.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList names = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList icons = rendererType.getIcon();
+						for (int k = 0; k < icons.size(); k++) {
+							IconType icon = (IconType) icons.get(k);
+							rendererIconResult = icon.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererComponentFmaily = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererTyp = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						rendererClassResult = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 icon = (IconType) icons.get(k);
+								iconResult = icon.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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 rendererType = (RendererType) rendererList
+								.get(j);
+						EList attribute = rendererType.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
new file mode 100644
index 0000000..02571d6
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidator.java
@@ -0,0 +1,537 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+	
+	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
new file mode 100644
index 0000000..4053362
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplForWriteValidatorTwoFiles.java
@@ -0,0 +1,652 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	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
new file mode 100644
index 0000000..6482e55
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryImplTestForRead.java
@@ -0,0 +1,133 @@
+/***************************************************************************************************
+ * 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();
+		project = WizardUtil.getTestProject();
+	}
+
+	/*
+	 * 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
new file mode 100644
index 0000000..0ae2f59
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigFactoryTest.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;
+
+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();
+	}
+
+	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
new file mode 100644
index 0000000..f932973
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigSingleTests.java
@@ -0,0 +1,32 @@
+/***************************************************************************************************
+ * 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
new file mode 100644
index 0000000..57423c6
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTests.java
@@ -0,0 +1,122 @@
+/***************************************************************************************************
+ * 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
new file mode 100644
index 0000000..7903e11
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWrite.java
@@ -0,0 +1,64 @@
+/***************************************************************************************************
+ * 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
new file mode 100644
index 0000000..1a74117
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/FacesConfigTestsForWriteMultipleFiles.java
@@ -0,0 +1,77 @@
+/***************************************************************************************************
+ * 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
new file mode 100644
index 0000000..9dc3d3c
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/MultipleFacesConfigFilesTest.java
@@ -0,0 +1,136 @@
+/***************************************************************************************************
+ * 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();
+	}
+	public static Test suite() {
+		return new TestSuite(MultipleFacesConfigFilesTest.class);
+	}
+	public void testReadFacesconfigFile() {
+		IProject project = WizardUtil.getTestProject();
+		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();
+		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/TestsPlugin.java b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/TestsPlugin.java
new file mode 100644
index 0000000..36a0ce0
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/TestsPlugin.java
@@ -0,0 +1,64 @@
+/***************************************************************************************************
+ * 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 org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class TestsPlugin extends AbstractUIPlugin {
+
+	//The shared instance.
+	private static TestsPlugin plugin;
+	
+	/**
+	 * The constructor.
+	 */
+	public TestsPlugin() {
+		plugin = this;
+	}
+
+	/**
+	 * This method is called upon plug-in activation
+	 */
+	public void start(BundleContext context) throws Exception {
+		super.start(context);
+	}
+
+	/**
+	 * This method is called when the plug-in is stopped
+	 */
+	public void stop(BundleContext context) throws Exception {
+		super.stop(context);
+		plugin = null;
+	}
+
+	/**
+	 * Returns the shared instance.
+	 */
+	public static TestsPlugin getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * Returns an image descriptor for the image file at the given
+	 * plug-in relative path.
+	 *
+	 * @param path the path
+	 * @return the image descriptor
+	 */
+	public static ImageDescriptor getImageDescriptor(String path) {
+		return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.jst.jsf.facesconfig.tests", path);
+	}
+}
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/WizardUtil.java
new file mode 100644
index 0000000..961c915
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/src/org/eclipse/jst/jsf/facesconfig/tests/WizardUtil.java
@@ -0,0 +1,137 @@
+/***************************************************************************************************
+ * 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 java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jst.j2ee.internal.web.archive.operations.WebFacetProjectCreationDataModelProvider;
+import org.eclipse.wst.common.componentcore.ComponentCore;
+import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties;
+import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory;
+import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
+
+/**
+ * Utility class for launching JSF-related wizard operations. 
+ *
+ * @author spaxton
+ */
+public class WizardUtil {
+	private static boolean projectCreated = false;
+	public static final String FACESCONFIG_PROJECT_NAME = "FacesConfigUnitTest";
+	private static final String FACESCONFIG_EAR_PROJECT_NAME = FACESCONFIG_PROJECT_NAME + "EAR";
+
+	public static boolean isProjectCreated() {
+		return projectCreated;
+	}
+	
+	public static void createProject() {
+		if(!isProjectCreated()) {
+			// first delete the projects of these names, if present
+			IWorkspace workspace = ResourcesPlugin.getWorkspace();
+			IResource oldWebProj = workspace.getRoot().getProject(FACESCONFIG_PROJECT_NAME);
+			IResource oldEarProj = workspace.getRoot().getProject(FACESCONFIG_EAR_PROJECT_NAME);
+
+			try {			
+				workspace.delete(new IResource[] { oldWebProj, oldEarProj }, true, null);
+			} catch (CoreException ce) {
+				ce.printStackTrace();
+			}
+	
+			
+			try {
+				IProject project = createWebProject(FACESCONFIG_PROJECT_NAME);
+				checkAndAddFacesConfig(project);
+			} catch (Throwable t) {
+				t.printStackTrace();
+			}
+		
+			projectCreated = true;
+		}
+	}
+
+	protected static IProject createWebProject(String projectName) throws Exception {
+		if(!isProjectCreated()) {
+			IDataModel dataModel = DataModelFactory.createDataModel(new WebFacetProjectCreationDataModelProvider());
+			dataModel.setProperty(IFacetProjectCreationDataModelProperties.FACET_PROJECT_NAME, projectName);
+			dataModel.getDefaultOperation().execute(new NullProgressMonitor(), null);
+		}
+		return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+	}
+
+	public static void setProjectDirtied() {
+		projectCreated = false;
+	}
+
+	/**
+	 * Forces recreation of the test project - to be used after unit tests
+	 * that dirty the project state.  
+	 */
+	public static void recreateProject() {
+		setProjectDirtied();
+		createProject();
+	}
+
+	/**
+	 * Should call createProject first. 
+	 */
+	public static IProject getTestProject() {
+		IWorkspace workspace = ResourcesPlugin.getWorkspace();
+		return workspace.getRoot().getProject(FACESCONFIG_PROJECT_NAME);
+	}
+
+	private static void checkAndAddFacesConfig(IProject project) {
+		IContainer container = ComponentCore.createComponent(project).getRootFolder().getFolder("/WEB-INF").getUnderlyingFolder();
+		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$
+		
+		if(facesConfigFile.exists()) {
+			return;
+		} else {
+			// there is no faces-config, so add our starting template
+			try {
+				String sourcePath = Platform.asLocalURL(Platform.find(Platform.getBundle("org.eclipse.jst.jsf.facesconfig.tests"), new Path("/template/faces-config.xml"))).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$	
+				File f = new File(sourcePath);
+				FileInputStream sourceStream = new FileInputStream(f);
+				facesConfigFile.create(sourceStream, true, null);
+				sourceStream.close();
+
+				String sourcePath1 = Platform.asLocalURL(Platform.find(Platform.getBundle("org.eclipse.jst.jsf.facesconfig.tests"), new Path("/template/faces-config1.xml"))).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$	
+				File f1 = new File(sourcePath1);
+				FileInputStream sourceStream1 = new FileInputStream(f1);
+				facesConfigFile1.create(sourceStream1, true, null);
+				sourceStream1.close();
+
+				String sourcePath2 = Platform.asLocalURL(Platform.find(Platform.getBundle("org.eclipse.jst.jsf.facesconfig.tests"), new Path("/template/faces-config2.xml"))).getPath().toString(); //$NON-NLS-1$ //$NON-NLS-2$	
+				File f2 = new File(sourcePath2);
+				FileInputStream sourceStream2 = new FileInputStream(f2);
+				facesConfigFile2.create(sourceStream2, true, null);
+				sourceStream2.close();
+			} catch (IOException ioe) {
+			} catch (CoreException ce) {
+			}
+
+		}
+		
+	}
+}
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
new file mode 100644
index 0000000..a03e1ca
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config.xml
@@ -0,0 +1,265 @@
+<?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.0//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+
+<!-- =========== FULL CONFIGURATION FILE ================================== -->
+
+<faces-config>
+
+	<lifecycle>
+		<phase-listener>
+			org.eclipse.wtp.jsf.tests.ValueResourcePhaseListener
+		</phase-listener>
+	</lifecycle>
+
+
+	<factory>
+		
+		<application-factory>application-factory</application-factory><faces-context-factory>
+			faces-context-factory
+		</faces-context-factory>
+		<lifecycle-factory>lifecycle-factory</lifecycle-factory>
+		<render-kit-factory>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>
+		</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>
+			</icon>
+			<attribute-name>attribute-name</attribute-name>
+			<attribute-class>attribute-class</attribute-class>
+			<default-value>value5</default-value>
+			<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>
+		<component-extension>component-extension</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>
+		</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>
+			</icon>
+			<property-name>property-name</property-name>
+			<property-class>property-class</property-class>
+			<null-value />
+		</managed-property>
+	</managed-bean>
+	<converter>
+		<description>converter-description</description>
+		<display-name>converter-display-name</display-name>
+		<icon>
+			<large-icon>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>
+			</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-extension>
+				attribute-extension
+			</attribute-extension>
+		</attribute>
+		<property>
+			<property-name>property1</property-name>
+			<property-class>MyPropertyClass</property-class>
+			<default-value>value4</default-value>
+		</property>
+	</converter>
+
+	<!-- Referenced-bean -->
+	<referenced-bean>
+		<description>Bean Desc</description>
+		<display-name>referenced-bean-display</display-name>
+		<icon>
+			<small-icon>referenced-bean-myicon</small-icon>
+		</icon>
+		<referenced-bean-name>
+			referenced-bean-name
+		</referenced-bean-name>
+		<referenced-bean-class>
+			referenced-bean-class
+		</referenced-bean-class>
+	</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>
+		</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>
+			</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>
+				</icon>
+				<attribute-name>attribute name</attribute-name>
+				<attribute-class>Attribute Class</attribute-class>
+				<default-value>default value</default-value>
+				<attribute-extension>
+					renderer-extension
+				</attribute-extension>
+				<attribute-extension>
+					blah extension
+				</attribute-extension>
+			</attribute>
+			<renderer-extension>
+				renderer-extension 1
+			</renderer-extension>
+			<renderer-extension>
+				renderer-extension 2
+			</renderer-extension>
+			<renderer-extension>
+				renderer-extension 3
+			</renderer-extension>
+
+		</renderer>
+	</render-kit>
+
+	<!-- Validator rules -->
+	<validator>
+		<description>validator-description</description>
+		<display-name>validator-display-name</display-name>
+		<icon>
+			<small-icon>icon1</small-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>
+			</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>
+			<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>
+	</validator>
+
+	<!-- variable/property resolver registration -->
+	<application>
+		<action-listener>Action listener</action-listener>
+		<variable-resolver>
+			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>
+
+		<property-resolver>
+			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>
+	</application>
+
+	<navigation-rule>
+		<description>Descri 1</description>
+		<display-name>display name 1</display-name>
+		<icon>
+			<small-icon>myicon</small-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>what display name</display-name>
+			<icon>
+				<small-icon>small-icon</small-icon>
+			</icon>
+			<from-action>from-action</from-action>
+			<from-outcome>drilldown</from-outcome>
+			<to-view-id>/edit.jsp</to-view-id>
+
+
+		</navigation-case>
+	</navigation-rule>
+
+</faces-config>
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
new file mode 100644
index 0000000..b16a446
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config1.xml
@@ -0,0 +1,20 @@
+<?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.0//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+
+<!-- =========== FULL CONFIGURATION FILE ================================== -->
+
+<faces-config>
+
+	<lifecycle>
+		<phase-listener>test1</phase-listener>
+	</lifecycle>
+	
+</faces-config>
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
new file mode 100644
index 0000000..17ec73c
--- /dev/null
+++ b/jsf/tests/org.eclipse.jst.jsf.facesconfig.tests/template/faces-config2.xml
@@ -0,0 +1,16 @@
+<?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.0//EN"
+  "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
+
+<!-- =========== FULL CONFIGURATION FILE ================================== -->
+
+<faces-config>
+
+</faces-config>
