JBoss Tools SVN: r37903 - in trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui: skin and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2012-01-17 12:59:17 -0500 (Tue, 17 Jan 2012)
New Revision: 37903
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
Log:
https://issues.jboss.org/browse/JBIDE-10656 : BrowserSim: add enabled/disabled state for the 'back' and 'forward' buttons
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-17 17:26:58 UTC (rev 37902)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/BrowserSim.java 2012-01-17 17:59:17 UTC (rev 37903)
@@ -86,6 +86,7 @@
browserSim.initDevicesListHolder();
browserSim.devicesListHolder.setDevicesList(devicesList);
browserSim.devicesListHolder.notifyObservers();
+ browserSim.controlHandler.goHome();
while (browserSim.skin!= null && browserSim.skin.getShell() != null && !browserSim.skin.getShell().isDisposed()) {//XXX
if (!display.readAndDispatch())
@@ -177,7 +178,8 @@
browser.addLocationListener(new LocationListener() {
public void changed(LocationEvent event) {
if (event.top) {
- skin.locationChanged(event.location);
+ BrowserSimBrowser browser = (BrowserSimBrowser) event.widget;
+ skin.locationChanged(event.location, browser.isBackEnabled(), browser.isForwardEnabled());
}
}
public void changing(LocationEvent event) {
@@ -360,9 +362,9 @@
skin.getBrowser().setDefaultUserAgent(device.getUserAgent());
if (oldSkinUrl != null) {
- skin.getBrowser().setUrl(oldSkinUrl);
+ skin.getBrowser().setUrl(oldSkinUrl); // skin (and browser instance) is changed
} else {
- skin.getBrowser().setUrl(homeUrl);
+ skin.getBrowser().refresh(); // only user agent and size of the browser is changed
}
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-01-17 17:26:58 UTC (rev 37902)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/AppleIPhone3Skin.java 2012-01-17 17:59:17 UTC (rev 37903)
@@ -361,8 +361,10 @@
}
@Override
- public void locationChanged(String location) {
+ public void locationChanged(String location, boolean backEnabled, boolean forwardEnabled) {
locationText.setText(location);
+ backCompositeDecorator.setVisible(backEnabled);
+ forwardCompositeDecorator.setVisible(forwardEnabled);
}
@Override
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-01-17 17:26:58 UTC (rev 37902)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/BrowserSimSkin.java 2012-01-17 17:59:17 UTC (rev 37903)
@@ -29,7 +29,7 @@
void setControlHandler(ControlHandler controlHandler);
void setBrowserSize(int width, int height);
- void locationChanged(String newLocation);
+ void locationChanged(String newLocation, boolean backEnabled, boolean forwardEnabled);
void progressChanged(int percents); // -1 for completed
void statusTextChanged(String newStatusText);
void setOrientation(int orientation);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-01-17 17:26:58 UTC (rev 37902)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim/src/org/jboss/tools/vpe/browsersim/ui/skin/NativeSkin.java 2012-01-17 17:59:17 UTC (rev 37903)
@@ -300,8 +300,10 @@
}
@Override
- public void locationChanged(String location) {
+ public void locationChanged(String location, boolean backEnabled, boolean forwardEnabled) {
locationText.setText(location);
+ itemBack.setEnabled(backEnabled);
+ itemForward.setEnabled(forwardEnabled);
}
@Override
12 years, 12 months
JBoss Tools SVN: r37902 - trunk/download.jboss.org/jbosstools/examples.
by jbosstools-commits@lists.jboss.org
Author: fbricon
Date: 2012-01-17 12:26:58 -0500 (Tue, 17 Jan 2012)
New Revision: 37902
Modified:
trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml
trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml
Log:
JBIDE-10629 : renamed category, changed shortDescriptions, added required changes to JBDS 5 examples
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml 2012-01-17 17:10:25 UTC (rev 37901)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-jbds50.xml 2012-01-17 17:26:58 UTC (rev 37902)
@@ -1,9 +1,9 @@
<projects>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>helloworld</name>
<included-projects>jboss-as-helloworld</included-projects>
- <shortDescription>Helloworld Example</shortDescription>
+ <shortDescription>Helloworld</shortDescription>
<description>
This example demonstrates the use of CDI 1.0 and Servlet 3 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -38,10 +38,12 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-helloworld/cheatsheets/helloworld.xml"/>
+ <tags>central</tags>
+ <icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>helloworld-osgi</name>
<included-projects>jboss-as-helloworld-osgi</included-projects>
<shortDescription>Helloworld OSGi Example</shortDescription>
@@ -82,14 +84,15 @@
</fixes>
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
- </project>
+ <icon path="icons/jbossas7.png" />
+ </project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>login</name>
<included-projects>jboss-as-login</included-projects>
- <shortDescription>Login Example</shortDescription>
+ <shortDescription>Login</shortDescription>
<description>
This example demonstrates the use of CDI 1.0, JPA 2.0, JTA 1.1, EJB 3.1 and JSF 2.0 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -124,13 +127,15 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-login/cheatsheets/login.xml"/>
+ <tags>central</tags>
+ <icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>numberguess</name>
<included-projects>jboss-as-numberguess</included-projects>
- <shortDescription>Numberguess Example</shortDescription>
+ <shortDescription>Numberguess</shortDescription>
<description>
This example demonstrates the use of CDI 1.0 and JSF 2.0 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -165,13 +170,15 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-numberguess/cheatsheets/numberguess.xml"/>
+ <tags>central</tags>
+ <icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>kitchensink</name>
<included-projects>jboss-as-kitchensink</included-projects>
- <shortDescription>Kitchensink Example</shortDescription>
+ <shortDescription>Kitchensink</shortDescription>
<description>
This is your project! It's a sample, deployable Maven 3 project to help you get your foot in the door developing with Java EE 6 on JBoss AS 7.
This project is setup to allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0.
@@ -207,12 +214,14 @@
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
<welcome type="cheatsheets" url="/jboss-as-kitchensink/cheatsheets/kitchensink.xml"/>
+ <tags>central</tags>
+ <icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>poh5-helloworld</name>
<included-projects>poh5-helloworld</included-projects>
- <shortDescription>HTML5 Example for mobile devices</shortDescription>
+ <shortDescription>HTML5</shortDescription>
<description>This example demonstrates the use of *CDI 1.0* and *JAX-RS* in *JBoss AS 7* using the Plain Old HTML5 (POH5) architecture.
POH5 is basically a smart, HTML5+CSS3+JavaScript front-end using RESTful services on the backend.</description>
<size>7266</size>
@@ -247,6 +256,8 @@
<!-- no cheatsheet yet
<welcome type="cheatsheets" url="/poh5-helloworld/cheatsheets/poh5-helloworld.xml"/>
-->
+ <tags>central</tags>
+ <icon path="icons/jbossas7.png" />
</project>
</projects>
Modified: trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml
===================================================================
--- trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml 2012-01-17 17:10:25 UTC (rev 37901)
+++ trunk/download.jboss.org/jbosstools/examples/project-examples-maven-3.3.xml 2012-01-17 17:26:58 UTC (rev 37902)
@@ -35,15 +35,14 @@
</properties>
-->
</mavenArchetype>
- <tags>central</tags>
<icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>helloworld</name>
<included-projects>jboss-as-helloworld</included-projects>
- <shortDescription>Helloworld Example</shortDescription>
+ <shortDescription>Helloworld</shortDescription>
<description>
This example demonstrates the use of CDI 1.0 and Servlet 3 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -83,7 +82,7 @@
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>helloworld-osgi</name>
<included-projects>jboss-as-helloworld-osgi</included-projects>
<shortDescription>Helloworld OSGi Example</shortDescription>
@@ -124,16 +123,15 @@
</fixes>
<importType>maven</importType>
<importTypeDescription>The project example requires the m2eclipse, m2eclipse-wtp and JBoss Maven Project Examples feature.</importTypeDescription>
- <tags>central</tags>
<icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>login</name>
<included-projects>jboss-as-login</included-projects>
- <shortDescription>Login Example</shortDescription>
+ <shortDescription>Login</shortDescription>
<description>
This example demonstrates the use of CDI 1.0, JPA 2.0, JTA 1.1, EJB 3.1 and JSF 2.0 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -173,10 +171,10 @@
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>numberguess</name>
<included-projects>jboss-as-numberguess</included-projects>
- <shortDescription>Numberguess Example</shortDescription>
+ <shortDescription>Numberguess</shortDescription>
<description>
This example demonstrates the use of CDI 1.0 and JSF 2.0 in JBoss AS 7.
The example can be deployed using Maven from the command line or from Eclipse using JBoss Tools.
@@ -216,10 +214,10 @@
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>kitchensink</name>
<included-projects>jboss-as-kitchensink</included-projects>
- <shortDescription>Kitchensink Example</shortDescription>
+ <shortDescription>Kitchensink</shortDescription>
<description>
This is your project! It's a sample, deployable Maven 3 project to help you get your foot in the door developing with Java EE 6 on JBoss AS 7.
This project is setup to allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0, EJB 3.1, JPA 2.0 and Bean Validation 1.0.
@@ -259,10 +257,10 @@
<icon path="icons/jbossas7.png" />
</project>
<project>
- <category>JBoss AS 7 Quickstarts</category>
+ <category>JBoss Quickstarts</category>
<name>poh5-helloworld</name>
<included-projects>poh5-helloworld</included-projects>
- <shortDescription>HTML5 Example for mobile devices</shortDescription>
+ <shortDescription>HTML5</shortDescription>
<description>This example demonstrates the use of *CDI 1.0* and *JAX-RS* in *JBoss AS 7* using the Plain Old HTML5 (POH5) architecture.
POH5 is basically a smart, HTML5+CSS3+JavaScript front-end using RESTful services on the backend.</description>
<size>7266</size>
@@ -297,7 +295,7 @@
<!-- no cheatsheet yet
<welcome type="cheatsheets" url="/poh5-helloworld/cheatsheets/poh5-helloworld.xml"/>
-->
- <tags>central, poh5</tags>
+ <tags>central</tags>
<icon path="icons/jbossas7.png" />
</project>
12 years, 12 months
JBoss Tools SVN: r37901 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 12:10:25 -0500 (Tue, 17 Jan 2012)
New Revision: 37901
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java
Log:
[JBIDE-10479] cleaned code
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java 2012-01-17 15:50:18 UTC (rev 37900)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java 2012-01-17 17:10:25 UTC (rev 37901)
@@ -14,7 +14,6 @@
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
@@ -29,6 +28,7 @@
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
@@ -248,18 +248,10 @@
}
private Document getDocument() throws CoreException {
- return getDocument(pomFile);
- }
-
- private Document getDocument(IFile file) throws CoreException {
- return getDocument(file.getContents());
- }
-
- private Document getDocument(InputStream inputStream) throws CoreException {
try {
if (document == null) {
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- this.document = documentBuilder.parse(inputStream);
+ this.document = documentBuilder.parse(pomFile.getContents());
}
return document;
} catch (ParserConfigurationException e) {
@@ -286,17 +278,9 @@
public void savePom() throws CoreException {
Writer writer = null;
try {
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
- transformerFactory.setAttribute("indent-number", new Integer(4));
-
- Transformer transformer = transformerFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-
writer = new OutputStreamWriter(new FileOutputStream(pomFile.getLocation().toString()), "UTF-8");
Result out = new StreamResult(writer);
- transformer.transform(new DOMSource(getDocument()), out);
+ createTransformer().transform(new DOMSource(getDocument()), out);
} catch (TransformerConfigurationException e) {
throw new CoreException(createStatus(e));
} catch (UnsupportedEncodingException e) {
@@ -310,6 +294,18 @@
}
}
+ private Transformer createTransformer()
+ throws TransformerFactoryConfigurationError, TransformerConfigurationException {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ transformerFactory.setAttribute("indent-number", new Integer(4));
+
+ Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+ return transformer;
+ }
+
private void safeClose(Writer writer) {
if (writer == null) {
return;
@@ -321,7 +317,7 @@
// ignore;
}
}
-
+
public static boolean isMavenProject(IProject project) {
return project.getFile(POM_FILENAME).exists();
}
12 years, 12 months
JBoss Tools SVN: r37900 - trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 10:50:18 -0500 (Tue, 17 Jan 2012)
New Revision: 37900
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
Log:
[JBIDE-10479] added test for EGitUtils#addRemoteTo
Modified: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:45:40 UTC (rev 37899)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:50:18 UTC (rev 37900)
@@ -169,11 +169,8 @@
StoredConfig config = repository.getConfig();
Set<String> subsections = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
- assertEquals(1, subsections.size()); // origin and redhat
+ assertEquals(1, subsections.size());
assertTrue(subsections.contains(remoteName));
assertEquals(gitUri, config.getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL));
}
-
-
-
}
12 years, 12 months
JBoss Tools SVN: r37899 - trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 10:45:40 -0500 (Tue, 17 Jan 2012)
New Revision: 37899
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
Log:
[JBIDE-10479] added test for EGitUtils#addRemoteTo
Modified: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:43:37 UTC (rev 37898)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:45:40 UTC (rev 37899)
@@ -16,7 +16,6 @@
import org.eclipse.jgit.lib.ConfigConstants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
-import org.eclipse.jgit.transport.URIish;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.internal.test.util.TestProject;
import org.jboss.tools.openshift.egit.internal.test.util.TestRepository;
@@ -165,7 +164,7 @@
public void canAddRemoteRepo() throws Exception {
Repository repository = testRepository.getRepository();
String remoteName = "redhat";
- String gitUri = "http://www.redhat.com";
+ String gitUri = "www.redhat.com";
EGitUtils.addRemoteTo(remoteName, gitUri, repository);
StoredConfig config = repository.getConfig();
12 years, 12 months
JBoss Tools SVN: r37898 - trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 10:43:37 -0500 (Tue, 17 Jan 2012)
New Revision: 37898
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
Log:
[JBIDE-10479] added test for EGitUtils#addRemoteTo
Modified: trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:40:39 UTC (rev 37897)
+++ trunk/openshift/tests/org.jboss.tools.openshift.egit.test/src/org/jboss/tools/openshift/egit/internal/test/EGitUtilsTest.java 2012-01-17 15:43:37 UTC (rev 37898)
@@ -1,13 +1,22 @@
package org.jboss.tools.openshift.egit.internal.test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URISyntaxException;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.egit.core.Activator;
+import org.eclipse.jgit.lib.ConfigConstants;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.lib.StoredConfig;
+import org.eclipse.jgit.transport.URIish;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.internal.test.util.TestProject;
import org.jboss.tools.openshift.egit.internal.test.util.TestRepository;
@@ -144,5 +153,28 @@
fileName,
fileContent);
}
+
+ @Test
+ public void canGetRepoForProject() throws Exception {
+ Repository repository = EGitUtils.getRepository(testProject.getProject());
+ assertNotNull(repository);
+ assertEquals(testRepository.getRepository(), repository);
+ }
+ @Test
+ public void canAddRemoteRepo() throws Exception {
+ Repository repository = testRepository.getRepository();
+ String remoteName = "redhat";
+ String gitUri = "http://www.redhat.com";
+ EGitUtils.addRemoteTo(remoteName, gitUri, repository);
+
+ StoredConfig config = repository.getConfig();
+ Set<String> subsections = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
+ assertEquals(1, subsections.size()); // origin and redhat
+ assertTrue(subsections.contains(remoteName));
+ assertEquals(gitUri, config.getString(ConfigConstants.CONFIG_REMOTE_SECTION, remoteName, ConfigConstants.CONFIG_KEY_URL));
+ }
+
+
+
}
12 years, 12 months
JBoss Tools SVN: r37897 - trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 10:40:39 -0500 (Tue, 17 Jan 2012)
New Revision: 37897
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
Log:
[JBIDE-10479] added test for EGitUtils#addRemoteTo
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2012-01-17 14:35:47 UTC (rev 37896)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.egit.core/src/org/jboss/tools/openshift/egit/core/EGitUtils.java 2012-01-17 15:40:39 UTC (rev 37897)
@@ -32,6 +32,8 @@
import org.eclipse.egit.core.EclipseGitProgressTransformer;
import org.eclipse.egit.core.IteratorService;
import org.eclipse.egit.core.op.AddToIndexOperation;
+import org.eclipse.egit.core.op.CloneOperation;
+import org.eclipse.egit.core.op.CloneOperation.PostCloneTask;
import org.eclipse.egit.core.op.CommitOperation;
import org.eclipse.egit.core.op.ConnectProviderOperation;
import org.eclipse.egit.core.op.FetchOperation;
@@ -40,7 +42,6 @@
import org.eclipse.egit.core.op.PushOperationResult;
import org.eclipse.egit.core.op.PushOperationSpecification;
import org.eclipse.egit.core.project.RepositoryMapping;
-import org.eclipse.egit.ui.UIText;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.InitCommand;
import org.eclipse.jgit.api.MergeResult;
@@ -73,11 +74,12 @@
*/
public class EGitUtils {
+ private static final int CLONE_TIMEOUT = 10 * 1024;
+ private static final int PUSH_TIMEOUT = 10 * 1024;
// private static final RefSpec DEFAULT_PUSH_REF_SPEC = new RefSpec("refs/heads/*:refs/remotes/origin/*"); //$NON-NLS-1$
private static final String DEFAULT_REFSPEC_SOURCE = Constants.HEAD; // HEAD
private static final String DEFAULT_REFSPEC_DESTINATION = Constants.R_HEADS + Constants.MASTER; // refs/heads/master
- private static final int PUSH_TIMEOUT = 10 * 1024;
- private static final String EGIT_TEAM_PROVIDER_ID = "org.eclipse.egit.core·GitProvider";
+ private static final String EGIT_TEAM_PROVIDER_ID = "org.eclipse.egit.core.GitProvider";
private EGitUtils() {
// inhibit instantiation
@@ -106,7 +108,9 @@
* provider.
*/
public static boolean isSharedWithGit(IProject project) {
- return EGIT_TEAM_PROVIDER_ID.equals(RepositoryProvider.getProvider(project));
+ RepositoryProvider provider = RepositoryProvider.getProvider(project);
+ return provider != null
+ && EGIT_TEAM_PROVIDER_ID.equals(provider.getID());
}
/**
@@ -212,6 +216,27 @@
new ConnectProviderOperation(project, repositoryFolder).execute(monitor);
}
+ public static void cloneRepository(String uri, String remoteName, File destination, IProgressMonitor monitor)
+ throws URISyntaxException, InvocationTargetException, InterruptedException {
+
+ }
+
+ public static void cloneRepository(String uri, String remoteName, File destination, PostCloneTask postCloneTask,
+ IProgressMonitor monitor)
+ throws URISyntaxException, InvocationTargetException, InterruptedException {
+ URIish gitUri = new URIish(uri);
+ CloneOperation cloneOperation =
+ new CloneOperation(gitUri, true, null, destination, Constants.HEAD, remoteName, CLONE_TIMEOUT);
+ if (postCloneTask != null) {
+ cloneOperation.addPostCloneTask(postCloneTask);
+ }
+ cloneOperation.run(monitor);
+ // RepositoryUtil repositoryUtil =
+ // Activator.getDefault().getRepositoryUtil();
+ // repositoryUtil.addConfiguredRepository(new File(destination,
+ // Constants.DOT_GIT));
+ }
+
/**
* Merges the given uri to HEAD in the given repository. The given branch is
* the branch in the local repo the fetched HEAD is fetched to.
@@ -388,10 +413,6 @@
}
}
- private static PushOperation createPushOperation(String remoteName, Repository repository) {
- return new PushOperation(repository, remoteName, false, PUSH_TIMEOUT);
- }
-
private static PushOperation createPushOperation(RemoteConfig remoteConfig, Repository repository, boolean force)
throws CoreException {
@@ -651,6 +672,11 @@
return remoteName;
}
+ public static void addRemoteTo(String remoteName, String uri, Repository repository)
+ throws MalformedURLException, URISyntaxException, IOException {
+ addRemoteTo(remoteName, new URIish(uri), repository);
+ }
+
/**
* Adds the given uri of a remote repository to the given repository by the
* given name.
@@ -704,8 +730,8 @@
EclipseGitProgressTransformer jgitMonitor = new EclipseGitProgressTransformer(monitor);
IndexDiff indexDiff = new IndexDiff(repo, Constants.HEAD,
IteratorService.createInitialIterator(repo));
- indexDiff.diff(jgitMonitor, 0, 0, NLS.bind(
- UIText.CommitActionHandler_repository, repo.getDirectory().getPath()));
+ indexDiff.diff(jgitMonitor, 0, 0,
+ NLS.bind("Repository: {0}", repo.getDirectory().getPath()));
Set<String> set = new HashSet<String>();
if (commitAddedResources(server))
set.addAll(indexDiff.getAdded());
12 years, 12 months
JBoss Tools SVN: r37896 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 09:35:47 -0500 (Tue, 17 Jan 2012)
New Revision: 37896
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java
Log:
[JBIDE-10479] added closing of outputstream
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java 2012-01-17 14:34:38 UTC (rev 37895)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/OpenShiftMavenProfile.java 2012-01-17 14:35:47 UTC (rev 37896)
@@ -17,6 +17,7 @@
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
+import java.io.Writer;
import java.text.MessageFormat;
import javax.xml.parsers.DocumentBuilder;
@@ -142,7 +143,8 @@
}
}
- private Element createOpenShiftProfileElement(String finalName) throws ParserConfigurationException, SAXException, IOException {
+ private Element createOpenShiftProfileElement(String finalName) throws ParserConfigurationException, SAXException,
+ IOException {
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
String openShiftProfile = MessageFormat.format(OPENSHIFT_PROFILE, finalName);
Document document = documentBuilder.parse(new ByteArrayInputStream(openShiftProfile.getBytes()));
@@ -282,6 +284,7 @@
}
public void savePom() throws CoreException {
+ Writer writer = null;
try {
TransformerFactory transformerFactory = TransformerFactory.newInstance();
transformerFactory.setAttribute("indent-number", new Integer(4));
@@ -291,9 +294,8 @@
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- Result out =
- new StreamResult(
- new OutputStreamWriter(new FileOutputStream(pomFile.getLocation().toString()), "UTF-8"));
+ writer = new OutputStreamWriter(new FileOutputStream(pomFile.getLocation().toString()), "UTF-8");
+ Result out = new StreamResult(writer);
transformer.transform(new DOMSource(getDocument()), out);
} catch (TransformerConfigurationException e) {
throw new CoreException(createStatus(e));
@@ -303,8 +305,22 @@
throw new CoreException(createStatus(e));
} catch (FileNotFoundException e) {
throw new CoreException(createStatus(e));
+ } finally {
+ safeClose(writer);
}
}
+
+ private void safeClose(Writer writer) {
+ if (writer == null) {
+ return;
+ }
+ try {
+ writer.flush();
+ writer.close();
+ } catch (IOException e) {
+ // ignore;
+ }
+ }
public static boolean isMavenProject(IProject project) {
return project.getFile(POM_FILENAME).exists();
12 years, 12 months
JBoss Tools SVN: r37895 - trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 09:34:38 -0500 (Tue, 17 Jan 2012)
New Revision: 37895
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java
Log:
[JBIDE-10479] added test that asserts pom content
Modified: trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java 2012-01-17 14:29:41 UTC (rev 37894)
+++ trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java 2012-01-17 14:34:38 UTC (rev 37895)
@@ -88,7 +88,7 @@
+ " </profiles>\n"
+ "</project>\n";
- private static final String POM_COMPLEX_WITHOUT_OPENSHIFT =
+ private static final String POM_WITH_PROFILES_WITHOUT_OPENSHIFT =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
+" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n"
@@ -281,7 +281,7 @@
private IProject nonOpenShiftProject;
private IFile pomWithoutOpenShiftProfile;
- private IProject complexNonOpenShiftProject;
+ private IProject nonOpenShiftProfilesProject;
private IProject openShiftProject;
private IFile pomWithOpenShiftProfile;
@@ -307,7 +307,7 @@
@Test
public void canDetectOpenShiftProfileInComplexPom() throws CoreException {
- OpenShiftMavenProfile profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
+ OpenShiftMavenProfile profile = new OpenShiftMavenProfile(nonOpenShiftProfilesProject, PLUGIN_ID);
assertFalse(profile.existsInPom());
}
@@ -329,21 +329,21 @@
@Test
public void canAddOpenShiftProfileToComplexPom() throws CoreException, IOException {
- OpenShiftMavenProfile profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
- boolean added = profile.addToPom(complexNonOpenShiftProject.getName());
+ OpenShiftMavenProfile profile = new OpenShiftMavenProfile(nonOpenShiftProfilesProject, PLUGIN_ID);
+ boolean added = profile.addToPom(nonOpenShiftProfilesProject.getName());
assertTrue(added);
profile.savePom();
- profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
+ profile = new OpenShiftMavenProfile(nonOpenShiftProfilesProject, PLUGIN_ID);
assertTrue(profile.existsInPom());
}
@Test
public void addedOpenShiftProfileIsCorrect() throws CoreException, IOException {
- OpenShiftMavenProfile profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
- boolean added = profile.addToPom(complexNonOpenShiftProject.getName());
+ OpenShiftMavenProfile profile = new OpenShiftMavenProfile(nonOpenShiftProfilesProject, PLUGIN_ID);
+ boolean added = profile.addToPom(nonOpenShiftProfilesProject.getName());
assertTrue(added);
profile.savePom();
- String pomContent = toString(complexNonOpenShiftProject.getFile(POM_FILENAME));
+ String pomContent = toString(nonOpenShiftProfilesProject.getFile(POM_FILENAME));
assertTrue(pomContent.indexOf("<id>openshift</id>") >= 0);
}
@@ -358,8 +358,8 @@
public void setUp() throws CoreException {
this.openShiftProject = createTmpProject();
this.pomWithOpenShiftProfile = createPomFile(POM_WITH_OPENSHIFT, openShiftProject);
- this.complexNonOpenShiftProject = createTmpProject();
- createPomFile(POM_COMPLEX_WITHOUT_OPENSHIFT, complexNonOpenShiftProject);
+ this.nonOpenShiftProfilesProject = createTmpProject();
+ createPomFile(POM_WITH_PROFILES_WITHOUT_OPENSHIFT, nonOpenShiftProfilesProject);
this.nonOpenShiftProject = createTmpProject();
this.pomWithoutOpenShiftProfile = createPomFile(POM_WITHOUT_OPENSHIFT, nonOpenShiftProject);
}
@@ -368,7 +368,7 @@
public void tearDown() throws CoreException {
deleteProject(openShiftProject);
deleteProject(nonOpenShiftProject);
- deleteProject(complexNonOpenShiftProject);
+ deleteProject(nonOpenShiftProfilesProject);
}
private void deleteProject(final IProject project) throws CoreException {
12 years, 12 months
JBoss Tools SVN: r37894 - trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-01-17 09:29:41 -0500 (Tue, 17 Jan 2012)
New Revision: 37894
Modified:
trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java
Log:
[JBIDE-10479] added test that asserts pom content
Modified: trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java 2012-01-17 13:35:33 UTC (rev 37893)
+++ trunk/openshift/tests/org.jboss.tools.openshift.express.test/src/org/jboss/tools/openshift/express/test/OpenShiftMavenProfileTests.java 2012-01-17 14:29:41 UTC (rev 37894)
@@ -13,7 +13,10 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@@ -54,7 +57,7 @@
+ "<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environm... -->\n"
+ "<id>openshift</id>\n"
+ "<build>\n"
- + " <finalName>as22</finalName>\n"
+ + " <finalName>{0}</finalName>\n"
+ " <plugins>\n"
+ " <plugin>\n"
+ " <artifactId>maven-war-plugin</artifactId>\n"
@@ -325,7 +328,7 @@
}
@Test
- public void canAddOpenShiftProfileToComplexPom() throws CoreException {
+ public void canAddOpenShiftProfileToComplexPom() throws CoreException, IOException {
OpenShiftMavenProfile profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
boolean added = profile.addToPom(complexNonOpenShiftProject.getName());
assertTrue(added);
@@ -335,6 +338,16 @@
}
@Test
+ public void addedOpenShiftProfileIsCorrect() throws CoreException, IOException {
+ OpenShiftMavenProfile profile = new OpenShiftMavenProfile(complexNonOpenShiftProject, PLUGIN_ID);
+ boolean added = profile.addToPom(complexNonOpenShiftProject.getName());
+ assertTrue(added);
+ profile.savePom();
+ String pomContent = toString(complexNonOpenShiftProject.getFile(POM_FILENAME));
+ assertTrue(pomContent.indexOf("<id>openshift</id>") >= 0);
+ }
+
+ @Test
public void doesNotAddOpenShiftProfileIfAlreadyPresent() throws CoreException {
OpenShiftMavenProfile profile = new OpenShiftMavenProfile(pomWithOpenShiftProfile, PLUGIN_ID);
boolean added = profile.addToPom(openShiftProject.getName());
@@ -404,4 +417,13 @@
project.getWorkspace().run(runnable, new NullProgressMonitor());
return project;
}
+
+ private String toString(IFile file) throws CoreException, IOException {
+ StringBuilder builder = new StringBuilder();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(file.getContents()));
+ for(String line = null; (line = reader.readLine()) != null; ) {
+ builder.append(line);
+ }
+ return builder.toString();
+ }
}
12 years, 12 months