[jbosstools-commits] JBoss Tools SVN: r30624 - in trunk/jst/tests/org.jboss.tools.jst.web.kb.test: META-INF and 6 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Apr 15 21:07:34 EDT 2011


Author: akazakov
Date: 2011-04-15 21:07:34 -0400 (Fri, 15 Apr 2011)
New Revision: 30624

Added:
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/plugin.xml
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.classpath
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.project
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/org.eclipse.jdt.core.prefs
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/test.xml
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/TestValidator.java
Modified:
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/build.properties
   trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
Log:
https://issues.jboss.org/browse/JBIDE-8726

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF	2011-04-16 00:59:09 UTC (rev 30623)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/META-INF/MANIFEST.MF	2011-04-16 01:07:34 UTC (rev 30624)
@@ -1,8 +1,9 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.tools.jst.web.kb.test
-Bundle-Version: 3.2.0.qualifier
+Bundle-SymbolicName: org.jboss.tools.jst.web.kb.test;singleton:=true
+Bundle-Localization: plugin
+Bundle-Version: 3.3.0.qualifier
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.core.resources,
@@ -12,8 +13,10 @@
  org.jboss.tools.common.el.core,
  org.jboss.tools.common.model.test,
  org.jboss.tools.common,
- org.eclipse.jst.standard.schemas
+ org.eclipse.jst.standard.schemas,
+ org.eclipse.wst.validation
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
 Bundle-Vendor: %Bundle-Vendor.0
-Export-Package: org.jboss.tools.jst.web.kb.test
+Export-Package: org.jboss.tools.jst.web.kb.test,
+ org.jboss.tools.jst.web.kb.test.validation

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/build.properties
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/build.properties	2011-04-16 00:59:09 UTC (rev 30623)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/build.properties	2011-04-16 01:07:34 UTC (rev 30624)
@@ -2,7 +2,8 @@
 bin.includes = META-INF/,\
                projects/,\
                .,\
-               plugin.properties
+               plugin.properties,\
+               plugin.xml
 src.includes = src/,\
                projects/,\
                build.properties,\

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/plugin.xml
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/plugin.xml	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/plugin.xml	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+   <extension
+         point="org.jboss.tools.jst.web.kb.validator">
+         <validator
+               class="org.jboss.tools.jst.web.kb.test.validation.TestValidator"
+               id="org.jboss.tools.jst.web.kb.test.TestValidator"
+               dependent="true">
+         </validator>
+   </extension>
+
+</plugin>
\ No newline at end of file


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.classpath
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.classpath	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.classpath	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.project
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.project	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.project	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>KBValidationTest</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.wst.common.project.facet.core.builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.wst.validation.validationbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+		<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
+	</natures>
+</projectDescription>


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/org.eclipse.jdt.core.prefs	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,12 @@
+#Thu Apr 14 12:03:49 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/test.xml
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/test.xml	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/test.xml	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<test></test>
\ No newline at end of file


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/projects/KBValidationTest/src/test.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Modified: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java	2011-04-16 00:59:09 UTC (rev 30623)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/JstWebKbAllTests.java	2011-04-16 01:07:34 UTC (rev 30624)
@@ -14,6 +14,7 @@
 import junit.framework.TestSuite;
 
 import org.jboss.tools.common.model.util.test.XProjectImportTestSetUp;
+import org.jboss.tools.jst.web.kb.test.validation.KBValidationTest;
 import org.jboss.tools.test.util.ProjectImportTestSetup;
 
 /**
@@ -32,6 +33,9 @@
 				"org.jboss.tools.jst.web.kb.test",
 				new String[]{"projects/TestKbModel", "projects/MyFaces", "projects/MyFaces2", "projects/TestKbModel2"},
 				new String[]{"TestKbModel", "MyFaces", "MyFaces2", "TestKbModel2"});
-		return testSetup;
+		TestSuite suiteAll = new TestSuite("KB Tests");
+		suiteAll.addTest(testSetup);
+		suiteAll.addTestSuite(KBValidationTest.class);
+		return suiteAll;
 	}
 }
\ No newline at end of file

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,120 @@
+package org.jboss.tools.jst.web.kb.test.validation;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidationResourceRegister;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+import org.jboss.tools.jst.web.kb.validation.IValidationContextManager;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class KBValidationTest extends TestCase {
+
+	protected static String PLUGIN_ID = "org.jboss.tools.jst.web.kb.test";
+	protected static String PROJECT_NAME = "KBValidationTest";
+	protected static String PROJECT_PATH = "/projects/KBValidationTest";
+
+	private IProject importProject() throws IOException, CoreException, InvocationTargetException, InterruptedException {
+		Bundle b = Platform.getBundle(PLUGIN_ID);
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+		if(project==null || !project.exists()) {
+			project = ResourcesUtils.importProject(b, PROJECT_PATH);
+		}
+		project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+		JobUtils.waitForIdle();
+		return project;
+	}
+
+	private void deleteProject() throws CoreException {
+		IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+		if(project!=null && project.exists()) {
+			project.delete(true, new NullProgressMonitor());
+		}
+		JobUtils.waitForIdle();
+	}
+
+	public void testValidationContextCleanedUpIntegration() throws IOException, CoreException, InvocationTargetException, InterruptedException {
+		try {
+			TestValidator.validated = false;
+			importProject();
+			assertTrue(TestValidator.validated);
+			deleteProject();
+			TestValidator.validated = false;
+			importProject();
+			assertTrue(TestValidator.validated);
+		} finally {
+			deleteProject();
+		}
+	}
+
+	public void testValidationContextCleanedUpUnit() {
+		ContextValidationHelper helper = new ContextValidationHelper();
+		helper.setValidationContextManager(new IValidationContextManager() {
+			public IValidatingProjectTree getValidatingProjectTree(
+					IValidator validator) {
+				return null;
+			}
+			public void addProject(IProject project) {
+			}
+			public void clearAll() {
+			}
+			public void clearRegisteredFiles() {
+			}
+			public void clearAllResourceLinks() {
+			}
+			public Set<IFile> getRemovedFiles() {
+				return null;
+			}
+			public void addRemovedFile(IFile file) {
+			}
+			public Set<IFile> getRegisteredFiles() {
+				return null;
+			}
+			public void registerFile(IFile file) {
+			}
+			public List<IValidator> getValidators() {
+				return null;
+			}
+			public Set<IProject> getRootProjects() {
+				return null;
+			}
+			public void addValidatedProject(IValidator validator,
+					IProject project) {
+			}
+			public boolean projectHasBeenValidated(IValidator validator,
+					IProject project) {
+				return false;
+			}
+			public void clearValidatedProjectsList() {
+			}
+			public void setValidationResourceRegister(
+					ValidationResourceRegister validationResourceRegister) {
+			}
+			public void init(IProject project) {
+			}
+			public boolean isObsolete() {
+				return false;
+			}
+		});
+		helper.cleanup();
+		assertNull(helper.getValidationContextManager(false));
+	}
+}
\ No newline at end of file


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/KBValidationTest.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Added: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/TestValidator.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/TestValidator.java	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/TestValidator.java	2011-04-16 01:07:34 UTC (rev 30624)
@@ -0,0 +1,103 @@
+/******************************************************************************* 
+ * 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.jst.web.kb.test.validation;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+import org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper;
+import org.jboss.tools.jst.web.kb.internal.validation.SimpleValidatingProjectTree;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager;
+import org.jboss.tools.jst.web.kb.validation.IProjectValidationContext;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectSet;
+import org.jboss.tools.jst.web.kb.validation.IValidatingProjectTree;
+import org.jboss.tools.jst.web.kb.validation.IValidator;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TestValidator implements IValidator {
+
+	public static boolean validated = false;
+
+	protected IStatus OK_STATUS = new Status(IStatus.OK,
+			"org.eclipse.wst.validation", 0, "OK", null); //$NON-NLS-1$ //$NON-NLS-2$
+
+	/* (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#getId()
+	 */
+	public String getId() {
+		return "org.jboss.tools.jst.web.kb.test.TestValidator";
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#getValidatingProjects(org.eclipse.core.resources.IProject)
+	 */
+	public IValidatingProjectTree getValidatingProjects(IProject project) {
+		Set<IProject> projects = new HashSet<IProject>();
+		projects.add(project);
+		IKbProject kbProject = KbProjectFactory.getKbProject(project, false);
+		if(kbProject!=null) {
+			IProjectValidationContext rootContext = kbProject.getValidationContext();
+			IValidatingProjectSet projectSet = new ValidatingProjectSet(project, projects, rootContext);
+			return new SimpleValidatingProjectTree(projectSet);
+		}
+		return new SimpleValidatingProjectTree(project);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#shouldValidate(org.eclipse.core.resources.IProject)
+	 */
+	public boolean shouldValidate(IProject project) {
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#isEnabled(org.eclipse.core.resources.IProject)
+	 */
+	public boolean isEnabled(IProject project) {
+		return true;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#validate(java.util.Set, org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+	 */
+	public IStatus validate(Set<IFile> changedFiles, IProject project,
+			ContextValidationHelper validationHelper,
+			IProjectValidationContext validationContext,
+			ValidatorManager manager, IReporter reporter)
+			throws ValidationException {
+		return OK_STATUS;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.jst.web.kb.validation.IValidator#validateAll(org.eclipse.core.resources.IProject, org.jboss.tools.jst.web.kb.internal.validation.ContextValidationHelper, org.jboss.tools.jst.web.kb.validation.IProjectValidationContext, org.jboss.tools.jst.web.kb.internal.validation.ValidatorManager, org.eclipse.wst.validation.internal.provisional.core.IReporter)
+	 */
+	public IStatus validateAll(IProject project,
+			ContextValidationHelper validationHelper,
+			IProjectValidationContext validationContext,
+			ValidatorManager manager, IReporter reporter)
+			throws ValidationException {
+		validated = true;
+		return OK_STATUS;
+	}
+}
\ No newline at end of file


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.kb.test/src/org/jboss/tools/jst/web/kb/test/validation/TestValidator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list