[jbosstools-commits] JBoss Tools SVN: r22813 - in branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test: META-INF and 3 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Jun 15 09:16:24 EDT 2010
Author: scabanovich
Date: 2010-06-15 09:16:24 -0400 (Tue, 15 Jun 2010)
New Revision: 22813
Added:
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java
Modified:
branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/META-INF/MANIFEST.MF
Log:
https://jira.jboss.org/browse/JBIDE-6224
Modified: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/META-INF/MANIFEST.MF 2010-06-15 13:14:37 UTC (rev 22812)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/META-INF/MANIFEST.MF 2010-06-15 13:16:24 UTC (rev 22813)
@@ -3,6 +3,10 @@
Bundle-Name: Seam XML Tests
Bundle-SymbolicName: org.jboss.tools.seam.xml.test;singleton:=true
Bundle-Version: 1.0.0
-Require-Bundle: org.eclipse.core.runtime
+Require-Bundle: org.eclipse.core.runtime,
+ org.junit,
+ org.jboss.tools.seam.xml,
+ org.jboss.tools.common.test,
+ org.jboss.tools.tests
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml (rev 0)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml 2010-06-15 13:16:24 UTC (rev 22813)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<components xmlns="http://jboss.com/products/seam/components"
+ xmlns:core="http://jboss.com/products/seam/core"
+ xmlns:framework="http://jboss.com/products/seam/framework"
+ xmlns:navigation="http://jboss.com/products/seam/navigation"
+ xmlns:pdf="http://jboss.com/products/seam/pdf"
+ xmlns:remoting="http://jboss.com/products/seam/remoting"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.2.xsd http://jboss.com/products/seam/framework http://jboss.com/products/seam/framework-2.2.xsd http://jboss.com/products/seam/remoting http://jboss.com/products/seam/remoting-2.2.xsd http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.2.xsd http://jboss.com/products/seam/navigation http://jboss.com/products/seam/navigation-2.2.xsd http://jboss.com/products/seam/pdf http://jboss.com/products/seam/pdf-2.2.xsd">
+ <component class="MyCls" name="component1"/>
+ <framework:entity-query name="entityQuery"/>
+ <remoting:remoting poll-interval="1" poll-timeout="2"/>
+ <core:manager/>
+ <navigation:pages http-port="1111" https-port="1112"
+ login-view-id="b.xhtml" no-conversation-view-id="a.xhtml">
+ <navigation:resources>
+ <value>v2</value>
+ </navigation:resources>
+ </navigation:pages>
+ <pdf:document-store name="mypdfStore"/>
+</components>
Property changes on: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/projects/Test/components22.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java (rev 0)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java 2010-06-15 13:16:24 UTC (rev 22813)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.xml.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+
+/**
+ * @author V.Kabanovich
+ *
+ */
+public class SeamXMLAllTests {
+ public static final String PLUGIN_ID = "org.jboss.tools.seam.xml";
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite();
+ suite.setName("All tests for " + PLUGIN_ID);
+ suite.addTest(new SeamXMLTestSetup(SeamXMLTestSuite.suite()));
+
+ return suite;
+ }
+}
Property changes on: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLAllTests.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java (rev 0)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java 2010-06-15 13:16:24 UTC (rev 22813)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.xml.test;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.seam.xml.components.model.SeamComponentConstants;
+
+public class SeamXMLModelTest extends TestCase {
+ IProject project = null;
+
+ public SeamXMLModelTest() {
+ super("Seam Scanner test");
+ project = getTestProject();
+ }
+
+ public IProject getTestProject() {
+ if(project==null) {
+ try {
+ project = findTestProject();
+ if(project==null || !project.exists()) {
+// project = importPreparedProject("/");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("Can't import Seam XML test project: " + e.getMessage());
+ }
+ }
+ return project;
+ }
+
+ public static IProject findTestProject() {
+ return ResourcesPlugin.getWorkspace().getRoot().getProject("Test");
+ }
+
+
+ /**
+ * This test is to check different cases of declaring components in xml.
+ * It does not check interaction of xml declaration with other declarations.
+ */
+ public void testXMLModel() {
+ IFile f = project.getFile(new Path("components22.xml"));
+ assertNotNull("File components22.xml is not found in Test project.", f);
+
+ XModelObject fileObject = EclipseResourceUtil.createObjectForResource(f);
+ assertNotNull("Cannot create XModel object for file components22.xml.", fileObject);
+
+ String entity = fileObject.getModelEntity().getName();
+ assertEquals("File components22.xml is incorrectly parsed by XModel.", SeamComponentConstants.ENT_SEAM_COMPONENTS_22, entity);
+
+ //TODO continue test
+ }
+
+ protected XModelObject getComponents22Object() {
+ if(project == null) return null;
+ IFile f = project.getFile(new Path("components22.xml"));
+ return f == null ? null : EclipseResourceUtil.createObjectForResource(f);
+
+ }
+
+ public void testNavigationPagesComponent() {
+ XModelObject fileObject = getComponents22Object();
+ assertNotNull("Cannot create XModel object for file components22.xml.", fileObject);
+
+ XModelObject navigationPages = fileObject.getChildByPath("org.jboss.seam.navigation.pages");
+ assertNotNull("Cannot find org.jboss.seam.navigation.pages", navigationPages);
+
+ XModelObject resources = navigationPages.getChildByPath("resources");
+ assertNotNull("Cannot find resources in org.jboss.seam.navigation.pages", resources);
+
+ XModelObject[] resourcesList = resources.getChildren();
+ assertEquals(1, resourcesList.length);
+
+ assertAttribute(navigationPages, "no-conversation-view-id", "a.xhtml");
+ assertAttribute(navigationPages, "login-view-id", "b.xhtml");
+ assertAttribute(navigationPages, "http-port", "1111");
+ assertAttribute(navigationPages, "https-port", "1112");
+
+ }
+
+ protected void assertAttribute(XModelObject object, String name, String value) {
+ String actual = object.getAttributeValue(name);
+ assertEquals("Attribute " + name + " in " + object.getPresentationString() + " is incorrect.", value, actual);
+ }
+
+}
Property changes on: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLModelTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java (rev 0)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java 2010-06-15 13:16:24 UTC (rev 22813)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.xml.test;
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.test.util.xpl.EditorTestHelper;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamXMLTestSetup extends TestSetup {
+
+ protected IProject project;
+
+ public SeamXMLTestSetup(Test test) {
+ super(test);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ project = ResourcesUtils.importProject(
+ "org.jboss.tools.seam.xml.test","/projects/Test" , new NullProgressMonitor());
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ EditorTestHelper.joinBackgroundActivities();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+ project.delete(true, true, null);
+ JobUtils.waitForIdle();
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+}
Property changes on: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSetup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java
===================================================================
--- branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java (rev 0)
+++ branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java 2010-06-15 13:16:24 UTC (rev 22813)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.xml.test;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author V. Kabanovich
+ */
+public class SeamXMLTestSuite extends TestSuite {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Seam XML Tests");
+ suite.addTestSuite(SeamXMLModelTest.class);
+ return suite;
+ }
+}
Property changes on: branches/jbosstools-3.1.x/seam/tests/org.jboss.tools.seam.xml.test/src/org/jboss/tools/seam/xml/test/SeamXMLTestSuite.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the jbosstools-commits
mailing list