Author: scabanovich
Date: 2010-10-14 09:04:44 -0400 (Thu, 14 Oct 2010)
New Revision: 25829
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.classpath
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.project
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/org.eclipse.jdt.core.prefs
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/bin/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/bin/test/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/bin/test/Bean.class
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/Bean.java
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/RelevanceCheckTest.java
Modified:
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java
Log:
JBIDE-7265
https://jira.jboss.org/browse/JBIDE-7265
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.classpath
===================================================================
---
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.classpath
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.classpath 2010-10-14
13:04:44 UTC (rev 25829)
@@ -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/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.project
===================================================================
--- trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.project
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.project 2010-10-14
13:04:44 UTC (rev 25829)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>JavaProject</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/org.eclipse.jdt.core.prefs 2010-10-14
13:04:44 UTC (rev 25829)
@@ -0,0 +1,12 @@
+#Thu Oct 14 16:33:59 MSD 2010
+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/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/bin/test/Bean.class
===================================================================
(Binary files differ)
Property changes on:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/bin/test/Bean.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/Bean.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/Bean.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/Bean.java 2010-10-14
13:04:44 UTC (rev 25829)
@@ -0,0 +1,18 @@
+package test;
+
+public class Bean {
+ protected int myField = 0;
+
+ public int getProp1() {
+ return 0;
+ }
+
+ public boolean isProp2() {
+ return false;
+ }
+
+ public void setProp3(String s) {
+
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.el.core.test/projects/JavaProject/src/test/Bean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java 2010-10-14
12:57:51 UTC (rev 25828)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/CommonELAllTests.java 2010-10-14
13:04:44 UTC (rev 25829)
@@ -26,6 +26,7 @@
suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(ELParserTest.class);
suite.addTestSuite(ELModelTest.class);
+ suite.addTestSuite(RelevanceCheckTest.class);
return suite;
}
}
Added:
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/RelevanceCheckTest.java
===================================================================
---
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/RelevanceCheckTest.java
(rev 0)
+++
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/RelevanceCheckTest.java 2010-10-14
13:04:44 UTC (rev 25829)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.common.el.core.test;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.el.core.ca.DefaultJavaRelevanceCheck;
+import org.jboss.tools.test.util.ResourcesUtils;
+import org.jboss.tools.test.util.TestProjectProvider;
+
+import junit.framework.TestCase;
+
+public class RelevanceCheckTest extends TestCase {
+ public static final String TEST_PROJECT_NAME = "JavaProject";
+
+ public static final String TEST_PROJECT_PATH = "/projects/" +
TEST_PROJECT_NAME;
+
+ TestProjectProvider prjProvider = null;
+ IProject project = null;
+
+ protected void setUp() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ project =
(IProject)ResourcesPlugin.getWorkspace().getRoot().findMember(TEST_PROJECT_NAME);
+ if(project==null) {
+ prjProvider = new TestProjectProvider("org.jboss.tools.common.el.core.test",
TEST_PROJECT_PATH, TEST_PROJECT_NAME, true);
+ project = prjProvider.getProject();
+ }
+
+ project.build(IncrementalProjectBuilder.FULL_BUILD, null);
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ }
+
+ public void testRelevanceCheck() throws CoreException {
+ IJavaProject jp = JavaCore.create(project);
+ IType bean = jp.findType("test.Bean");
+
+ IField f = bean.getField("myField");
+ assertTrue("Field myField is not found", f != null && f.exists());
+ DefaultJavaRelevanceCheck check = new DefaultJavaRelevanceCheck(f);
+
+ assertTrue("'myField' should be relevant",
check.isRelevant("myField"));
+ assertTrue("'myField2' should be relevant",
check.isRelevant("myField2"));
+ assertFalse("'myFiel' should not be relevant",
check.isRelevant("myFiel"));
+
+ IMethod m = bean.getMethod("getProp1", new String[0]);
+ assertTrue("Method getProp1 is not found", m != null && m.exists());
+ check = new DefaultJavaRelevanceCheck(m);
+
+ assertTrue("'prop1' should be relevant",
check.isRelevant("prop1"));
+ assertTrue("'getProp1' should be relevant",
check.isRelevant("getProp1"));
+ assertFalse("'getProp2' should not be relevant",
check.isRelevant("getProp2"));
+
+ m = bean.getMethod("isProp2", new String[0]);
+ assertTrue("Method isProp2 is not found", m != null && m.exists());
+ check = new DefaultJavaRelevanceCheck(m);
+
+ assertTrue("'prop1' should be relevant",
check.isRelevant("prop2"));
+ assertTrue("'isProp2' should be relevant",
check.isRelevant("isProp2"));
+ assertFalse("'getProp3' should not be relevant",
check.isRelevant("isProp3"));
+
+ m = bean.getMethod("setProp3", new String[]{"QString;"});
+ assertTrue("Method setProp3 is not found", m != null && m.exists());
+ check = new DefaultJavaRelevanceCheck(m);
+
+ assertTrue("'prop1' should be relevant",
check.isRelevant("prop3"));
+ assertTrue("'setProp3' should be relevant",
check.isRelevant("setProp3"));
+ assertFalse("'setProp4' should not be relevant",
check.isRelevant("setProp4"));
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if(prjProvider!=null) {
+ prjProvider.dispose();
+ }
+ }
+
+}
Property changes on:
trunk/common/tests/org.jboss.tools.common.el.core.test/src/org/jboss/tools/common/el/core/test/RelevanceCheckTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain