JBoss Tools SVN: r37661 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 13:25:20 -0500 (Thu, 05 Jan 2012)
New Revision: 37661
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
Log:
cleaned imports, corrected warnings
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2012-01-05 18:23:20 UTC (rev 37660)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReport.java 2012-01-05 18:25:20 UTC (rev 37661)
@@ -16,7 +16,6 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
import org.jboss.tools.usage.googleanalytics.IJBossToolsEclipseEnvironment;
import org.jboss.tools.usage.http.HttpGetRequest;
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2012-01-05 18:23:20 UTC (rev 37660)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/internal/reporting/UsageReportEnablementDialog.java 2012-01-05 18:25:20 UTC (rev 37661)
@@ -17,8 +17,6 @@
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Link;
12 years, 12 months
JBoss Tools SVN: r37660 - in trunk/usage: tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 13:23:20 -0500 (Thu, 05 Jan 2012)
New Revision: 37660
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/fakes/LinuxSystemFake.java
Log:
[JBIDE-10577] added javadoc, corrected tests
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 17:38:00 UTC (rev 37659)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 18:23:20 UTC (rev 37660)
@@ -40,32 +40,47 @@
public final LinuxDistro KNOPPIX = new LinuxDistro("Knoppix", "knoppix_version");
public final LinuxDistro MANDRAKE = new LinuxDistro("Mandrake", "/etc/mandrake-release");
public final LinuxDistro MANDRIVA = new LinuxDistro("Mandriva", "/etc/mandriva-release");
+ public final LinuxDistro MINT = new MintLinuxDistro();
public final LinuxDistro PLD = new LinuxDistro("PLD", "/etc/pld-release");
public final LinuxDistro REDHAT = new LinuxDistro("RedHat", "/etc/redhat-release");
public final LinuxDistro SLACKWARE = new LinuxDistro("Slackware", "/etc/slackware-version");
public final LinuxDistro SUSE = new LinuxDistro("SUSE", "/etc/SuSE-release");
public final LinuxDistro UBUNTU = new LinuxDistro("Ubuntu", "/etc/lsb-release");
- public final LinuxDistro MINT = new MintLinuxDistro();
private final LinuxDistro[] ALL = new LinuxDistro[] {
+ /**
+ * Attention: CentOS uses the redhat release file
+ * <p>
+ * <tt>/etc/redhat-release</tt>
+ * <p>
+ * We therefore have to check CentOS before we check for Red Hat.
+ * It is not reliable to check Red Hat first since that check would
+ * result in a false positive on CentOS systems.
+ */
CENTOS,
+ REDHAT,
/**
+ * Attention: Mint uses the default
+ * <p>
+ * <tt>/etc/lsb-release</tt>
+ * <p>
+ * We therefore have to check Mint before we check Ubuntu.
+ * Checking Ubuntu first is not reliable since it is resulting in a
+ * false positive on Mint systems.
+ */
+ MINT,
+ /**
* Attention: ubuntu has 2 release files
* <ul>
* <li>/etc/lsb-release</li>
* <li>/etc/debian_version</li>
* </ul>
* <p>
- * It is not reliable to check Debian first and check there's no
- * /etc/lsb-release exists. Debian may also have a /etc/lsb-release. We must
- * check ubuntu prior to Debian.
+ * We therefore have to check for Ubuntu before we check for Debian.
+ * Checking for Debian results in a false positive on Ubuntu systems.
+ * @see https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/19353
* @see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444678
- * <p>
- * The very same applies to Mint Linux. It also has a /etc/lsb-release and we
- * therefore have to check mint prior to ubuntu and debian.
- *
*/
- MINT,
UBUNTU,
DEBIAN,
FEDORA,
@@ -74,7 +89,6 @@
MANDRAKE,
MANDRIVA,
PLD,
- REDHAT,
SLACKWARE,
SUSE,
YELLOWDOG
@@ -138,6 +152,26 @@
}
}
+ protected boolean exists(String releaseFilePath) {
+ return releaseFilePath != null
+ && releaseFilePath.length() > 0
+ && new File(releaseFilePath).exists();
+ }
+
+ protected String getDistroFileContent(String filePath) throws IOException {
+ int charachtersToRead = 1024;
+ StringBuilder builder = new StringBuilder(charachtersToRead);
+ BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ char[] buf = new char[charachtersToRead];
+ int charRead = 0;
+ while ((charRead = reader.read(buf)) != -1 && builder.length() < charachtersToRead) {
+ String readData = String.valueOf(buf, 0, charRead);
+ builder.append(readData);
+ }
+ reader.close();
+ return builder.toString();
+ }
+
public class LinuxDistro {
/**
@@ -179,16 +213,10 @@
return new StringBuilder().append(getName()).append(" ").append(getVersion()).toString();
}
- protected String getReleaseFilePath() {
+ public String getReleaseFilePath() {
return releaseFilePath;
}
- protected boolean exists(String releaseFilePath) {
- return releaseFilePath != null
- && releaseFilePath.length() > 0
- && new File(releaseFilePath).exists();
- }
-
protected boolean distroFileContains(String value) {
try {
boolean fileExists = exists(getReleaseFilePath());
@@ -202,19 +230,9 @@
}
- protected String getDistroFileContent(String filePath) throws IOException {
- int charachtersToRead = 1024;
- StringBuilder builder = new StringBuilder(charachtersToRead);
- BufferedReader reader = new BufferedReader(new FileReader(filePath));
- char[] buf = new char[charachtersToRead];
- int charRead = 0;
- while ((charRead = reader.read(buf)) != -1 && builder.length() < charachtersToRead) {
- String readData = String.valueOf(buf, 0, charRead);
- builder.append(readData);
- }
- reader.close();
- return builder.toString();
+ @Override
+ public String toString() {
+ return name;
}
-
}
}
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java 2012-01-05 17:38:00 UTC (rev 37659)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/LinuxSystemTest.java 2012-01-05 18:23:20 UTC (rev 37660)
@@ -19,13 +19,34 @@
public class LinuxSystemTest {
@Test
- public void canExtractFedoraVersion() {
+ public void canDetectFedora() {
LinuxSystem linuxSystem = new LinuxSystemFake(
- new ReleaseFile(LinuxSystem.INSTANCE.FEDORA.getReleaseFilePath(), "Fedora release 13 (Goddard)"));
+ new ReleaseFile(LinuxSystem.INSTANCE.FEDORA.getReleaseFilePath(), "Fedora release 13 (Goddard)"));
assertEquals("Fedora 13", linuxSystem.getDistroNameAndVersion());
}
/**
+ * Mint uses the default
+ * <ul>
+ * <li>/etc/lsb-release</li>
+ * </ul>
+ */
+ @Test
+ public void canDetectMintVersion() {
+ LinuxSystem linuxSystem = new LinuxSystemFake(
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.DEBIAN.getReleaseFilePath(), "squeeze/sid"),
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.MINT.getReleaseFilePath(),
+ "DISTRIB_ID=LinuxMint\n" +
+ "DISTRIB_RELEASE=12\n" +
+ "DISTRIB_CODENAME=debian\n" +
+ "DISTRIB_DESCRIPTION=\"Linux Mint 12 Lisa\"")
+ );
+ assertEquals("LinuxMint 12", linuxSystem.getDistroNameAndVersion());
+ }
+
+ /**
* Ubuntu has 2 release files!
* <ul>
* <li>/etc/lsb-release</li>
@@ -33,34 +54,46 @@
* </ul>
*/
@Test
- public void canExtractUbuntuVersion() {
+ public void canDetectUbuntu() {
LinuxSystem linuxSystem = new LinuxSystemFake(
- new ReleaseFile(
- LinuxSystem.INSTANCE.UBUNTU.getReleaseFilePath(),
- "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=9.04\nDISTRIB_CODENAME=jaunty\nDISTRIB_DESCRIPTION=\"Ubuntu 9.04\"")
- , new ReleaseFile(LinuxSystem.INSTANCE.DEBIAN.getReleaseFilePath(), "squeeze/sid"));
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.DEBIAN.getReleaseFilePath(), "squeeze/sid"),
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.UBUNTU.getReleaseFilePath(),
+ "DISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=9.04\nDISTRIB_CODENAME=jaunty\nDISTRIB_DESCRIPTION=\"Ubuntu 9.04\""));
assertEquals("Ubuntu 9.04", linuxSystem.getDistroNameAndVersion());
}
@Test
- public void canExtractRedHatVersion() {
+ public void canDetectRed() {
LinuxSystem linuxSystem = new LinuxSystemFake(
- new ReleaseFile(LinuxSystem.INSTANCE.REDHAT.getReleaseFilePath(),
- "Red Hat Enterprise Linux Workstation release 6.0 (Santiago)"));
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.REDHAT.getReleaseFilePath(),
+ "Red Hat Enterprise Linux Workstation release 6.0 (Santiago)"));
assertEquals("RedHat 6.0", linuxSystem.getDistroNameAndVersion());
}
@Test
- public void canExtractGentooVersion() {
+ public void canDetectGentoo() {
LinuxSystem linuxSystem = new LinuxSystemFake(
- new ReleaseFile(LinuxSystem.INSTANCE.GENTOO.getReleaseFilePath(), "Gentoo Base System release 2.0.1"));
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.GENTOO.getReleaseFilePath(),
+ "Gentoo Base System release 2.0.1"));
assertEquals("Gentoo 2.0.1", linuxSystem.getDistroNameAndVersion());
}
+ /**
+ * CentOS uses the redhat-release file!
+ * <ul>
+ * <li>/etc/redhat-release</li>
+ * </ul>
+ */
@Test
- public void canExtractCentOSVersion() {
+ public void canDetectCentOS() {
LinuxSystem linuxSystem = new LinuxSystemFake(
- new ReleaseFile(LinuxSystem.INSTANCE.CENTOS.getReleaseFilePath(), "CentOS release 5.3 (Final)"));
+ new ReleaseFile(
+ LinuxSystem.INSTANCE.CENTOS.getReleaseFilePath(),
+ "CentOS release 5.3 (Final)"));
assertEquals("CentOS 5.3", linuxSystem.getDistroNameAndVersion());
}
}
Modified: trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/fakes/LinuxSystemFake.java
===================================================================
--- trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/fakes/LinuxSystemFake.java 2012-01-05 17:38:00 UTC (rev 37659)
+++ trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/fakes/LinuxSystemFake.java 2012-01-05 18:23:20 UTC (rev 37660)
@@ -30,7 +30,7 @@
/** release file paths on the faked system */
private ReleaseFile[] releaseFiles;
-
+
public LinuxSystemFake(ReleaseFile... releaseFiles) {
this.releaseFiles = releaseFiles;
}
12 years, 12 months
JBoss Tools SVN: r37659 - trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages.
by jbosstools-commits@lists.jboss.org
Author: bfitzpat
Date: 2012-01-05 12:38:00 -0500 (Thu, 05 Jan 2012)
New Revision: 37659
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
Log:
JBIDE-10584 - fixing "RE jars missing" message to be a bit more verbose and fit on the two lines at the default wizard size
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2012-01-05 17:32:04 UTC (rev 37658)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/messages/JBossWSUI.properties 2012-01-05 17:38:00 UTC (rev 37659)
@@ -8,7 +8,7 @@
JBossRSGenerateWizard_RS_Wizard_Window_Title=Generate a Sample RESTful Web Service
JBossRSGenerateWizardPage_AddJarsIfFoundCheckbox=Add RESTEasy Jars from root runtime directory
-JBossRSGenerateWizardPage_Error_RestEasyJarsNotFoundInRuntime=RESTEasy jars not found in the runtime associated with selected project. Verify RE is installed and try again or check 'Add RESTeasy jars' below if enabled.
+JBossRSGenerateWizardPage_Error_RestEasyJarsNotFoundInRuntime=RESTEasy jars not found in the project-associated runtime. Verify RE is installed and try again or check 'Add RESTeasy jars' below if enabled.
JBossRSGenerateWizardPage_Label_Application_Class_Name=Application Class Name:
JBossRSGenerateWizardPage_Page_title=Specify the Dynamic Web Project, service, package and class name for the sample web service and web service classes.
JBossRSGenerateWizardPage_ServiceName_Tooltip=Name added to the generated annotated JAX-RS service class as part of the service URI
12 years, 12 months
JBoss Tools SVN: r37658 - in trunk: tests/plugins/org.jboss.tools.tests/META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-05 12:32:04 -0500 (Thu, 05 Jan 2012)
New Revision: 37658
Modified:
trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
Log:
AbstractRefactorTest moved to org.jboss.tools.common.base.test in order to avoid dependency from org.jboss.tools.test to org.jboss.tools.common
Modified: trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-05 17:18:24 UTC (rev 37657)
+++ trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-05 17:32:04 UTC (rev 37658)
@@ -30,7 +30,7 @@
org.jboss.tools.common.validation,
org.eclipse.wst.validation;bundle-version="1.2.300",
org.eclipse.wst.common.frameworks;bundle-version="1.2.100",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.201"
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.0"
Bundle-Version: 3.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Modified: trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2012-01-05 17:18:24 UTC (rev 37657)
+++ trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2012-01-05 17:32:04 UTC (rev 37658)
@@ -9,10 +9,7 @@
org.eclipse.core.resources,
org.junit,
org.eclipse.ui.ide,
- org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
- org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
- org.eclipse.text;bundle-version="3.5.0",
- org.eclipse.ui.ide.application;bundle-version="1.0.200"
+ org.apache.xerces;bundle-version="[2.9.0,3.0.0)"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.test.resource,
org.jboss.tools.test.util,
12 years, 12 months
JBoss Tools SVN: r37657 - in trunk: cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2012-01-05 12:18:24 -0500 (Thu, 05 Jan 2012)
New Revision: 37657
Added:
trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java
Removed:
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringTest.java
trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
Log:
AbstractRefactorTest moved to org.jboss.tools.common.base.test in order to avoid dependency from org.jboss.tools.test to org.jboss.tools.common
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/NamedBeanRefactoringTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -10,9 +10,9 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.internal.core.refactoring.RenameNamedBeanProcessor;
-import org.jboss.tools.tests.AbstractRefactorTest;
-import org.jboss.tools.tests.AbstractRefactorTest.TestChangeStructure;
-import org.jboss.tools.tests.AbstractRefactorTest.TestTextChange;
+import org.jboss.tools.common.base.test.AbstractRefactorTest;
+import org.jboss.tools.common.base.test.AbstractRefactorTest.TestChangeStructure;
+import org.jboss.tools.common.base.test.AbstractRefactorTest.TestTextChange;
public class NamedBeanRefactoringTest extends TCKTest {
private static final String FILE_NAME1 = "JavaSource/org/jboss/jsr299/tck/tests/jbt/refactoring/Gamme.java";
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -45,12 +45,12 @@
import org.jboss.tools.cdi.ui.marker.MakeMethodPublicMarkerResolution;
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithDialog;
import org.jboss.tools.cdi.ui.marker.TestableResolutionWithRefactoringProcessor;
+import org.jboss.tools.common.base.test.AbstractRefactorTest.TestChangeStructure;
import org.jboss.tools.common.base.test.validation.TestUtil;
import org.jboss.tools.common.refactoring.JBDSFileChange;
import org.jboss.tools.common.ui.marker.AddSuppressWarningsMarkerResolution;
import org.jboss.tools.common.ui.marker.ConfigureProblemSeverityMarkerResolution;
import org.jboss.tools.common.util.FileUtil;
-import org.jboss.tools.tests.AbstractRefactorTest.TestChangeStructure;
/**
* @author Daniel Azarov
Modified: trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/common/tests/org.jboss.tools.common.base.test/META-INF/MANIFEST.MF 2012-01-05 17:18:24 UTC (rev 37657)
@@ -29,7 +29,8 @@
org.eclipse.ui.ide;bundle-version="3.7.0",
org.jboss.tools.common.validation,
org.eclipse.wst.validation;bundle-version="1.2.300",
- org.eclipse.wst.common.frameworks;bundle-version="1.2.100"
+ org.eclipse.wst.common.frameworks;bundle-version="1.2.100",
+ org.eclipse.ltk.core.refactoring;bundle-version="3.5.201"
Bundle-Version: 3.3.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Copied: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java (from rev 37656, trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java)
===================================================================
--- trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java (rev 0)
+++ trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -0,0 +1,286 @@
+package org.jboss.tools.common.base.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+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.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
+import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
+import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
+import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
+import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
+import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
+import org.eclipse.text.edits.MultiTextEdit;
+import org.jboss.tools.common.refactoring.JBDSFileChange;
+import org.jboss.tools.test.util.JobUtils;
+
+public class AbstractRefactorTest extends TestCase{
+
+ public AbstractRefactorTest(String name){
+ super(name);
+ }
+
+ public static void checkRename(RenameProcessor processor, List<TestChangeStructure> changeList) throws CoreException{
+ JobUtils.waitForIdle(2000);
+
+ // Test before renaming
+ checkBeforeRefactoring(changeList);
+
+ // Rename
+ RefactoringStatus status = processor.checkInitialConditions(new NullProgressMonitor());
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ status = processor.checkFinalConditions(new NullProgressMonitor(), null);
+
+ entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+
+ CompositeChange rootChange = (CompositeChange)processor.createChange(new NullProgressMonitor());
+
+ checkChanges(rootChange, changeList);
+ }
+
+ public static void checkMove(RefactoringProcessor processor, IResource oldObject, IResource destinationObject, MoveParticipant participant, List<TestChangeStructure> changeList) throws CoreException {
+ JobUtils.waitForIdle(2000);
+
+ // Test before moving
+ checkBeforeRefactoring(changeList);
+
+ // Move
+ MoveArguments arguments = new MoveArguments(destinationObject, true);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Move processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
+
+ Change mainChange = processor.createChange(new NullProgressMonitor());
+ mainChange.perform(new NullProgressMonitor());
+
+ checkChanges(rootChange, changeList);
+ }
+
+ public static void checkRename(RefactoringProcessor processor, IResource oldObject, String newName, RenameParticipant participant, List<TestChangeStructure> changeList) throws CoreException {
+ JobUtils.waitForIdle(2000);
+
+ // Test before renaming
+ checkBeforeRefactoring(changeList);
+
+ // Rename
+ RenameArguments arguments = new RenameArguments(newName, true);
+ boolean initialized = participant.initialize(processor, oldObject, arguments);
+
+ assertTrue("Participant has not been initialized", initialized);
+
+ RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
+
+ RefactoringStatusEntry[] entries = status.getEntries();
+ for(RefactoringStatusEntry entry : entries){
+ System.out.println("Refactor status - "+entry.getMessage());
+ }
+
+ assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
+
+ CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
+
+ Change mainChange = processor.createChange(new NullProgressMonitor());
+ mainChange.perform(new NullProgressMonitor());
+
+ checkChanges(rootChange, changeList);
+ }
+
+ public static void checkBeforeRefactoring(List<TestChangeStructure> changeList){
+ for(TestChangeStructure changeStructure : changeList){
+ IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
+ String content = null;
+ try {
+ content = readStream(file);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+
+ for(TestTextChange change : changeStructure.getTextChanges()){
+ assertNotSame(change.getText(), content.substring(change.getOffset(), change.getOffset()+change.getLength()));
+ }
+ }
+ }
+
+ public static void checkChanges(CompositeChange rootChange, List<TestChangeStructure> changeList) throws CoreException {
+ assertNotNull("Root change is null",rootChange);
+
+ int numberOfChanges = rootChange.getChildren().length;
+
+ for(int i = 0; i < rootChange.getChildren().length;i++){
+ Change fileChange = rootChange.getChildren()[i];
+
+ MultiTextEdit edit = null;
+ IFile file = null;
+ if(fileChange instanceof JBDSFileChange){
+ edit = (MultiTextEdit)((JBDSFileChange)fileChange).getEdit();
+ file = ((JBDSFileChange)fileChange).getFile();
+ //((JBDSFileChange)fileChange).setSaveMode(TextFileChange.FORCE_SAVE);
+ }else if(fileChange instanceof TextFileChange){
+ edit = (MultiTextEdit)((TextFileChange)fileChange).getEdit();
+ file = ((TextFileChange)fileChange).getFile();
+ }
+
+ //System.out.println("File - "+fileChange.getFile().getFullPath()+" offset - "+edit.getOffset());
+
+ TestChangeStructure change = findChange(changeList, file);
+ if(change != null){
+ assertEquals(change.size(), edit.getChildrenSize());
+ }
+ }
+
+ rootChange.perform(new NullProgressMonitor());
+ JobUtils.waitForIdle(2000);
+
+ // Test results
+ for(TestChangeStructure changeStructure : changeList){
+ IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
+ String content = null;
+ content = readStream(file);
+ for(TestTextChange change : changeStructure.getTextChanges()){
+ assertEquals("There is unexpected change in resource - "+file.getName(),change.getText(), content.substring(change.getOffset(), change.getOffset()+change.getLength()));
+ }
+ }
+ assertEquals("There is unexpected number of changes",changeList.size(), numberOfChanges);
+ }
+
+ public static TestChangeStructure findChange(List<TestChangeStructure> changeList, IFile file){
+ for(TestChangeStructure tcs : changeList){
+ if(tcs.getFileName().equals("/"+file.getFullPath().removeFirstSegments(1).toString()))
+ return tcs;
+ }
+ return null;
+ }
+
+
+ public static class TestChangeStructure{
+ private IProject project;
+ private String fileName;
+ ArrayList<TestTextChange> textChanges = new ArrayList<TestTextChange>();
+
+
+ public TestChangeStructure(IProject project, String fileName){
+ this.project = project;
+ this.fileName = fileName;
+ }
+
+ public IProject getProject(){
+ return project;
+ }
+
+ public String getFileName(){
+ return fileName;
+ }
+
+ public ArrayList<TestTextChange> getTextChanges(){
+ return textChanges;
+ }
+
+ public void addTextChange(TestTextChange change){
+ textChanges.add(change);
+ }
+
+ public int size(){
+ return textChanges.size();
+ }
+
+ }
+
+ public static class TestTextChange{
+ private int offset;
+ private int length;
+ private String text;
+
+ public TestTextChange(int offset, int length, String text){
+ this.offset = offset;
+ this.length = length;
+ this.text = text;
+ }
+
+ public int getOffset(){
+ return offset;
+ }
+
+ public int getLength(){
+ return length;
+ }
+
+ public String getText(){
+ return text;
+ }
+ }
+
+ public static String readStream(InputStream is) {
+ StringBuffer sb = new StringBuffer(""); //$NON-NLS-1$
+ try {
+ byte[] b = new byte[4096];
+ while(true) {
+ int l = is.read(b, 0, b.length);
+ if(l < 0) break;
+ sb.append(new String(b, 0, l));
+ }
+ is.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ return sb.toString();
+ }
+
+ public static String readStream(IFile file) throws CoreException {
+ String content = null;
+ InputStream in = null;
+ try {
+ in = file.getContents();
+ content = readStream(in);
+ } finally {
+ if(in!=null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+ }
+ return content;
+ }
+
+}
Property changes on: trunk/common/tests/org.jboss.tools.common.base.test/src/org/jboss/tools/common/base/test/AbstractRefactorTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/ELVariableRefactoringTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -7,9 +7,9 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.base.test.AbstractRefactorTest;
import org.jboss.tools.jsf.el.refactoring.RenameELVariableProcessor;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.tests.AbstractRefactorTest;
public class ELVariableRefactoringTest extends AbstractRefactorTest {
static String projectName = "JSFKickStartOldFormat";
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/JSF2RefactoringTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -10,9 +10,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ltk.internal.core.refactoring.resource.MoveResourcesProcessor;
import org.eclipse.ltk.internal.core.refactoring.resource.RenameResourceProcessor;
+import org.jboss.tools.common.base.test.AbstractRefactorTest;
import org.jboss.tools.jsf.jsf2.refactoring.JSF2RenameParticipant;
import org.jboss.tools.jsf.jsf2.refactoring.JSf2MoveParticipant;
-import org.jboss.tools.tests.AbstractRefactorTest;
public class JSF2RefactoringTest extends AbstractRefactorTest {
static String PROJECT_NAME = "JSF2ComponentsValidator";
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -7,12 +7,12 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.jboss.tools.common.base.test.AbstractRefactorTest;
import org.jboss.tools.common.el.core.parser.LexicalToken;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.el.refactoring.RenameMessagePropertyProcessor;
import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.tests.AbstractRefactorTest;
public class MessagePropertyRefactoringTest extends AbstractRefactorTest{
static String projectName = "JSFKickStartOldFormat";
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2012-01-05 17:18:24 UTC (rev 37657)
@@ -38,6 +38,7 @@
org.eclipse.jst.standard.schemas,
org.eclipse.wst.standard.schemas,
org.jboss.tools.seam.base.test,
- org.jboss.tools.common.validation
+ org.jboss.tools.common.validation,
+ org.jboss.tools.common.base.test;bundle-version="3.3.0"
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamRefactoringTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -8,11 +8,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jst.j2ee.internal.common.classpath.J2EEComponentClasspathUpdater;
+import org.jboss.tools.common.base.test.AbstractRefactorTest;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import org.jboss.tools.tests.AbstractRefactorTest;
public class SeamRefactoringTest extends AbstractRefactorTest {
static String warProjectName = "Test1";
Modified: trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/tests/plugins/org.jboss.tools.tests/META-INF/MANIFEST.MF 2012-01-05 17:18:24 UTC (rev 37657)
@@ -12,8 +12,7 @@
org.apache.xerces;bundle-version="[2.9.0,3.0.0)",
org.eclipse.ltk.core.refactoring;bundle-version="3.5.0",
org.eclipse.text;bundle-version="3.5.0",
- org.eclipse.ui.ide.application;bundle-version="1.0.200",
- org.jboss.tools.common;bundle-version="3.3.0"
+ org.eclipse.ui.ide.application;bundle-version="1.0.200"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.test.resource,
org.jboss.tools.test.util,
Deleted: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2012-01-05 14:41:24 UTC (rev 37656)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractRefactorTest.java 2012-01-05 17:18:24 UTC (rev 37657)
@@ -1,286 +0,0 @@
-package org.jboss.tools.tests;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-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.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.ltk.core.refactoring.Change;
-import org.eclipse.ltk.core.refactoring.CompositeChange;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
-import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
-import org.eclipse.ltk.core.refactoring.participants.MoveArguments;
-import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.core.refactoring.participants.RenameArguments;
-import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
-import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
-import org.eclipse.text.edits.MultiTextEdit;
-import org.jboss.tools.common.refactoring.JBDSFileChange;
-import org.jboss.tools.test.util.JobUtils;
-
-public class AbstractRefactorTest extends TestCase{
-
- public AbstractRefactorTest(String name){
- super(name);
- }
-
- public static void checkRename(RenameProcessor processor, List<TestChangeStructure> changeList) throws CoreException{
- JobUtils.waitForIdle(2000);
-
- // Test before renaming
- checkBeforeRefactoring(changeList);
-
- // Rename
- RefactoringStatus status = processor.checkInitialConditions(new NullProgressMonitor());
-
- RefactoringStatusEntry[] entries = status.getEntries();
- for(RefactoringStatusEntry entry : entries){
- System.out.println("Refactor status - "+entry.getMessage());
- }
-
- assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
-
- status = processor.checkFinalConditions(new NullProgressMonitor(), null);
-
- entries = status.getEntries();
- for(RefactoringStatusEntry entry : entries){
- System.out.println("Refactor status - "+entry.getMessage());
- }
-
- assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
-
-
- CompositeChange rootChange = (CompositeChange)processor.createChange(new NullProgressMonitor());
-
- checkChanges(rootChange, changeList);
- }
-
- public static void checkMove(RefactoringProcessor processor, IResource oldObject, IResource destinationObject, MoveParticipant participant, List<TestChangeStructure> changeList) throws CoreException {
- JobUtils.waitForIdle(2000);
-
- // Test before moving
- checkBeforeRefactoring(changeList);
-
- // Move
- MoveArguments arguments = new MoveArguments(destinationObject, true);
- boolean initialized = participant.initialize(processor, oldObject, arguments);
-
- assertTrue("Participant has not been initialized", initialized);
-
- RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
-
- RefactoringStatusEntry[] entries = status.getEntries();
- for(RefactoringStatusEntry entry : entries){
- System.out.println("Refactor status - "+entry.getMessage());
- }
-
- assertNull("Move processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
-
- CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
-
- Change mainChange = processor.createChange(new NullProgressMonitor());
- mainChange.perform(new NullProgressMonitor());
-
- checkChanges(rootChange, changeList);
- }
-
- public static void checkRename(RefactoringProcessor processor, IResource oldObject, String newName, RenameParticipant participant, List<TestChangeStructure> changeList) throws CoreException {
- JobUtils.waitForIdle(2000);
-
- // Test before renaming
- checkBeforeRefactoring(changeList);
-
- // Rename
- RenameArguments arguments = new RenameArguments(newName, true);
- boolean initialized = participant.initialize(processor, oldObject, arguments);
-
- assertTrue("Participant has not been initialized", initialized);
-
- RefactoringStatus status = participant.checkConditions(new NullProgressMonitor(), null);
-
- RefactoringStatusEntry[] entries = status.getEntries();
- for(RefactoringStatusEntry entry : entries){
- System.out.println("Refactor status - "+entry.getMessage());
- }
-
- assertNull("Rename processor returns fatal error", status.getEntryMatchingSeverity(RefactoringStatus.FATAL));
-
- CompositeChange rootChange = (CompositeChange)participant.createChange(new NullProgressMonitor());
-
- Change mainChange = processor.createChange(new NullProgressMonitor());
- mainChange.perform(new NullProgressMonitor());
-
- checkChanges(rootChange, changeList);
- }
-
- public static void checkBeforeRefactoring(List<TestChangeStructure> changeList){
- for(TestChangeStructure changeStructure : changeList){
- IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
- String content = null;
- try {
- content = readStream(file);
- } catch (CoreException e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- for(TestTextChange change : changeStructure.getTextChanges()){
- assertNotSame(change.getText(), content.substring(change.getOffset(), change.getOffset()+change.getLength()));
- }
- }
- }
-
- public static void checkChanges(CompositeChange rootChange, List<TestChangeStructure> changeList) throws CoreException {
- assertNotNull("Root change is null",rootChange);
-
- int numberOfChanges = rootChange.getChildren().length;
-
- for(int i = 0; i < rootChange.getChildren().length;i++){
- Change fileChange = rootChange.getChildren()[i];
-
- MultiTextEdit edit = null;
- IFile file = null;
- if(fileChange instanceof JBDSFileChange){
- edit = (MultiTextEdit)((JBDSFileChange)fileChange).getEdit();
- file = ((JBDSFileChange)fileChange).getFile();
- //((JBDSFileChange)fileChange).setSaveMode(TextFileChange.FORCE_SAVE);
- }else if(fileChange instanceof TextFileChange){
- edit = (MultiTextEdit)((TextFileChange)fileChange).getEdit();
- file = ((TextFileChange)fileChange).getFile();
- }
-
- //System.out.println("File - "+fileChange.getFile().getFullPath()+" offset - "+edit.getOffset());
-
- TestChangeStructure change = findChange(changeList, file);
- if(change != null){
- assertEquals(change.size(), edit.getChildrenSize());
- }
- }
-
- rootChange.perform(new NullProgressMonitor());
- JobUtils.waitForIdle(2000);
-
- // Test results
- for(TestChangeStructure changeStructure : changeList){
- IFile file = changeStructure.getProject().getFile(changeStructure.getFileName());
- String content = null;
- content = readStream(file);
- for(TestTextChange change : changeStructure.getTextChanges()){
- assertEquals("There is unexpected change in resource - "+file.getName(),change.getText(), content.substring(change.getOffset(), change.getOffset()+change.getLength()));
- }
- }
- assertEquals("There is unexpected number of changes",changeList.size(), numberOfChanges);
- }
-
- public static TestChangeStructure findChange(List<TestChangeStructure> changeList, IFile file){
- for(TestChangeStructure tcs : changeList){
- if(tcs.getFileName().equals("/"+file.getFullPath().removeFirstSegments(1).toString()))
- return tcs;
- }
- return null;
- }
-
-
- public static class TestChangeStructure{
- private IProject project;
- private String fileName;
- ArrayList<TestTextChange> textChanges = new ArrayList<TestTextChange>();
-
-
- public TestChangeStructure(IProject project, String fileName){
- this.project = project;
- this.fileName = fileName;
- }
-
- public IProject getProject(){
- return project;
- }
-
- public String getFileName(){
- return fileName;
- }
-
- public ArrayList<TestTextChange> getTextChanges(){
- return textChanges;
- }
-
- public void addTextChange(TestTextChange change){
- textChanges.add(change);
- }
-
- public int size(){
- return textChanges.size();
- }
-
- }
-
- public static class TestTextChange{
- private int offset;
- private int length;
- private String text;
-
- public TestTextChange(int offset, int length, String text){
- this.offset = offset;
- this.length = length;
- this.text = text;
- }
-
- public int getOffset(){
- return offset;
- }
-
- public int getLength(){
- return length;
- }
-
- public String getText(){
- return text;
- }
- }
-
- public static String readStream(InputStream is) {
- StringBuffer sb = new StringBuffer(""); //$NON-NLS-1$
- try {
- byte[] b = new byte[4096];
- while(true) {
- int l = is.read(b, 0, b.length);
- if(l < 0) break;
- sb.append(new String(b, 0, l));
- }
- is.close();
- } catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- return sb.toString();
- }
-
- public static String readStream(IFile file) throws CoreException {
- String content = null;
- InputStream in = null;
- try {
- in = file.getContents();
- content = readStream(in);
- } finally {
- if(in!=null) {
- try {
- in.close();
- } catch (IOException e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
- }
- return content;
- }
-
-}
12 years, 12 months
JBoss Tools SVN: r37656 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 09:41:24 -0500 (Thu, 05 Jan 2012)
New Revision: 37656
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
Log:
[JBIDE-10577] added Mint Linux
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:40:04 UTC (rev 37655)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:41:24 UTC (rev 37656)
@@ -108,22 +108,13 @@
}
/**
- * Checks if the current system is a Mint Linux distribution.
- * It checks if /etc/lsb-release contains <tt>LinuxMint"</tt>.
- * We could also check for presence of /etc/linuxmint(/info)
- * @return
+ * Checks if the current system is a CentOS distribution.
+ * It checks if /etc/lsb-release contains <tt>CentOS</tt>.
+ * @return true if /etc/redhat-release contains CentoOS
*/
@Override
protected boolean isDistro() {
- try {
- boolean fileExists = super.isDistro();
- if (fileExists) {
- String content = getDistroFileContent(releaseFilePath);
- return content != null && content.indexOf(CENTOS_NAME) >= 0;
- }
- } catch (IOException e) {
- }
- return false;
+ return distroFileContains(CENTOS_NAME);
}
}
@@ -135,17 +126,15 @@
super(MINTLINUX_NAME, LSB_RELEASE_FILE);
}
+ /**
+ * Checks if the current system is a Mint Linux distribution.
+ * It checks if /etc/lsb-release contains <tt>LinuxMint</tt>.
+ * We could also check for presence of /etc/linuxmint(/info)
+ * @return true if /etc/lsb-release contains LinuxMint
+ */
@Override
protected boolean isDistro() {
- try {
- boolean fileExists = super.isDistro();
- if (fileExists) {
- String content = getDistroFileContent(releaseFilePath);
- return content != null && content.indexOf(MINTLINUX_NAME) >= 0;
- }
- } catch (IOException e) {
- }
- return false;
+ return distroFileContains(MINTLINUX_NAME);
}
}
@@ -167,7 +156,7 @@
}
protected boolean isDistro() {
- return exists(releaseFilePath);
+ return exists(getReleaseFilePath());
}
public String getName() {
@@ -176,7 +165,7 @@
public String getVersion() {
try {
- String distroString = getDistroFileContent(releaseFilePath);
+ String distroString = getDistroFileContent(getReleaseFilePath());
Matcher matcher = VERSION_REGEX.matcher(distroString);
if (matcher.find()) {
return matcher.group(1);
@@ -190,26 +179,42 @@
return new StringBuilder().append(getName()).append(" ").append(getVersion()).toString();
}
- public String getReleaseFilePath() {
+ protected String getReleaseFilePath() {
return releaseFilePath;
}
- }
- protected boolean exists(String releaseFilePath) {
- return new File(releaseFilePath).exists();
- }
+ protected boolean exists(String releaseFilePath) {
+ return releaseFilePath != null
+ && releaseFilePath.length() > 0
+ && new File(releaseFilePath).exists();
+ }
- protected String getDistroFileContent(String filePath) throws IOException {
- int charachtersToRead = 1024;
- StringBuilder builder = new StringBuilder(charachtersToRead);
- BufferedReader reader = new BufferedReader(new FileReader(filePath));
- char[] buf = new char[charachtersToRead];
- int charRead = 0;
- while ((charRead = reader.read(buf)) != -1 && builder.length() < charachtersToRead) {
- String readData = String.valueOf(buf, 0, charRead);
- builder.append(readData);
+ protected boolean distroFileContains(String value) {
+ try {
+ boolean fileExists = exists(getReleaseFilePath());
+ if (fileExists) {
+ String content = getDistroFileContent(getReleaseFilePath());
+ return content != null && content.indexOf(value) >= 0;
+ }
+ } catch (IOException e) {
+ }
+ return false;
+
}
- reader.close();
- return builder.toString();
+
+ protected String getDistroFileContent(String filePath) throws IOException {
+ int charachtersToRead = 1024;
+ StringBuilder builder = new StringBuilder(charachtersToRead);
+ BufferedReader reader = new BufferedReader(new FileReader(filePath));
+ char[] buf = new char[charachtersToRead];
+ int charRead = 0;
+ while ((charRead = reader.read(buf)) != -1 && builder.length() < charachtersToRead) {
+ String readData = String.valueOf(buf, 0, charRead);
+ builder.append(readData);
+ }
+ reader.close();
+ return builder.toString();
+ }
+
}
}
12 years, 12 months
JBoss Tools SVN: r37655 - trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-01-05 09:40:04 -0500 (Thu, 05 Jan 2012)
New Revision: 37655
Modified:
trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac...
trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent...
Log:
add bpmn2-modeler/20120105-0830/ to reqs (needed for Savara) [SAVARA-272]
Modified: trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac...
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac... 2012-01-05 14:33:54 UTC (rev 37654)
+++ trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeArtifac... 2012-01-05 14:40:04 UTC (rev 37655)
@@ -3,22 +3,23 @@
<repository name='JBoss Tools Requirements - Composite Indigo SR1 Mirror' type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='true'/>
-<property name='p2.timestamp' value='1324599902000'/>
+<property name='p2.timestamp' value='1325772492000'/>
</properties>
-<children size='14'>
+<children size='15'>
<child location='../../requirements/indigo/201112221140-SR1-M/'/>
<child location='../../requirements/birt/3.7.1/'/>
<child location='../../requirements/bpel/0.8.0.v20111120-0746-H98-CI/'/>
+<child location='../../requirements/bpmn2-modeler/20120105-0830/'/>
<child location='../../requirements/ecf/3.5.3/'/>
+
<child location='../../requirements/eclipse/3.7.2.M20111214-1406/'/>
-
<child location='../../requirements/egit/1.2.0.201112131611/'/>
<child location='../../requirements/emf/2.7.2.v20111031-1121/'/>
<!-- includes m2e, m2e-extras, m2e-wtp -->
<child location='../../requirements/m2eclipse/20111005-1500/'/>
<child location='../../requirements/mylyn/3.6.4.v20111118-0100/'/>
+
<child location='../../requirements/orbit/R20110523182458/'/>
-
<child location='../../requirements/swtbot/2.0.5/'/>
<child location='../../requirements/webtools/3.3.2-20111207200956/'/>
<child location='../../requirements/xulrunner-1.9.2/'/>
Modified: trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent...
===================================================================
--- trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent... 2012-01-05 14:33:54 UTC (rev 37654)
+++ trunk/download.jboss.org/jbosstools/updates/indigo/SR1-M/compositeContent... 2012-01-05 14:40:04 UTC (rev 37655)
@@ -3,22 +3,23 @@
<repository name='JBoss Tools Requirements - Composite Indigo SR1 Mirror' type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>
<properties size='2'>
<property name='p2.compressed' value='true'/>
-<property name='p2.timestamp' value='1324599909000'/>
+<property name='p2.timestamp' value='1325772506000'/>
</properties>
-<children size='14'>
+<children size='15'>
<child location='../../requirements/indigo/201112221140-SR1-M/'/>
<child location='../../requirements/birt/3.7.1/'/>
<child location='../../requirements/bpel/0.8.0.v20111120-0746-H98-CI/'/>
+<child location='../../requirements/bpmn2-modeler/20120105-0830/'/>
<child location='../../requirements/ecf/3.5.3/'/>
+
<child location='../../requirements/eclipse/3.7.2.M20111214-1406/'/>
-
<child location='../../requirements/egit/1.2.0.201112131611/'/>
<child location='../../requirements/emf/2.7.2.v20111031-1121/'/>
<!-- includes m2e, m2e-extras, m2e-wtp -->
<child location='../../requirements/m2eclipse/20111005-1500/'/>
<child location='../../requirements/mylyn/3.6.4.v20111118-0100/'/>
+
<child location='../../requirements/orbit/R20110523182458/'/>
-
<child location='../../requirements/swtbot/2.0.5/'/>
<child location='../../requirements/webtools/3.3.2-20111207200956/'/>
<child location='../../requirements/xulrunner-1.9.2/'/>
12 years, 12 months
JBoss Tools SVN: r37654 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 09:33:54 -0500 (Thu, 05 Jan 2012)
New Revision: 37654
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
Log:
[JBIDE-10577] added Mint Linux
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:29:36 UTC (rev 37653)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:33:54 UTC (rev 37654)
@@ -107,6 +107,12 @@
super(CENTOS_NAME, REDHAT_RELEASE_FILE);
}
+ /**
+ * Checks if the current system is a Mint Linux distribution.
+ * It checks if /etc/lsb-release contains <tt>LinuxMint"</tt>.
+ * We could also check for presence of /etc/linuxmint(/info)
+ * @return
+ */
@Override
protected boolean isDistro() {
try {
12 years, 12 months
JBoss Tools SVN: r37653 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 09:29:36 -0500 (Thu, 05 Jan 2012)
New Revision: 37653
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
Log:
[JBIDE-10577] added Mint Linux
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:28:02 UTC (rev 37652)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:29:36 UTC (rev 37653)
@@ -55,16 +55,18 @@
* <li>/etc/lsb-release</li>
* <li>/etc/debian_version</li>
* </ul>
- *
+ * <p>
* It is not reliable to check Debian first and check there's no
* /etc/lsb-release exists. Debian may also have a /etc/lsb-release. We must
* check ubuntu prior to Debian.
- *
* @see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=444678
+ * <p>
+ * The very same applies to Mint Linux. It also has a /etc/lsb-release and we
+ * therefore have to check mint prior to ubuntu and debian.
*
*/
+ MINT,
UBUNTU,
- MINT,
DEBIAN,
FEDORA,
GENTOO,
12 years, 12 months
JBoss Tools SVN: r37652 - trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-05 09:28:02 -0500 (Thu, 05 Jan 2012)
New Revision: 37652
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
Log:
[JBIDE-10577] added Mint Linux
Modified: trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java
===================================================================
--- trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:02:34 UTC (rev 37651)
+++ trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/googleanalytics/eclipse/LinuxSystem.java 2012-01-05 14:28:02 UTC (rev 37652)
@@ -32,7 +32,7 @@
* release-file strings</a>
*/
- public final LinuxDistro CENTOS = new CentOSDistro("CentOS", "/etc/redhat-release");
+ public final LinuxDistro CENTOS = new CentOSDistro();
public final LinuxDistro DEBIAN = new LinuxDistro("Debian", "/etc/debian_version");
public final LinuxDistro FEDORA = new LinuxDistro("Fedora", "/etc/fedora-release");
public final LinuxDistro GENTOO = new LinuxDistro("Gentoo", "/etc/gentoo-release");
@@ -45,6 +45,7 @@
public final LinuxDistro SLACKWARE = new LinuxDistro("Slackware", "/etc/slackware-version");
public final LinuxDistro SUSE = new LinuxDistro("SUSE", "/etc/SuSE-release");
public final LinuxDistro UBUNTU = new LinuxDistro("Ubuntu", "/etc/lsb-release");
+ public final LinuxDistro MINT = new MintLinuxDistro();
private final LinuxDistro[] ALL = new LinuxDistro[] {
CENTOS,
@@ -55,7 +56,7 @@
* <li>/etc/debian_version</li>
* </ul>
*
- * It is not reliable to check Debian first and check there if no
+ * It is not reliable to check Debian first and check there's no
* /etc/lsb-release exists. Debian may also have a /etc/lsb-release. We must
* check ubuntu prior to Debian.
*
@@ -63,6 +64,7 @@
*
*/
UBUNTU,
+ MINT,
DEBIAN,
FEDORA,
GENTOO,
@@ -97,9 +99,10 @@
protected class CentOSDistro extends LinuxDistro {
private static final String CENTOS_NAME = "CentOS";
-
- protected CentOSDistro(String name, String releaseFilePath) {
- super(name, releaseFilePath);
+ private static final String REDHAT_RELEASE_FILE = "/etc/redhat-release";
+
+ protected CentOSDistro() {
+ super(CENTOS_NAME, REDHAT_RELEASE_FILE);
}
@Override
@@ -116,6 +119,28 @@
}
}
+ protected class MintLinuxDistro extends LinuxDistro {
+ private static final String MINTLINUX_NAME = "LinuxMint";
+ private static final String LSB_RELEASE_FILE = "/etc/lsb-release";
+
+ protected MintLinuxDistro() {
+ super(MINTLINUX_NAME, LSB_RELEASE_FILE);
+ }
+
+ @Override
+ protected boolean isDistro() {
+ try {
+ boolean fileExists = super.isDistro();
+ if (fileExists) {
+ String content = getDistroFileContent(releaseFilePath);
+ return content != null && content.indexOf(MINTLINUX_NAME) >= 0;
+ }
+ } catch (IOException e) {
+ }
+ return false;
+ }
+ }
+
public class LinuxDistro {
/**
@@ -136,7 +161,7 @@
protected boolean isDistro() {
return exists(releaseFilePath);
}
-
+
public String getName() {
return name;
}
12 years, 12 months