JBoss Tools SVN: r43808 - trunk/build/component.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-09-18 17:33:20 -0400 (Tue, 18 Sep 2012)
New Revision: 43808
Removed:
trunk/build/component/.classpath
trunk/build/component/.project
trunk/build/component/README.txt
trunk/build/component/all.xml
trunk/build/component/drools.xml
trunk/build/component/drools.xml.README.txt
Log:
remove deprecated build/component/ folder
Deleted: trunk/build/component/.classpath
===================================================================
--- trunk/build/component/.classpath 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/.classpath 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
Deleted: trunk/build/component/.project
===================================================================
--- trunk/build/component/.project 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/.project 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>component</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
Deleted: trunk/build/component/README.txt
===================================================================
--- trunk/build/component/README.txt 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/README.txt 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,11 +0,0 @@
-The poms in this folder are deprecated. See ../../build/pom.xml and use -P${component.name} or -P${component.name}-bootstrap instead.
-
-For example:
-
- mvn3 clean install -f build/pom.xml -Pjmx-bootstrap
-
-See also:
-
- https://www.jboss.org/tools/docs/building (redirects to http://community.jboss.org/wiki/HowtoBuildJBossToolswithMaven3)
- https://www.jboss.org/tools/docs/testing
-
Deleted: trunk/build/component/all.xml
===================================================================
--- trunk/build/component/all.xml 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/all.xml 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,71 +0,0 @@
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss</groupId>
- <artifactId>jbosstools</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modules>
- <module>../parent</module>
- <module>../libs</module>
-
- <!-- this order is important! make sure you've run genpom.xml first! -->
- <!-- dgolovin's order -->
- <module>../../tests</module>
- <module>../../freemarker</module>
- <module>../../jmx</module>
- <module>../../archives</module>
- <module>../../as</module>
- <module>../../common</module>
- <module>../../jst</module>
- <!-- Built as external Hudson job, http://hudson.qa.jboss.com/hudson/view/DevStudio_Tycho/job/xulrunner-1.9.2/,
- so not needed here <module>xulrunner</module> -->
- <module>../../vpe</module>
- <module>../../jsf</module>
-
- <module>../../hibernatetools</module>
- <module>../../portlet</module>
- <module>../../workingset</module>
-
- <module>../../struts</module>
-
- <module>../../profiler</module>
- <module>../../smooks</module>
- <module>../../cdi</module>
- <module>../../birt</module>
- <module>../../bpel</module>
- <module>../../esb</module>
- <module>../../seam</module>
- <module>../../examples</module>
- <module>../../maven</module>
- <module>../../ws</module>
- <module>../../modeshape</module>
- <module>../../flow</module>
- <module>../../jbpm</module>
- <module>../../gwt</module>
- <module>../../deltacloud</module>
- <!-- NOTE: To build drools, must first bootstrap with ant script: cd drools;
- ant -q -->
- <!-- IF YOU REMOVE A MODULE, be sure to also remove it from site/site.xml
- and build/aggregate/site/site.xml or the build will break! -->
- <!-- module>drools</module -->
- <module>../../runtime</module>
- <module>../../usage</module>
- <module>../../site</module>
- </modules>
- <profiles>
- <profile>
- <id>emma-coverage</id>
- <activation>
- <property>
- <name>coverage</name>
- </property>
- </activation>
- <modules>
- <module>build/reports/emma-coverage</module>
- </modules>
- </profile>
- </profiles>
-</project>
-
Deleted: trunk/build/component/drools.xml
===================================================================
--- trunk/build/component/drools.xml 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/drools.xml 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,18 +0,0 @@
-<project
-xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.build.component</groupId>
- <artifactId>common</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modules>
- <module>../parent</module>
- <module>../libs</module>
-
- <module>../../tests</module>
- <module>../../common</module>
- <module>../../jst</module>
- <module>../../flow</module>
- <module>../../drools</module>
- </modules>
-</project>
Deleted: trunk/build/component/drools.xml.README.txt
===================================================================
--- trunk/build/component/drools.xml.README.txt 2012-09-18 21:26:37 UTC (rev 43807)
+++ trunk/build/component/drools.xml.README.txt 2012-09-18 21:33:20 UTC (rev 43808)
@@ -1,9 +0,0 @@
-To build drools, you first need to run the build.xml script:
-
-$ cd ../../drools; ant
-
-Then run maven:
-
-$ cd ../build/component; mvn clean install -f drools.xml
-
-
13 years, 6 months
JBoss Tools SVN: r43807 - trunk.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-09-18 17:26:37 -0400 (Tue, 18 Sep 2012)
New Revision: 43807
Removed:
trunk/deltacloud/
Log:
remove deltacloud from svn trunk - available from 4.0.0.Alpha1 branch or 3.3.x branch (JBIDE-12458)
13 years, 6 months
JBoss Tools SVN: r43806 - in trunk/runtime-soa: plugins/org.jboss.tools.runtime.esb.detector/META-INF and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2012-09-18 17:25:01 -0400 (Tue, 18 Sep 2012)
New Revision: 43806
Modified:
trunk/runtime-soa/plugins/org.jboss.tools.runtime.drools.detector/META-INF/MANIFEST.MF
trunk/runtime-soa/plugins/org.jboss.tools.runtime.esb.detector/META-INF/MANIFEST.MF
trunk/runtime-soa/plugins/org.jboss.tools.runtime.jbpm.detector/META-INF/MANIFEST.MF
trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/META-INF/MANIFEST.MF
Log:
bump versions to 1.4.0
Modified: trunk/runtime-soa/plugins/org.jboss.tools.runtime.drools.detector/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime-soa/plugins/org.jboss.tools.runtime.drools.detector/META-INF/MANIFEST.MF 2012-09-18 18:59:51 UTC (rev 43805)
+++ trunk/runtime-soa/plugins/org.jboss.tools.runtime.drools.detector/META-INF/MANIFEST.MF 2012-09-18 21:25:01 UTC (rev 43806)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.runtime.drools.detector;singleton:=true
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.4.0.qualifier
Bundle-Activator: org.jboss.tools.runtime.drools.detector.RuntimeDroolsActivator
Require-Bundle: org.eclipse.ui;bundle-version="[3.7.0,4.3.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.3.0)",
Modified: trunk/runtime-soa/plugins/org.jboss.tools.runtime.esb.detector/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime-soa/plugins/org.jboss.tools.runtime.esb.detector/META-INF/MANIFEST.MF 2012-09-18 18:59:51 UTC (rev 43805)
+++ trunk/runtime-soa/plugins/org.jboss.tools.runtime.esb.detector/META-INF/MANIFEST.MF 2012-09-18 21:25:01 UTC (rev 43806)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.runtime.esb.detector;singleton:=true
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.4.0.qualifier
Bundle-Activator: org.jboss.tools.runtime.esb.detector.RuntimeEsbActivator
Require-Bundle: org.eclipse.ui;bundle-version="[3.7.0,4.3.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.3.0)",
Modified: trunk/runtime-soa/plugins/org.jboss.tools.runtime.jbpm.detector/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime-soa/plugins/org.jboss.tools.runtime.jbpm.detector/META-INF/MANIFEST.MF 2012-09-18 18:59:51 UTC (rev 43805)
+++ trunk/runtime-soa/plugins/org.jboss.tools.runtime.jbpm.detector/META-INF/MANIFEST.MF 2012-09-18 21:25:01 UTC (rev 43806)
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.jboss.tools.runtime.jbpm.detector;singleton:=true
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.4.0.qualifier
Bundle-Activator: org.jboss.tools.runtime.jbpm.detector.RuntimeJbpmActivator
Require-Bundle: org.eclipse.ui;bundle-version="[3.7.0,4.3.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.3.0)",
Modified: trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/META-INF/MANIFEST.MF 2012-09-18 18:59:51 UTC (rev 43805)
+++ trunk/runtime-soa/tests/org.jboss.tools.runtime.soa.test/META-INF/MANIFEST.MF 2012-09-18 21:25:01 UTC (rev 43806)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %BundleName
Bundle-SymbolicName: org.jboss.tools.runtime.soa.test;singleton:=true
-Bundle-Version: 1.3.0.qualifier
+Bundle-Version: 1.4.0.qualifier
Require-Bundle: org.eclipse.core.runtime,
org.junit;bundle-version="4.8.0",
org.jboss.tools.runtime.ui,
13 years, 6 months
JBoss Tools SVN: r43805 - trunk/esb.
by jbosstools-commits@lists.jboss.org
Author: ldimaggio
Date: 2012-09-18 14:59:51 -0400 (Tue, 18 Sep 2012)
New Revision: 43805
Modified:
trunk/esb/pom.xml
Log:
Updated ESB pom.xml to reference Alpha2:
Modified: trunk/esb/pom.xml
===================================================================
--- trunk/esb/pom.xml 2012-09-18 18:43:04 UTC (rev 43804)
+++ trunk/esb/pom.xml 2012-09-18 18:59:51 UTC (rev 43805)
@@ -5,7 +5,7 @@
<parent>
<groupId>org.jboss.tools</groupId>
<artifactId>parent</artifactId>
- <version>4.0.0.Alpha1-SNAPSHOT</version>
+ <version>4.0.0.Alpha2-SNAPSHOT</version>
<relativePath>../build/parent/pom.xml</relativePath>
</parent>
<groupId>org.jboss.tools</groupId>
@@ -30,5 +30,19 @@
<module>tests</module>
<module>site</module>
</modules>
+
+ <repositories>
+ <!-- To resolve parent artifact -->
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ </repository>
+ <repository>
+ <id>jboss-snapshots-repository</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
+ </repository>
+ </repositories>
</project>
13 years, 6 months
JBoss Tools SVN: r43804 - trunk/common/plugins/org.jboss.tools.common.validation.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2012-09-18 14:43:04 -0400 (Tue, 18 Sep 2012)
New Revision: 43804
Modified:
trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml
Log:
https://issues.jboss.org/browse/JBIDE-12634 Project>Validate doesn't trigger a full project validation by JBT Project validator
Modified: trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml 2012-09-18 17:15:33 UTC (rev 43803)
+++ trunk/common/plugins/org.jboss.tools.common.validation/plugin.xml 2012-09-18 18:43:04 UTC (rev 43804)
@@ -11,7 +11,8 @@
id="cd"
name="JBoss Tools Project Validator">
<validator>
- <runStrategy project="true"/>
+ <runStrategy project="false">
+ </runStrategy>
<projectNature id="org.eclipse.jdt.core.javanature" />
<filter
objectClass="org.eclipse.core.resources.IFile"
13 years, 6 months
JBoss Tools SVN: r43803 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-09-18 13:15:33 -0400 (Tue, 18 Sep 2012)
New Revision: 43803
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
Log:
[JBIDE-11912] implementing "Add new SSH key"
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java 2012-09-18 16:59:25 UTC (rev 43802)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java 2012-09-18 17:15:33 UTC (rev 43803)
@@ -16,8 +16,11 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.databinding.viewers.ViewerProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -38,6 +41,8 @@
import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage;
+import com.openshift.client.SSHKeyType;
+
/**
* @author André Dietisheim
*/
@@ -80,6 +85,24 @@
ControlDecorationSupport.create(
nameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
+ Label typeLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ typeLabel.setText("Key Type:");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(typeLabel);
+
+ ComboViewer typeCombo = new ComboViewer(newSSHKeyGroup, SWT.DEFAULT);
+ typeCombo.setContentProvider(ArrayContentProvider.getInstance());
+ typeCombo.setInput(SSHKeyType.values());
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(typeCombo.getControl());
+ ValueBindingBuilder.bind(
+ ViewerProperties.singleSelection().observe(typeCombo))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_TYPE).observe(typeCombo))
+ .in(dbc);
+ Label fillerLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(fillerLabel);
+
Label ssh2HomeLabel = new Label(newSSHKeyGroup, SWT.NONE);
GridDataFactory.fillDefaults()
.align(SWT.LEFT, SWT.CENTER).applyTo(ssh2HomeLabel);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java 2012-09-18 16:59:25 UTC (rev 43802)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java 2012-09-18 17:15:33 UTC (rev 43803)
@@ -24,7 +24,7 @@
public static final String PROPERTY_PRIVATEKEY_PATH = "privateKeyPath";
public static final String PROPERTY_PRIVATEKEY_PASSPHRASE = "privateKeyPassphrase";
- private SSHKeyType type;
+ private SSHKeyType type = SSHKeyType.SSH_RSA;
private String ssh2Home;
private String privateKeyPath;
private String privateKeyPathphrase;
13 years, 6 months
JBoss Tools SVN: r43802 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard/ssh and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2012-09-18 12:59:25 -0400 (Tue, 18 Sep 2012)
New Revision: 43802
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/NonEmptyStringValidator.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyJob.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyNameValidator.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyValidator.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java
Log:
[JBIDE-11912] implementing "Add new SSH key"
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/NonEmptyStringValidator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/NonEmptyStringValidator.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/NonEmptyStringValidator.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.databinding;
+
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class NonEmptyStringValidator implements IValidator {
+
+ private String fieldName;
+
+ public NonEmptyStringValidator(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ @Override
+ public IStatus validate(Object value) {
+ String name = (String) value;
+ if (StringUtils.isEmpty(name)) {
+ return ValidationStatus.cancel("You have to provide a " + fieldName);
+ }
+ return ValidationStatus.ok();
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/databinding/NonEmptyStringValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyJob.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyJob.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyJob.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.osgi.util.NLS;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class AddSSHKeyJob extends Job {
+
+ private AddSSHKeyWizardPageModel model;
+
+ public AddSSHKeyJob(AddSSHKeyWizardPageModel model) {
+ super("Adding SSH key " + model.getName() + "...");
+ this.model = model;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ model.addConfiguredSSHKey();
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ NLS.bind("Could not add SSH key {0} to OpenShift", model.getName()), e);
+ }
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyJob.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java 2012-09-18 15:25:00 UTC (rev 43801)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2012 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java 2012-09-18 15:25:00 UTC (rev 43801)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -10,26 +10,17 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.ValidationStatusProvider;
import org.eclipse.core.databinding.beans.BeanProperties;
import org.eclipse.core.databinding.observable.value.IObservableValue;
-import org.eclipse.core.databinding.validation.MultiValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -44,15 +35,10 @@
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.databinding.AlphanumericStringValidator;
import org.jboss.tools.openshift.express.internal.ui.databinding.RequiredControlDecorationUpdater;
import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
-import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage;
-import com.openshift.client.OpenShiftException;
-import com.openshift.client.SSHPublicKey;
-
/**
* @author André Dietisheim
*/
@@ -88,42 +74,27 @@
.align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(nameText);
Binding nameBinding = ValueBindingBuilder
.bind(WidgetProperties.text(SWT.Modify).observe(nameText))
- .validatingAfterConvert(new AlphanumericStringValidator("key name") {
-
- @Override
- public IStatus validate(Object value) {
- IStatus validationStatus = super.validate(value);
- if (!validationStatus.isOK()) {
- return validationStatus;
- }
- String keyName = (String) value;
- if (pageModel.hasKeyName(keyName)) {
- return ValidationStatus.error("There's already a key with the name " + keyName);
- }
- return ValidationStatus.ok();
- }
-
- })
+ .validatingAfterConvert(new SSHPublicKeyNameValidator(pageModel))
.to(BeanProperties.value(AddSSHKeyWizardPageModel.PROPERTY_NAME).observe(pageModel))
.notUpdatingParticipant()
.in(dbc);
ControlDecorationSupport.create(
nameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
- Label fileLabel = new Label(addSSHKeyGroup, SWT.NONE);
+ Label publicKeyLabel = new Label(addSSHKeyGroup, SWT.NONE);
GridDataFactory.fillDefaults()
- .align(SWT.LEFT, SWT.CENTER).applyTo(fileLabel);
- fileLabel.setText("SSH Key:");
+ .align(SWT.LEFT, SWT.CENTER).applyTo(publicKeyLabel);
+ publicKeyLabel.setText("Public Key:");
- Text fileText = new Text(addSSHKeyGroup, SWT.BORDER);
- fileText.setEditable(false);
+ Text publicKeyText = new Text(addSSHKeyGroup, SWT.BORDER);
+ publicKeyText.setEditable(false);
GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fileText);
- IObservableValue filePathObservable =
- WidgetProperties.text(SWT.Modify).observe(fileText);
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(publicKeyText);
+ IObservableValue publicKeyObservable =
+ WidgetProperties.text(SWT.Modify).observe(publicKeyText);
ValueBindingBuilder
- .bind(filePathObservable)
- .to(BeanProperties.value(AddSSHKeyWizardPageModel.PROPERTY_FILEPATH).observe(pageModel))
+ .bind(publicKeyObservable)
+ .to(BeanProperties.value(AddSSHKeyWizardPageModel.PROPERTY_PUBLICKEY_PATH).observe(pageModel))
.in(dbc);
Button browseButton = new Button(addSSHKeyGroup, SWT.PUSH);
@@ -132,7 +103,7 @@
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.CENTER).applyTo(browseButton);
- ValidationStatusProvider sshPublicKeyValidator = new SSHPublicKeyValidator(filePathObservable);
+ ValidationStatusProvider sshPublicKeyValidator = new SSHPublicKeyValidator(publicKeyObservable, pageModel);
dbc.addValidationStatusProvider(sshPublicKeyValidator);
ControlDecorationSupport.create(
sshPublicKeyValidator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
@@ -147,7 +118,7 @@
dialog.setFilterPath(SSHUtils.getSSH2Home());
String filePath = null;
if ((filePath = dialog.open()) != null) {
- pageModel.setFilePath(filePath);
+ pageModel.setPublicKeyPath(filePath);
}
}
};
@@ -155,60 +126,9 @@
public IStatus addConfiguredSSHKey() {
try {
- return WizardUtils.runInWizard(new AddSSHKeyJob(), getContainer());
+ return WizardUtils.runInWizard(new AddSSHKeyJob(pageModel), getContainer());
} catch (Exception e) {
return OpenShiftUIActivator.createErrorStatus("Could not add ssh key " + pageModel.getName() + ".");
}
}
-
- private class AddSSHKeyJob extends Job {
-
- public AddSSHKeyJob() {
- super("Adding SSH key " + pageModel.getName() + "...");
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- pageModel.addConfiguredSSHKey();
- return Status.OK_STATUS;
- } catch (Exception e) {
- return OpenShiftUIActivator.createErrorStatus(
- NLS.bind("Could not add SSH key {0} to OpenShift", pageModel.getName()), e);
- }
- }
- }
-
- public class SSHPublicKeyValidator extends MultiValidator {
-
- private IObservableValue filePathObservable;
-
- public SSHPublicKeyValidator(IObservableValue filePathObservable) {
- this.filePathObservable = filePathObservable;
- }
-
- @Override
- protected IStatus validate() {
- String filePath = (String) filePathObservable.getValue();
- if (StringUtils.isEmpty(filePath)) {
- return ValidationStatus.cancel("You have to supply a public SSH key.");
- }
- try {
- SSHPublicKey sshPublicKey = new SSHPublicKey(filePath);
- if (pageModel.hasPublicKey(sshPublicKey.getPublicKey())) {
- return ValidationStatus.error("The public key in " + filePath + " is already in use on OpenShift. Choose another key.");
- }
- } catch (FileNotFoundException e) {
- return ValidationStatus.error("Could not load file: " + e.getMessage());
- } catch (OpenShiftException e) {
- return ValidationStatus.error(filePath + "is not a valid public SSH key: " + e.getMessage());
- } catch (IOException e) {
- return ValidationStatus.error("Could not load file: " + e.getMessage());
- }
-
- return Status.OK_STATUS;
- }
-
- }
-
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-18 15:25:00 UTC (rev 43801)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2012 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -25,7 +25,7 @@
*/
public class AddSSHKeyWizardPageModel extends ObservableUIPojo {
- public static final String PROPERTY_FILEPATH = "filePath";
+ public static final String PROPERTY_PUBLICKEY_PATH = "publicKeyPath";
public static final String PROPERTY_NAME = "name";
private String name;
@@ -36,10 +36,14 @@
this.user = user;
}
- public String getFilePath() {
+ public String getPublicKeyPath() {
return filePath;
}
+ public void setPublicKeyPath(String filePath) {
+ firePropertyChange(PROPERTY_PUBLICKEY_PATH, this.filePath, this.filePath = filePath);
+ }
+
public String getName() {
return name;
}
@@ -48,10 +52,6 @@
firePropertyChange(PROPERTY_NAME, this.name, this.name = name);
}
- public void setFilePath(String filePath) {
- firePropertyChange(PROPERTY_FILEPATH, this.filePath, this.filePath = filePath);
- }
-
public boolean hasKeyName(String name) {
return user.hasSSHKeyName(name);
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizard.java 2012-09-18 15:25:00 UTC (rev 43801)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizard.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
+ * Copyright (c) 2012 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java 2012-09-18 15:25:00 UTC (rev 43801)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.databinding.viewers.ViewerProperties;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -80,17 +81,18 @@
.to(BeanProperties.value(ManageSSHKeysWizardPageModel.PROPERTY_SELECTED_KEY).observe(pageModel))
.in(dbc);
- Button addButton = new Button(sshKeysGroup, SWT.PUSH);
+ Button addExistingButton = new Button(sshKeysGroup, SWT.PUSH);
GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).applyTo(addButton);
- addButton.setText("Add Existing...");
- addButton.addSelectionListener(onAdd());
+ .align(SWT.FILL, SWT.FILL).applyTo(addExistingButton);
+ addExistingButton.setText("Add Existing...");
+ addExistingButton.addSelectionListener(onAddExisting());
- Button newButton = new Button(sshKeysGroup, SWT.PUSH);
+ Button addNewButton = new Button(sshKeysGroup, SWT.PUSH);
GridDataFactory.fillDefaults()
- .align(SWT.FILL, SWT.FILL).applyTo(newButton);
- newButton.setText("New...");
-
+ .align(SWT.FILL, SWT.FILL).applyTo(addNewButton);
+ addNewButton.setText("New...");
+ addNewButton.addSelectionListener(onAddNew());
+
Button removeButton = new Button(sshKeysGroup, SWT.PUSH);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.FILL).applyTo(removeButton);
@@ -134,12 +136,16 @@
};
}
- private SelectionListener onAdd() {
+ private SelectionListener onAddExisting() {
return new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- WizardUtils.openWizardDialog(new AddSSHKeyWizard(pageModel.getUser()), getShell());
+ if (WizardUtils.openWizardDialog(new AddSSHKeyWizard(pageModel.getUser()), getShell())
+ == Dialog.CANCEL) {
+ return;
+ }
+
try {
WizardUtils.runInWizard(
new RefreshViewerJob(),
@@ -152,6 +158,28 @@
};
}
+ private SelectionListener onAddNew() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if(WizardUtils.openWizardDialog(new NewSSHKeyWizard(pageModel.getUser()), getShell())
+ == Dialog.CANCEL) {
+ return;
+ }
+
+ try {
+ WizardUtils.runInWizard(
+ new RefreshViewerJob(),
+ getContainer());
+ } catch (Exception ex) {
+ StatusManager.getManager().handle(
+ OpenShiftUIActivator.createErrorStatus("Could not refresh keys.", ex), StatusManager.LOG);
+ }
+ }
+ };
+ }
+
protected TableViewer createTable(Composite tableContainer) {
Table table =
new Table(tableContainer, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizard.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizard.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.Wizard;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewSSHKeyWizard extends Wizard {
+
+ private UserDelegate user;
+ private NewSSHKeyWizardPage newSSHKeyWizardPage;
+
+ public NewSSHKeyWizard(UserDelegate user) {
+ this.user = user;
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean performFinish() {
+ IStatus status = newSSHKeyWizardPage.addConfiguredSSHKey();
+ return status.isOK();
+ }
+
+ @Override
+ public void addPages() {
+ addPage(this.newSSHKeyWizardPage = new NewSSHKeyWizardPage(user, this));
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizard.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
+import org.eclipse.jface.databinding.swt.WidgetProperties;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.databinding.NonEmptyStringValidator;
+import org.jboss.tools.openshift.express.internal.ui.databinding.RequiredControlDecorationUpdater;
+import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
+import org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewSSHKeyWizardPage extends AbstractOpenShiftWizardPage {
+
+ private NewSSHKeyWizardPageModel pageModel;
+
+ public NewSSHKeyWizardPage(UserDelegate user, IWizard wizard) {
+ super("Add new SSH key", "Add a new SSH key to your OpenShift account",
+ "NewSSHKeysPage", wizard);
+ this.pageModel = new NewSSHKeyWizardPageModel(user);
+ }
+
+ @Override
+ protected void doCreateControls(Composite parent, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults()
+ .margins(10, 10).applyTo(parent);
+
+ Group newSSHKeyGroup = new Group(parent, SWT.NONE);
+ newSSHKeyGroup.setText("New SSH Key");
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(newSSHKeyGroup);
+ GridLayoutFactory.fillDefaults()
+ .numColumns(3).margins(6, 6).applyTo(newSSHKeyGroup);
+
+ Label nameLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ nameLabel.setText("Name:");
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(nameLabel);
+
+ Text nameText = new Text(newSSHKeyGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(nameText);
+ Binding nameBinding = ValueBindingBuilder
+ .bind(WidgetProperties.text(SWT.Modify).observe(nameText))
+ .validatingAfterConvert(new SSHPublicKeyNameValidator(pageModel))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_NAME).observe(pageModel))
+ .notUpdatingParticipant()
+ .in(dbc);
+ ControlDecorationSupport.create(
+ nameBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
+
+ Label ssh2HomeLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(ssh2HomeLabel);
+ ssh2HomeLabel.setText("SSH2 Home:");
+
+ Text ssh2HomeText = new Text(newSSHKeyGroup, SWT.BORDER);
+ ssh2HomeText.setEditable(false);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(ssh2HomeText);
+ Binding ssh2HomeBinding = ValueBindingBuilder
+ .bind(WidgetProperties.text(SWT.Modify).observe(ssh2HomeText))
+ .validatingAfterConvert(new NonEmptyStringValidator("ssh2 home directory"))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_SSH2_HOME).observe(pageModel))
+ .in(dbc);
+ ControlDecorationSupport.create(
+ ssh2HomeBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
+
+ Button ss2HomeBrowseButton = new Button(newSSHKeyGroup, SWT.PUSH);
+ ss2HomeBrowseButton.setText("Browse...");
+ ss2HomeBrowseButton.addSelectionListener(onBrowse());
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).applyTo(ss2HomeBrowseButton);
+
+ Label privateKeyLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(privateKeyLabel);
+ privateKeyLabel.setText("Private Key:");
+
+ Text privateKeyText = new Text(newSSHKeyGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(privateKeyText);
+ Binding privateKeyBinding = ValueBindingBuilder
+ .bind(WidgetProperties.text(SWT.Modify).observe(privateKeyText))
+ .validatingAfterConvert(new NonEmptyStringValidator("private key file name"))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_PRIVATEKEY_PATH).observe(pageModel))
+ .in(dbc);
+ ControlDecorationSupport.create(
+ privateKeyBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
+
+ Label passphraseLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(passphraseLabel);
+ passphraseLabel.setText("Private Key Passphrase:");
+
+ Text passphraseText = new Text(newSSHKeyGroup, SWT.BORDER | SWT.PASSWORD);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(passphraseText);
+ ValueBindingBuilder
+ .bind(WidgetProperties.text(SWT.Modify).observe(passphraseText))
+ .validatingAfterConvert(new NonEmptyStringValidator("pass phrase"))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_PRIVATEKEY_PASSPHRASE).observe(pageModel))
+ .in(dbc);
+
+ Label publicKeyLabel = new Label(newSSHKeyGroup, SWT.NONE);
+ GridDataFactory.fillDefaults()
+ .align(SWT.LEFT, SWT.CENTER).applyTo(publicKeyLabel);
+ publicKeyLabel.setText("Public Key:");
+
+ Text publicKeyText = new Text(newSSHKeyGroup, SWT.BORDER);
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(publicKeyText);
+ Binding publicKeyBinding = ValueBindingBuilder
+ .bind(WidgetProperties.text(SWT.Modify).observe(publicKeyText))
+ .validatingAfterConvert(new NonEmptyStringValidator("public key file name"))
+ .to(BeanProperties.value(NewSSHKeyWizardPageModel.PROPERTY_PUBLICKEY_PATH).observe(pageModel))
+ .in(dbc);
+ ControlDecorationSupport.create(
+ publicKeyBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
+ }
+
+ private SelectionListener onBrowse() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.OPEN);
+ dialog.setFilterPath(SSHUtils.getSSH2Home());
+ String filePath = null;
+ if ((filePath = dialog.open()) != null) {
+ pageModel.setPublicKeyPath(filePath);
+ }
+ }
+ };
+ }
+
+ public IStatus addConfiguredSSHKey() {
+ try {
+ return WizardUtils.runInWizard(new AddSSHKeyJob(pageModel), getContainer());
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus("Could not add ssh key " + pageModel.getName() + ".");
+ }
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+
+import com.openshift.client.SSHKeyType;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class NewSSHKeyWizardPageModel extends AddSSHKeyWizardPageModel {
+
+ public static final String PROPERTY_TYPE = "type";
+ public static final String PROPERTY_SSH2_HOME = "SSH22Home";
+ public static final String PROPERTY_PRIVATEKEY_PATH = "privateKeyPath";
+ public static final String PROPERTY_PRIVATEKEY_PASSPHRASE = "privateKeyPassphrase";
+
+ private SSHKeyType type;
+ private String ssh2Home;
+ private String privateKeyPath;
+ private String privateKeyPathphrase;
+
+ public NewSSHKeyWizardPageModel(UserDelegate user) {
+ super(user);
+ }
+
+ public SSHKeyType getType() {
+ return type;
+ }
+
+ public void setType(SSHKeyType type) {
+ firePropertyChange(PROPERTY_TYPE, this.type, this.type = type);
+ }
+
+ public String getPrivateKeyPathphrase() {
+ return privateKeyPathphrase;
+ }
+
+ public void setPrivateKeyPathphrase(String privateKeyPathphrase) {
+ firePropertyChange(PROPERTY_PRIVATEKEY_PASSPHRASE,
+ this.privateKeyPathphrase, this.privateKeyPathphrase = privateKeyPathphrase);
+ }
+
+ public String getPrivateKeyPath() {
+ return privateKeyPath;
+ }
+
+ public void setPrivateKeyPath(String privateKeyPath) {
+ firePropertyChange(PROPERTY_PRIVATEKEY_PATH, this.privateKeyPath, this.privateKeyPath = privateKeyPath);
+ }
+
+ public String getSSH2Home() {
+ return ssh2Home;
+ }
+
+ public void setSSH2Home(String ssh2Home) {
+ firePropertyChange(PROPERTY_SSH2_HOME, this.ssh2Home, this.ssh2Home = ssh2Home);
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/NewSSHKeyWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyNameValidator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyNameValidator.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyNameValidator.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,29 @@
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.jboss.tools.openshift.express.internal.ui.databinding.AlphanumericStringValidator;
+
+public class SSHPublicKeyNameValidator extends AlphanumericStringValidator {
+
+ private AddSSHKeyWizardPageModel model;
+
+ public SSHPublicKeyNameValidator(AddSSHKeyWizardPageModel model) {
+ super("key name");
+ this.model = model;
+ }
+
+ @Override
+ public IStatus validate(Object value) {
+ IStatus validationStatus = super.validate(value);
+ if (!validationStatus.isOK()) {
+ return validationStatus;
+ }
+ String keyName = (String) value;
+ if (model.hasKeyName(keyName)) {
+ return ValidationStatus.error("There's already a key with the name " + keyName);
+ }
+ return ValidationStatus.ok();
+
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyNameValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyValidator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyValidator.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyValidator.java 2012-09-18 16:59:25 UTC (rev 43802)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.validation.MultiValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
+
+import com.openshift.client.OpenShiftException;
+import com.openshift.client.SSHPublicKey;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class SSHPublicKeyValidator extends MultiValidator {
+
+ private IObservableValue filePathObservable;
+ private AddSSHKeyWizardPageModel model;
+
+ public SSHPublicKeyValidator(IObservableValue filePathObservable, AddSSHKeyWizardPageModel model) {
+ this.filePathObservable = filePathObservable;
+ this.model = model;
+ }
+
+ @Override
+ protected IStatus validate() {
+ String filePath = (String) filePathObservable.getValue();
+ if (StringUtils.isEmpty(filePath)) {
+ return ValidationStatus.cancel("You have to supply a public SSH key.");
+ }
+ try {
+ SSHPublicKey sshPublicKey = new SSHPublicKey(filePath);
+ if (model.hasPublicKey(sshPublicKey.getPublicKey())) {
+ return ValidationStatus.error("The public key in " + filePath + " is already in use on OpenShift. Choose another key.");
+ }
+ } catch (FileNotFoundException e) {
+ return ValidationStatus.error("Could not load file: " + e.getMessage());
+ } catch (OpenShiftException e) {
+ return ValidationStatus.error(filePath + "is not a valid public SSH key: " + e.getMessage());
+ } catch (IOException e) {
+ return ValidationStatus.error("Could not load file: " + e.getMessage());
+ }
+
+ return Status.OK_STATUS;
+ }
+
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/SSHPublicKeyValidator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 6 months
JBoss Tools SVN: r43801 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test: src/org/jboss/tools/ws/ui/bot/test/webservice/eap and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2012-09-18 11:25:00 -0400 (Tue, 18 Sep 2012)
New Revision: 43801
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/AreaWS.java.ws
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java
Log:
fixing EAP from wsdl test
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/AreaWS.java.ws
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/AreaWS.java.ws 2012-09-18 15:21:45 UTC (rev 43800)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/resources/jbossws/AreaWS.java.ws 2012-09-18 15:25:00 UTC (rev 43801)
@@ -1,6 +1,8 @@
-package org.jboss.ws;
+package org.jboss.ws.impl;
import javax.jws.WebService;
+import org.jboss.ws.AreaService;
+import org.jboss.ws.Dimensions;
@WebService(serviceName = "AreaService",
endpointInterface = "org.jboss.ws.AreaService")
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java 2012-09-18 15:21:45 UTC (rev 43800)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java 2012-09-18 15:25:00 UTC (rev 43801)
@@ -121,7 +121,7 @@
IProject project = ResourcesPlugin.getWorkspace().getRoot()
.getProject(getWsProjectName());
IFile f = project.getFile("src/" + getWsPackage().replace(".", "/")
- + "/AreaServiceImpl.java");
+ + "/impl" + "/AreaServiceImpl.java");
/*
* workaround when package is not typed
*/
@@ -141,7 +141,7 @@
content = resourceHelper.readFile(f);
Assert.assertNotNull(content);
Assert.assertTrue(content
- .contains("<servlet-class>org.jboss.ws.AreaServiceImpl</servlet-class>"));
+ .contains("<servlet-class>org.jboss.ws.impl.AreaServiceImpl</servlet-class>"));
Assert.assertTrue(content
.contains("<url-pattern>/AreaService</url-pattern>"));
deploymentHelper.runProject(getEarProjectName());
13 years, 6 months
JBoss Tools SVN: r43800 - in trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot: ext and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: apodhrad
Date: 2012-09-18 11:21:45 -0400 (Tue, 18 Sep 2012)
New Revision: 43800
Added:
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapePublishDialog.java
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapeServerDialog.java
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeProjectExplorer.java
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeView.java
Modified:
trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/tests/Publishing.java
Log:
JBQA-6489 fix
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapePublishDialog.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapePublishDialog.java (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapePublishDialog.java 2012-09-18 15:21:45 UTC (rev 43800)
@@ -0,0 +1,68 @@
+package org.jboss.tools.modeshape.rest.ui.bot.ext.dialog;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
+
+/**
+ *
+ * This class represents dialog for publishing/unpublishing files to/from the
+ * server.
+ *
+ * @author apodhrad
+ *
+ */
+public class ModeshapePublishDialog extends SWTBotWizard {
+
+ public static final String LABEL_SERVER = "Server:";
+ public static final String LABEL_JCR_REPOSITORY = "JCR Repository:";
+ public static final String LABEL_JCR_WORKSPACE = "JCR Workspace:";
+ public static final String LABEL_PUBLISH_AREA = "Publish Area:";
+
+ public ModeshapePublishDialog(SWTBotShell dialog) {
+ super(dialog.activate().widget);
+ }
+
+ public void setServer(String server) {
+ getComboBox(LABEL_SERVER).setSelection(server);
+ }
+
+ public String getServer() {
+ return getComboBox(LABEL_SERVER).getText();
+ }
+
+ public void setJcrRepository(String repository) {
+ getComboBox(LABEL_JCR_REPOSITORY).setSelection(repository);
+ }
+
+ public String getJcrRepository() {
+ return getComboBox(LABEL_JCR_REPOSITORY).getText();
+ }
+
+ public void setJcrWorkspace(String workspace) {
+ getComboBox(LABEL_JCR_WORKSPACE).setSelection(workspace);
+ }
+
+ public String getJcrWorkspace() {
+ return getComboBox(LABEL_JCR_WORKSPACE).getText();
+ }
+
+ public void setPublishArea(String publishArea) {
+ getComboBox(LABEL_PUBLISH_AREA).setText(publishArea);
+ }
+
+ public String getPublishArea() {
+ return getComboBox(LABEL_PUBLISH_AREA).getText();
+ }
+
+ private SWTBotCombo getComboBox(String label) {
+ return bot().comboBoxWithLabel(label);
+ }
+
+ public List<String> getComboBoxList(String label) {
+ return Arrays.asList(getComboBox(label).items());
+ }
+}
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapeServerDialog.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapeServerDialog.java (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/dialog/ModeshapeServerDialog.java 2012-09-18 15:21:45 UTC (rev 43800)
@@ -0,0 +1,64 @@
+package org.jboss.tools.modeshape.rest.ui.bot.ext.dialog;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
+
+/**
+ *
+ * This class represents dialog for setting the modeshape server.
+ *
+ * @author apodhrad
+ *
+ */
+public class ModeshapeServerDialog extends SWTBotWizard {
+
+ public static final String LABEL_URL = "URL:";
+ public static final String LABEL_USER = "User:";
+ public static final String LABEL_PASSWORD = "Password:";
+
+ public ModeshapeServerDialog(SWTBotShell dialog) {
+ super(dialog.activate().widget);
+ }
+
+ public String getUrl() {
+ return getTextField(LABEL_URL).getText();
+ }
+
+ public void setUrl(String url) {
+ getTextField(LABEL_URL).setText(url);
+ }
+
+ public String getUser() {
+ return getTextField(LABEL_USER).getText();
+ }
+
+ public void setUser(String user) {
+ getTextField(LABEL_USER).setText(user);
+ }
+
+ public String getPassword() {
+ return getTextField(LABEL_PASSWORD).getText();
+ }
+
+ public void setPassword(String password) {
+ getTextField(LABEL_PASSWORD).setText(password);
+ }
+
+ public boolean testServerConnection() {
+ clickButton("Test");
+
+ SWTBotShell shell = bot().shell("Test Server Connection");
+ shell.activate();
+ String message = shell.bot().label(1).getText();
+ shell.bot().button("OK").click();
+
+ activate();
+ return message.equals("Successfully connected using the specified server properties.");
+ }
+
+ private SWTBotText getTextField(String label) {
+ return bot().textWithLabel(label);
+ }
+
+}
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeProjectExplorer.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeProjectExplorer.java (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeProjectExplorer.java 2012-09-18 15:21:45 UTC (rev 43800)
@@ -0,0 +1,32 @@
+package org.jboss.tools.modeshape.rest.ui.bot.ext.view;
+
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.view.ProjectExplorer;
+
+/**
+ *
+ * This class represents an extension of Project Explorer. The extension refers
+ * to modeshape context menu.
+ *
+ * @author apodhrad
+ *
+ */
+public class ModeshapeProjectExplorer extends ProjectExplorer {
+
+ public void publish(String file, String... path) {
+ contextMenu(file, "Publish", path);
+ }
+
+ public void unpublish(String file, String... path) {
+ contextMenu(file, "Unpublish", path);
+ }
+
+ public void showPublishedLocations(String file, String... path) {
+ contextMenu(file, "Show Published Locations", path);
+ }
+
+ private void contextMenu(String file, String selection, String... path) {
+ selectTreeItem(file, path);
+ ContextMenuHelper.clickContextMenu(bot().tree(), "ModeShape", selection);
+ }
+}
Added: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeView.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeView.java (rev 0)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/ext/view/ModeshapeView.java 2012-09-18 15:21:45 UTC (rev 43800)
@@ -0,0 +1,72 @@
+package org.jboss.tools.modeshape.rest.ui.bot.ext.view;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.modeshape.rest.ui.bot.ext.dialog.ModeshapeServerDialog;
+import org.jboss.tools.ui.bot.ext.gen.IView;
+import org.jboss.tools.ui.bot.ext.view.ViewBase;
+
+/**
+ *
+ * This class represents the ModeShape view.
+ *
+ * @author apodhrad
+ *
+ */
+public class ModeshapeView extends ViewBase {
+
+ public static final String TOOLBAR_ADD_SERVER = "Create a new server";
+ public static final String TOOLBAR_EDIT_SERVER = "Edit server properties";
+ public static final String TOOLBAR_DELETE_SERVER = "Delete server from the server registry";
+ public static final String TOOLBAR_RECONNECT_SERVER = "Reconnect to the selected server";
+
+ public ModeshapeView() {
+ viewObject = new IView() {
+ public String getName() {
+ return "ModeShape";
+ }
+
+ public List<String> getGroupPath() {
+ List<String> list = new Vector<String>();
+ list.add("ModeShape");
+ return list;
+ }
+ };
+ }
+
+ public void toolbarButtonClick(String toolTip) {
+ getToolbarButtonWitTooltip(toolTip).click();
+ }
+
+ public ModeshapeServerDialog addServer() {
+ getToolbarButtonWitTooltip("Create a new server").click();
+ return new ModeshapeServerDialog(bot.shell("New Server"));
+ }
+
+ public List<String> getServers() {
+ List<String> servers = new ArrayList<String>();
+ for (SWTBotTreeItem server : bot().tree().getAllItems()) {
+ if (server.isVisible()) {
+ servers.add(server.getText());
+ }
+ }
+ return servers;
+ }
+
+ public boolean containsServer(String serverName) {
+ return getServers().contains(serverName);
+ }
+
+ public void selectServer(String serverName) {
+ bot().tree().getTreeItem(serverName).select();
+ }
+
+ public void deleteServer(String serverName) {
+ selectServer(serverName);
+ toolbarButtonClick(TOOLBAR_DELETE_SERVER);
+ bot.shell("Confirm Delete Server").bot().button("OK").click();
+ }
+}
Modified: trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/tests/Publishing.java
===================================================================
--- trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/tests/Publishing.java 2012-09-18 15:21:26 UTC (rev 43799)
+++ trunk/modeshape/tests/org.jboss.tools.modeshape.rest.ui.bot.test/src/org/jboss/tools/modeshape/rest/ui/bot/tests/Publishing.java 2012-09-18 15:21:45 UTC (rev 43800)
@@ -1,288 +1,189 @@
package org.jboss.tools.modeshape.rest.ui.bot.tests;
-
import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
+
import org.eclipse.core.internal.preferences.Base64;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.SWTEclipseExt;
+import org.jboss.tools.modeshape.rest.ui.bot.ext.dialog.ModeshapePublishDialog;
+import org.jboss.tools.modeshape.rest.ui.bot.ext.dialog.ModeshapeServerDialog;
+import org.jboss.tools.modeshape.rest.ui.bot.ext.view.ModeshapeProjectExplorer;
+import org.jboss.tools.modeshape.rest.ui.bot.ext.view.ModeshapeView;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
-import org.jboss.tools.ui.bot.ext.SWTUtilExt;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerState;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.GeneralFile;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.GeneralProject;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotNewObjectWizard;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
-
/**
*
* @author psrna
- *
+ * @author apodhrad
+ *
*/
-@Require(server=(a)Server(type=ServerType.ALL, state=ServerState.Running),perspective="Java EE")
-public class Publishing extends SWTTestExt{
-
- private static final String CONNERR_MSG = "Unable to connect using the specified server properties." +
- "The server properties could be invalid or the server may be offline.";
-
-
- public static void createResource(){
-
- SWTBot wiz = open.newObject(ActionItem.NewObject.GeneralProject.LABEL);
- wiz.textWithLabel(GeneralProject.TEXT_PROJECT_NAME).setText(Properties.PROJECT_NAME);
- open.finish(wiz);
- assertTrue(projectExplorer.existsResource(Properties.PROJECT_NAME));
-
- wiz = open.newObject(ActionItem.NewObject.GeneralFile.LABEL);
- wiz.tree().select(Properties.PROJECT_NAME);
- wiz.textWithLabel(ActionItem.NewObject.GeneralFile.TEXT_FILE_NAME).setText(Properties.FILE_NAME);
- open.finish(wiz);
- assertTrue(projectExplorer.isFilePresent(Properties.PROJECT_NAME, Properties.FILE_NAME));
-
- bot.editorByTitle(Properties.FILE_NAME).close();
-
- String projectLocation = SWTUtilExt.getPathToProject(Properties.PROJECT_NAME);
- try {
- FileWriter fstream = new FileWriter(projectLocation + "/" + Properties.FILE_NAME);
- BufferedWriter out = new BufferedWriter(fstream);
- out.write(Properties.FILE_CONTENT);
- out.close();
- } catch (IOException e) {
- fail("Unable to write to file.");
- log.error(e.getMessage());
- }
-
- bot.viewByTitle("Project Explorer").show();
- bot.viewByTitle("Project Explorer").setFocus();
- SWTBot viewBot = bot.viewByTitle("Project Explorer").bot();
-
- SWTBotTreeItem node = SWTEclipseExt.selectTreeLocation(viewBot, Properties.PROJECT_NAME);
+@Require(server = @Server(type = ServerType.ALL, state = ServerState.Running), perspective = "Java EE")
+public class Publishing extends SWTTestExt {
- ContextMenuHelper.prepareTreeItemForContextMenu(viewBot.tree(), node);
- ContextMenuHelper.clickContextMenu(viewBot.tree(), "Refresh");
+ public static final String SERVER_REST_URL = "http://localhost:8080/modeshape-rest";
+ public static final String SERVER_WEBDAV_URL = "http://localhost:8080/modeshape-webdav";
+ public static final String PROJECT_NAME = "testproject";
+ public static final String FILE_NAME = "testfile.txt";
+ public static final String FILE_CONTENT = "testcontent";
+ public static final String PUBLISH_URL = SERVER_REST_URL + "/repository/default/items/files/"
+ + PROJECT_NAME + "/" + FILE_NAME;
+ public static final String PUBLISH_WEB_URL = SERVER_WEBDAV_URL
+ + "/repository/default/files/" + PROJECT_NAME + "/" + FILE_NAME;
- }
-
+ private static final ModeshapeProjectExplorer modeshapeExplorer = new ModeshapeProjectExplorer();
+
@BeforeClass
- public static void beforeClass(){
- createResource();
+ public static void createTestFile() {
+ // Create a general project
+ SWTBotNewObjectWizard projectWizard = new SWTBotNewObjectWizard();
+ projectWizard.open(GeneralProject.LABEL);
+ projectWizard.bot().textWithLabel(GeneralProject.TEXT_PROJECT_NAME).setText(PROJECT_NAME);
+ projectWizard.finishWithWait();
+ // Create a file
+ SWTBotNewObjectWizard fileWizard = new SWTBotNewObjectWizard();
+ fileWizard.open(GeneralFile.LABEL);
+ fileWizard.bot().textWithLabel(GeneralFile.TEXT_FILE_NAME).setText(FILE_NAME);
+ fileWizard.finishWithWait();
+ // Edit the file
+ SWTBotEclipseEditor fileEditor = projectExplorer.openFile(PROJECT_NAME, FILE_NAME)
+ .toTextEditor();
+ fileEditor.setText(FILE_CONTENT);
+ fileEditor.saveAndClose();
+
+ assertTrue("The test file wasn't created!",
+ projectExplorer.isFilePresent(PROJECT_NAME, FILE_NAME));
}
-
-
+
@Test
- public void createModeShapeServer(){
+ public void createModeShapeServer() {
+ ModeshapeView modeshapeView = new ModeshapeView();
+ modeshapeView.show();
+ ModeshapeServerDialog dialog = modeshapeView.addServer();
+ dialog.setUrl(SERVER_REST_URL);
+ dialog.setUser("admin");
+ dialog.setPassword("admin");
+ assertTrue("Couldn't connect to the server", dialog.testServerConnection());
+ dialog.finishWithWait();
+ assertTrue("Created server not visible in ModeShape view.",
+ modeshapeView.containsServer(SERVER_REST_URL));
+ }
- openModeshapeView();
+ @Test
+ public void publishFile() {
+ modeshapeExplorer.publish(FILE_NAME, PROJECT_NAME);
- SWTBotView view = bot.viewByTitle("ModeShape");
- assertTrue("ModeShape View must be active", view.isActive());
+ ModeshapePublishDialog publishDialog = new ModeshapePublishDialog(
+ bot.shell("Publish to ModeShape"));
- view.toolbarButton("Create a new server").click();
- SWTBotShell shell = bot.shell("New Server");
- shell.activate();
+ assertEquals(SERVER_REST_URL, publishDialog.getServer());
+ assertTrue(publishDialog.canFinish());
+ publishDialog.finishWithWait();
- shell.bot().textWithLabel("URL:").setText(Properties.URL);
- shell.bot().textWithLabel("User:").setText(Properties.USER);
- shell.bot().textWithLabel("Password:").setText(Properties.PASSWORD);
+ assertTrue("HTTP Response code must be 200 after publishing.",
+ HttpURLConnection.HTTP_OK == testPublishedFile());
+ }
- shell.bot().button("Test").click();
- shell = bot.shell("Test Server Connection");
- shell.activate();
+ @Test
+ public void publishedLocations() {
+ modeshapeExplorer.showPublishedLocations(FILE_NAME, PROJECT_NAME);
- String msg = shell.bot().label(1).getText();
- assertTrue(CONNERR_MSG, msg.equals("Successfully connected using the specified server properties."));
-
- open.finish(bot.activeShell().bot(), IDELabel.Button.OK);
- shell = bot.shell("New Server");
+ SWTBotShell shell = bot.shell("Published Locations");
shell.activate();
- open.finish(shell.bot());
+ SWTBotTable table = shell.bot().table();
+ assertEquals(SERVER_REST_URL, table.cell(0, 0));
+ assertEquals("admin", table.cell(0, 1));
+ assertEquals("repository", table.cell(0, 2));
+ assertEquals("default", table.cell(0, 3));
+ assertEquals(PUBLISH_URL, table.cell(0, 4));
- assertTrue("Created server not visible in ModeShape view.", view.bot().tree().getTreeItem(Properties.URL).isVisible());
-
- }
-
- private void openModeshapeView(){
-
- bot.menu(IDELabel.Menu.WINDOW)
- .menu(IDELabel.Menu.SHOW_VIEW)
- .menu(IDELabel.Menu.OTHER).click();
+ open.finish(shell.bot(), IDELabel.Button.OK);
- SWTBotShell shell = bot.shell("Show View");
- shell.activate();
- shell.bot().tree().expandNode("ModeShape", false).select("ModeShape");
-
- open.finish(bot.activeShell().bot(), IDELabel.Button.OK);
}
-
@Test
- public void publishFile(){
+ public void unpublishFile() {
+ modeshapeExplorer.unpublish(FILE_NAME, PROJECT_NAME);
- SWTBotView view = bot.viewByTitle("Project Explorer");
- SWTBot viewBot = view.bot();
- SWTBotTreeItem node = eclipse.selectTreeLocation(viewBot, Properties.PROJECT_NAME, Properties.FILE_NAME);
+ ModeshapePublishDialog dialog = new ModeshapePublishDialog(
+ bot.shell("Unpublish from ModeShape"));
- ContextMenuHelper.prepareTreeItemForContextMenu(projectExplorer.bot().tree(),node);
- ContextMenuHelper.clickContextMenu(projectExplorer.bot().tree(), "ModeShape", "Publish");
-
- SWTBotShell shell = bot.shell("Publish to ModeShape");
- shell.activate();
-
- SWTBotCombo serverCombo = shell.bot().comboBoxWithLabel("Server:");
- SWTBotCombo repoCombo = shell.bot().comboBoxWithLabel("JCR Repository:");
- SWTBotCombo workspaceCombo = shell.bot().comboBoxWithLabel("JCR Workspace:");
- workspaceCombo.setSelection(Properties.WORKSPACE);
-
- assertTrue("URL mismatch.", serverCombo.getText().equals(Properties.URL));
- assertTrue("Repository mismatch.", repoCombo.getText().equals(Properties.REPOSITORY));
- assertTrue("Workspace mismatch.", workspaceCombo.getText().equals(Properties.WORKSPACE));
-
- open.finish(shell.bot());
-
- assertTrue("HTTP Response code must be 200 after publishing.", HttpURLConnection.HTTP_OK == testPublishedFile());
- }
-
-
- @Test
- public void publishedLocations(){
-
- SWTBotView view = bot.viewByTitle("Project Explorer");
- SWTBot viewBot = view.bot();
- SWTBotTreeItem node = eclipse.selectTreeLocation(viewBot, Properties.PROJECT_NAME, Properties.FILE_NAME);
-
- ContextMenuHelper.prepareTreeItemForContextMenu(projectExplorer.bot().tree(),node);
- ContextMenuHelper.clickContextMenu(projectExplorer.bot().tree(), "ModeShape", "Show Published Locations");
-
- SWTBotShell shell = bot.shell("Published Locations");
- shell.activate();
-
- SWTBotTable table = shell.bot().table();
- assertTrue("Url mismatch.", table.cell(0, 0).equals(Properties.URL));
- assertTrue("User mismatch.", table.cell(0, 1).equals(Properties.USER));
- assertTrue("Repository mismatch.", table.cell(0, 2).equals(Properties.REPOSITORY));
- assertTrue("Workspace mismatch.", table.cell(0, 3).equals(Properties.WORKSPACE));
-
- String expectedPublishedUrl = Properties.URL + "/" +
- Properties.REPOSITORY + "/" +
- Properties.WORKSPACE + "/items/files/" +
- Properties.PROJECT_NAME + "/" +
- Properties.FILE_NAME;
-
- assertTrue("Published Url mismatch.", table.cell(0, 4).equals(expectedPublishedUrl));
-
- open.finish(shell.bot(), IDELabel.Button.OK);
-
- }
+ assertEquals(SERVER_REST_URL, dialog.getServer());
+ assertEquals("repository", dialog.getJcrRepository());
+ assertEquals("default", dialog.getJcrWorkspace());
-
-
- @Test
- public void unpublishFile(){
-
- SWTBotView view = bot.viewByTitle("Project Explorer");
- SWTBot viewBot = view.bot();
- SWTBotTreeItem node = eclipse.selectTreeLocation(viewBot, Properties.PROJECT_NAME, Properties.FILE_NAME);
-
- ContextMenuHelper.prepareTreeItemForContextMenu(projectExplorer.bot().tree(),node);
- ContextMenuHelper.clickContextMenu(projectExplorer.bot().tree(), "ModeShape", "Unpublish");
-
- SWTBotShell shell = bot.shell("Unpublish from ModeShape");
- shell.activate();
-
- SWTBotCombo serverCombo = shell.bot().comboBoxWithLabel("Server:");
- SWTBotCombo repoCombo = shell.bot().comboBoxWithLabel("JCR Repository:");
- SWTBotCombo workspaceCombo = shell.bot().comboBoxWithLabel("JCR Workspace:");
- workspaceCombo.setSelection(Properties.WORKSPACE);
-
- assertTrue("URL mismatch.", serverCombo.getText().equals(Properties.URL));
- assertTrue("Repository mismatch.", repoCombo.getText().equals(Properties.REPOSITORY));
- assertTrue("Workspace mismatch.", workspaceCombo.getText().equals(Properties.WORKSPACE));
-
- open.finish(shell.bot());
-
- assertTrue("HTTP Response code must be 404 after unpublishing.", HttpURLConnection.HTTP_NOT_FOUND == testPublishedFile());
-
+ dialog.finishWithWait();
+
+ assertTrue("HTTP Response code must be 404 after unpublishing.",
+ HttpURLConnection.HTTP_NOT_FOUND == testPublishedFile());
+
}
-
+
@AfterClass
- public static void afterClass(){
-
- bot.viewByTitle("ModeShape").show();
- SWTBotView botView = bot.viewByTitle("ModeShape");
- botView.bot().tree().select(Properties.URL);
- botView.toolbarButton("Delete server from the server registry").click();
- SWTBotShell shell = bot.shell("Confirm Delete Server");
-
- open.finish(shell.bot(),IDELabel.Button.OK);
+ public static void afterClass() {
+ ModeshapeView view = new ModeshapeView();
+ view.deleteServer(SERVER_REST_URL);
}
-
-
-
+
/**
*
* @return response code
*/
- private int testPublishedFile(){
-
+ private int testPublishedFile() {
+
try {
-
- URL url = new URL(Properties.WEBDAV_URL + "/" +
- Properties.REPOSITORY + "/" +
- Properties.WORKSPACE + "/files/" +
- Properties.PROJECT_NAME + "/" +
- Properties.FILE_NAME);
-
+
+ URL url = new URL(PUBLISH_WEB_URL);
+
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-
+
conn.setRequestMethod("GET");
conn.setAllowUserInteraction(false);
- conn.setUseCaches(false);
- conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
-
+ conn.setUseCaches(false);
+ conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+
String authorization = Properties.USER + ":" + Properties.PASSWORD;
- String encodedAuthorization= new String(Base64.encode(authorization.getBytes()));
+ String encodedAuthorization = new String(Base64.encode(authorization.getBytes()));
conn.setRequestProperty("Authorization", "Basic " + encodedAuthorization);
conn.connect();
-
- if(conn.getResponseCode() == HttpURLConnection.HTTP_OK){
- //if HTTP_OK, test content
+
+ if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ // if HTTP_OK, test content
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
-
- while ((line = rd.readLine()) != null){
+
+ while ((line = rd.readLine()) != null) {
sb.append(line);
}
- assertTrue("File content mismatch.", sb.toString().equals(Properties.FILE_CONTENT));
+ assertEquals(FILE_CONTENT, sb.toString());
}
- //return response code
+ // return response code
return conn.getResponseCode();
-
+
} catch (IOException e) {
fail("Unable to test the published file.");
log.error(e.getMessage());
- }
+ }
return -1;
}
-
+
}
13 years, 6 months