JBoss Tools SVN: r34627 - in trunk/as/plugins: org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-12 06:48:36 -0400 (Mon, 12 Sep 2011)
New Revision: 34627
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeCreateDomainRequest.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractDomainRequest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
Log:
[JBIDE-9510] implementing alter domain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractDomainRequest.java 2011-09-12 10:36:39 UTC (rev 34626)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/AbstractDomainRequest.java 2011-09-12 10:48:36 UTC (rev 34627)
@@ -21,7 +21,7 @@
private String name;
private SSHKey sshKey;
- public AbstractDomainRequest(String name, SSHKey sshKey, ApplicationAction action, String username) {
+ public AbstractDomainRequest(String name, SSHKey sshKey, String username) {
this(name, sshKey, username, false);
}
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeCreateDomainRequest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeCreateDomainRequest.java 2011-09-12 10:36:39 UTC (rev 34626)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeCreateDomainRequest.java 2011-09-12 10:48:36 UTC (rev 34627)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.core.request;
-
-import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-
-
-/**
- * @author André Dietisheim
- */
-public class ChangeCreateDomainRequest extends AbstractDomainRequest {
-
- public ChangeCreateDomainRequest(String name, String namespace, SSHKey sshKey, ApplicationAction action, String username) {
- this(name, namespace, sshKey, username, false);
- }
-
- public ChangeCreateDomainRequest(String name, String namespace, SSHKey sshKey, String username, boolean debug) {
- super(name, sshKey, username, debug);
- }
-
- public boolean isAlter() {
- return true;
- }
-}
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java (from rev 34598, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeCreateDomainRequest.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java 2011-09-12 10:48:36 UTC (rev 34627)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.core.request;
+
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+
+
+/**
+ * @author André Dietisheim
+ */
+public class ChangeDomainRequest extends AbstractDomainRequest {
+
+ public ChangeDomainRequest(String name, SSHKey sshKey, String username) {
+ this(name, sshKey, username, false);
+ }
+
+ public ChangeDomainRequest(String name, SSHKey sshKey, String username, boolean debug) {
+ super(name, sshKey, username, debug);
+ }
+
+ public boolean isAlter() {
+ return true;
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/request/ChangeDomainRequest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-12 10:36:39 UTC (rev 34626)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-12 10:48:36 UTC (rev 34627)
@@ -13,11 +13,13 @@
import static org.junit.Assert.assertEquals;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
@@ -32,25 +34,11 @@
private static final String PASSWORD = "1q2w3e";
@Test
- public void canMarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ public void canMarshallDomainCreateRequest() throws IOException, OpenshiftException {
SSHKey sshKey = TestSSHKey.create();
- String expectedRequestString =
- "password="
- + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+"
- + "%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22"
- + "%2C+%22debug%22+%3A+%22true%22"
- + "%2C+%22namespace%22+%3A+%22toolsjboss%40gmail.com%22"
- + "%2C+%22alter%22+%3A+%22false%22"
- + "%2C+%22ssh%22+%3A+%22"
- + URLEncoder.encode(sshKey.getPublicKeyContent(), "UTF-8")
- + "%22"
- + "%7D";
-
- CreateDomainRequest request = new CreateDomainRequest(USERNAME, sshKey, USERNAME, true);
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", false, sshKey.getPublicKeyContent());
+
+ CreateDomainRequest request = new CreateDomainRequest("myDomain", sshKey, USERNAME, true);
String requestString =
new OpenshiftJsonRequestFactory(
PASSWORD,
@@ -58,4 +46,37 @@
.create();
assertEquals(expectedRequestString, requestString);
}
+
+ @Test
+ public void canMarshallDomainAlterRequest() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
+ String expectedRequestString = createDomainRequestString(PASSWORD, USERNAME, true, "myDomain", true, sshKey.getPublicKeyContent());
+
+ ChangeDomainRequest request = new ChangeDomainRequest("myDomain", sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+
+ private String createDomainRequestString(String password, String username, boolean debug, String namespace, boolean alter, String sshPublicKey) throws UnsupportedEncodingException {
+ String request =
+ "password="
+ + password
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22"
+ + URLEncoder.encode(username, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22" + String.valueOf(debug)+ "%22"
+ + "%2C+%22namespace%22+%3A+%22" + URLEncoder.encode(namespace, "UTF-8")+ "%22"
+ + "%2C+%22alter%22+%3A+%22" + String.valueOf(alter)+ "%22"
+ + "%2C+%22ssh%22+%3A+%22"
+ + URLEncoder.encode(sshPublicKey, "UTF-8")
+ + "%22"
+ + "%7D";
+ return request;
+ }
}
14 years, 7 months
JBoss Tools SVN: r34626 - trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-12 06:36:39 -0400 (Mon, 12 Sep 2011)
New Revision: 34626
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
Log:
[JBIDE-9510] implementing alter domain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-12 10:25:46 UTC (rev 34625)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-12 10:36:39 UTC (rev 34626)
@@ -33,6 +33,7 @@
@Test
public void canMarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ SSHKey sshKey = TestSSHKey.create();
String expectedRequestString =
"password="
+ PASSWORD
@@ -44,10 +45,11 @@
+ "%2C+%22debug%22+%3A+%22true%22"
+ "%2C+%22namespace%22+%3A+%22toolsjboss%40gmail.com%22"
+ "%2C+%22alter%22+%3A+%22false%22"
- + "%2C+%22ssh%22+%3A+%22AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke%2FhE8MLBBG1%2B5ZwktsrE%2Bf2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX%2BzeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA%2F7EzzyneS6iyw%3D%3D%22"
+ + "%2C+%22ssh%22+%3A+%22"
+ + URLEncoder.encode(sshKey.getPublicKeyContent(), "UTF-8")
+ + "%22"
+ "%7D";
- SSHKey sshKey = TestSSHKey.create();
CreateDomainRequest request = new CreateDomainRequest(USERNAME, sshKey, USERNAME, true);
String requestString =
new OpenshiftJsonRequestFactory(
14 years, 7 months
JBoss Tools SVN: r34625 - branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-09-12 06:25:46 -0400 (Mon, 12 Sep 2011)
New Revision: 34625
Modified:
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-9687
Workaround for Dali bug which fixes class cast exception
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -43,6 +43,7 @@
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
@@ -411,6 +412,23 @@
private static IndexedDeclarationAnnotationAdapter buildNestedHibernateDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter hibernateGenericGeneratorsAdapter) {
return new NestedIndexedDeclarationAnnotationAdapter(hibernateGenericGeneratorsAdapter, index, Hibernate.GENERIC_GENERATOR);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
public static class GenericGeneratorAnnotationDefinition implements AnnotationDefinition
{
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
@@ -33,7 +34,9 @@
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.CacheModeType;
@@ -773,6 +776,23 @@
public void toString(StringBuilder sb) {
sb.append(this.name);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
// ********** static methods **********
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
@@ -31,7 +32,9 @@
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.CacheModeType;
@@ -610,6 +613,23 @@
public void toString(StringBuilder sb) {
sb.append(this.name);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
// ********** static methods **********
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -118,7 +118,7 @@
}
private GenericGeneratorAnnotation buildGenericGenerator(int index) {
- return GenericGeneratorAnnotationImpl.createNestedGenericGenerator(this, this.annotatedElement, index, this.daa);
+ return GenericGeneratorAnnotationImpl.createNestedGenericGenerator(this.parent, this.annotatedElement, index, this.daa);
}
public GenericGeneratorAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -32,7 +32,6 @@
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -45,6 +44,7 @@
import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
@@ -454,9 +454,21 @@
return this.buildStringElementAdapter(this.defForTypeDeclarationAdapter);
}
-
- private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
}
public static class TypeDefAnnotationDefinition implements AnnotationDefinition
Modified: branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java
===================================================================
--- branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
+++ branches/jbosstools-3.3.0.M3/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java 2011-09-12 10:25:46 UTC (rev 34625)
@@ -118,7 +118,7 @@
}
private TypeDefAnnotation buildTypeDef(int index) {
- return TypeDefAnnotationImpl.createNestedTypeDef(this, this.annotatedElement, index, this.daa);
+ return TypeDefAnnotationImpl.createNestedTypeDef(this.parent, this.annotatedElement, index, this.daa);
}
public TypeDefAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
14 years, 7 months
JBoss Tools SVN: r34624 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-09-12 06:16:40 -0400 (Mon, 12 Sep 2011)
New Revision: 34624
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java
Log:
https://issues.jboss.org/browse/JBIDE-9687
Workaround for Dali bug which fixes class cast exception
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/GenericGeneratorAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -43,6 +43,7 @@
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
@@ -411,6 +412,23 @@
private static IndexedDeclarationAnnotationAdapter buildNestedHibernateDeclarationAnnotationAdapter(int index, DeclarationAnnotationAdapter hibernateGenericGeneratorsAdapter) {
return new NestedIndexedDeclarationAnnotationAdapter(hibernateGenericGeneratorsAdapter, index, Hibernate.GENERIC_GENERATOR);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
public static class GenericGeneratorAnnotationDefinition implements AnnotationDefinition
{
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedNativeQueryAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
@@ -33,7 +34,9 @@
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.CacheModeType;
@@ -773,6 +776,23 @@
public void toString(StringBuilder sb) {
sb.append(this.name);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
// ********** static methods **********
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/HibernateSourceNamedQueryAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.hibernate.jpt.core.internal.resource.java;
+import java.util.HashMap;
import java.util.ListIterator;
import java.util.Map;
@@ -31,7 +32,9 @@
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator;
import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation;
+import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.NestableQueryHintAnnotation;
import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.CacheModeType;
@@ -610,6 +613,23 @@
public void toString(StringBuilder sb) {
sb.append(this.name);
}
+
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
+ }
// ********** static methods **********
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/SourceGenericGeneratorsAnnotation.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -118,7 +118,7 @@
}
private GenericGeneratorAnnotation buildGenericGenerator(int index) {
- return GenericGeneratorAnnotationImpl.createNestedGenericGenerator(this, this.annotatedElement, index, this.daa);
+ return GenericGeneratorAnnotationImpl.createNestedGenericGenerator(this.parent, this.annotatedElement, index, this.daa);
}
public GenericGeneratorAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -32,7 +32,6 @@
import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter;
-import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter;
import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter;
import org.eclipse.jpt.common.utility.internal.CollectionTools;
@@ -45,6 +44,7 @@
import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode;
+import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation;
import org.jboss.tools.hibernate.jpt.core.internal.context.basic.Hibernate;
/**
@@ -454,9 +454,21 @@
return this.buildStringElementAdapter(this.defForTypeDeclarationAdapter);
}
-
- private static DeclarationAnnotationElementAdapter<String> buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter<String> converter) {
- return new ConversionDeclarationAnnotationElementAdapter<String>(annotationAdapter, elementName, converter);
+ /*
+ * This is a workaround fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=357224
+ * The exception occurs due to wrong cast in SourceAnnotation
+ * The method should be removed after the bug fix.
+ */
+ public void convertToStandAlone() {
+ Map<String, Object> map = new HashMap<String, Object>();
+ this.storeOn(map);
+ this.removeAnnotation(); // this annotation has already been removed from the model
+ this.daa = new SimpleDeclarationAnnotationAdapter(this.getAnnotationName());
+ this.annotationAdapter = new ElementAnnotationAdapter(this.annotatedElement, this.daa);
+ this.rebuildAdapters();
+ ((JavaResourceAnnotatedElement)this.parent).addStandAloneAnnotation((NestableAnnotation) this);
+ this.newAnnotation();
+ this.restoreFrom(map);
}
public static class TypeDefAnnotationDefinition implements AnnotationDefinition
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java 2011-09-12 10:08:05 UTC (rev 34623)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.jpt.core/src/org/jboss/tools/hibernate/jpt/core/internal/resource/java/TypeDefsAnnotationImpl.java 2011-09-12 10:16:40 UTC (rev 34624)
@@ -118,7 +118,7 @@
}
private TypeDefAnnotation buildTypeDef(int index) {
- return TypeDefAnnotationImpl.createNestedTypeDef(this, this.annotatedElement, index, this.daa);
+ return TypeDefAnnotationImpl.createNestedTypeDef(this.parent, this.annotatedElement, index, this.daa);
}
public TypeDefAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) {
14 years, 7 months
JBoss Tools SVN: r34623 - in trunk/as/plugins: org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-12 06:08:05 -0400 (Mon, 12 Sep 2011)
New Revision: 34623
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftServiceTest.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
Log:
[JBIDE-9510] implementing alter domain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Domain.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -11,14 +11,23 @@
package org.jboss.ide.eclipse.as.openshift.core;
+/**
+ * @author André Dietisheim
+ */
public class Domain implements IOpenshiftObject {
private User user;
+ private String name;
- public Domain(User user) {
+ public Domain(String name, User user) {
+ this.name = name;
this.user = user;
}
+ public String getName() {
+ return name;
+ }
+
public User getUser() {
return user;
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftJsonConstants.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -31,5 +31,6 @@
public static final String PROPERTY_NAMESPACE = "namespace";
public static final String PROPERTY_ALTER = "alter";
public static final String PROPERTY_SSH = "ssh";
+ public static final String PROPERTY_UUID = "uuid";
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/internal/marshalling/AbstractJsonMarshaller.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.core.internal.marshalling;
import org.jboss.dmr.ModelNode;
@@ -18,12 +18,13 @@
/**
* @author André Dietisheim
*/
-public abstract class AbstractJsonMarshaller<REQUEST extends AbstractOpenshiftRequest> implements IOpenshiftMarshaller<REQUEST> {
+public abstract class AbstractJsonMarshaller<REQUEST extends AbstractOpenshiftRequest> implements
+ IOpenshiftMarshaller<REQUEST> {
public String marshall(REQUEST request) throws OpenshiftException {
ModelNode node = new ModelNode();
setStringProperty(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, request.getRhLogin(), node);
- setStringProperty(IOpenshiftJsonConstants.PROPERTY_DEBUG, request.isDebug(), node);
+ setStringProperty(IOpenshiftJsonConstants.PROPERTY_DEBUG, String.valueOf(request.isDebug()), node);
setJsonDataProperties(node, request);
return node.toJSONString(true);
}
@@ -31,20 +32,21 @@
protected void setJsonDataProperties(ModelNode node, REQUEST request) throws OpenshiftException {
// empty default implementation
}
-
+
protected void setStringProperty(String propertyName, Object value, ModelNode node) {
- if (!isSet(value)) {
- if (value instanceof String) {
- setStringProperty((String) value, propertyName, node);
- }
+ if (!(value instanceof String)
+ && !isSet((String) value)) {
+ return;
}
+
+ setStringProperty((String) value, propertyName, node);
}
-
+
protected void setStringProperty(String propertyName, String value, ModelNode node) {
if (!isSet(value)) {
return;
}
-
+
node.get(propertyName).set(value);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -23,7 +23,6 @@
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftEndpointException;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
-import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.core.UserInfo;
import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
@@ -40,6 +39,7 @@
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.response.ApplicationResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.DomainResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
@@ -120,8 +120,9 @@
password,
new DomainRequestJsonMarshaller().marshall(request))
.create();
- String domainReponse = createHttpClient(url).post(requestString);
- return new Domain(new User("", ""));
+ String responseString = createHttpClient(url).post(requestString);
+ OpenshiftResponse<Domain> response = new DomainResponseUnmarshaller(responseString, request.getName()).unmarshall();
+ return response.getData();
} catch (MalformedURLException e) {
throw new OpenshiftEndpointException(url, e, "Could not list available cartridges at \"{0}\"", url);
} catch (HttpClientException e) {
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.core.response;
+
+import org.jboss.dmr.ModelNode;
+import org.jboss.ide.eclipse.as.openshift.core.Domain;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftJsonConstants;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainResponseUnmarshaller extends AbstractOpenshiftJsonResponseUnmarshaller<Domain> {
+
+ private String domainName;
+
+ public DomainResponseUnmarshaller(String response, String domainName) {
+ super(response);
+ this.domainName = domainName;
+ }
+
+ @Override
+ protected Domain createOpenshiftObject(ModelNode node) {
+ User user = createUser(node);
+ return new Domain(domainName, user);
+ }
+
+ protected User createUser(ModelNode node) {
+ String username = getString(IOpenshiftJsonConstants.PROPERTY_RHLOGIN, node);
+ String uuid = getString(IOpenshiftJsonConstants.PROPERTY_UUID, node);
+
+ return new User(username, uuid);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/DomainResponseUnmarshaller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-12 10:08:05 UTC (rev 34623)
@@ -3,7 +3,7 @@
Bundle-Name: Openshift Test Plugin
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.test
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.jboss.ide.eclipse.as.openshift.test.Activator
+Bundle-Activator: org.jboss.ide.eclipse.as.openshift.internal.test.core.Activator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
org.junit;bundle-version="[4.8.0,5.0.0)",
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java (from rev 34538, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/Activator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ApplicationTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallApplicationCreateRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22configure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canMarshallApplicationDestroyRequest() throws Exception {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
+ + "%2C+%22action%22+%3A+%22deconfigure%22"
+ + "%2C+%22app_name%22+%3A+%22test-application%22"
+ + "%7D";
+
+ String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
+ new ApplicationRequest(
+ "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE, USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainIntegrationTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -10,16 +10,14 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.internal.test.core;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringReader;
-
import org.jboss.ide.eclipse.as.openshift.core.Domain;
import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.User;
import org.jboss.ide.eclipse.as.openshift.internal.core.OpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
import org.junit.Before;
import org.junit.Test;
@@ -30,34 +28,6 @@
private static final String USERNAME = "openshift.only.domain(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
- private static final String privateKey =
- "-----BEGIN RSA PRIVATE KEY-----\n" +
- "Proc-Type: 4,ENCRYPTED\n" +
- "DEK-Info: DES-EDE3-CBC,30E8B3A668E44D77\n" +
- "\n" +
- "wsXCU31SUTYhjPnOiW56UlZ7VXKlIjItLo5Wrk5LwCLv/OERK7UWJkrwM2bHPb6n\n" +
- "3zAaDDZfQe786URQjfmUYWBdVeI7DrRMwoLaaUcR1tuJtMu3Jv3CK72YMkOzGapZ\n" +
- "ZAAoTno/GRhTwptXG1KPSqKyzfqlxjbZry1HZmY+P6ikw9DWOPZC6rISIqQ3u9zm\n" +
- "iPvi/Oo7JWZtX1d1MYp3vVt2bo2duD4RSoXWWaW471WUOIQZUh0V4dxp+eAHZziu\n" +
- "osAfU4WoIrrSCSVl2uiKS2Zijn77PvcCXnm45eMQpww32AlslzIBNsMzUXhPtVAZ\n" +
- "a9uvfZxlOIRu4ObN7AB3WExucbBHCvTOgxpSs95br1QtfMVl62d9VkIAXg1x9gH8\n" +
- "kjcEP+0OS3EItYTFj1tCKC8GgBImj44AxbPSWu3SfTnYfAtFnO0pUqhPOBN63DCC\n" +
- "XxzMm13UeER7Z3s968Swa48r6LRAbHI8JD0Ld4E02fgBYM/N/aGtPppD0FoJJwo3\n" +
- "QVafS2PY+bALgy4qrI9daOo1mTS3gWDSAG0QbLoKd3hD8ZnLEk6rfR/0SE34Fc7j\n" +
- "mviCy78C16hkllhWz27ROl5pheHV0Xt6ZlUsNWVz7tg/AcIFB0geMuzuM0Kd7ufj\n" +
- "g5c8mhlI06n4vzo0uB6UXtwTBzNqyUl8yxA31S2VJfBZxkEwKc5cktNUiejQuWbU\n" +
- "iwapdiSR0gNGyYBNMYax9OOfYH+BBQeD5kboVU3yvT7UNcz0T9GZiEhfvcaYSP8C\n" +
- "ejQ1vuTNTKMrgyLpNi/4Sq8lm8OukRqQyE0EKYCwvkI=\n" +
- "-----END RSA PRIVATE KEY-----";
-
- private static final String publicKey =
- "ssh-rsa "
- +
- "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5Z" +
- "wktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG" +
- "1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw" +
- "== created by org.jboss.ide.eclipse.as.openshift.core";
-
@Before
public void setUp() {
this.openshiftService = new OpenshiftService(USERNAME, PASSWORD);
@@ -65,40 +35,20 @@
@Test
public void canCreateDomain() throws Exception {
- File privateKeyFile = File.createTempFile(createRandomString(), null);
- writeTo(privateKey, privateKeyFile);
- File publicKeyFile = File.createTempFile(createRandomString(), null);
- writeTo(publicKey, publicKeyFile);
-
- SSHKey key = openshiftService.loadKey(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
String domainName = createRandomString();
- Domain domain = openshiftService.createDomain(domainName, key);
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.createDomain(domainName, sshKey);
assertNotNull(domain);
+ assertEquals(domainName, domain.getName());
+ assertNotNull(domain.getUser());
+ User user = domain.getUser();
+ assertEquals(USERNAME, user.getRhlogin());
+ assertNotNull(user.getUuid());
}
private String createRandomString() {
return String.valueOf(System.currentTimeMillis());
}
-
- private void writeTo(String data, File file) throws IOException {
- StringReader reader = null;
- FileWriter writer = null;
- try {
- writer = new FileWriter(file);
- reader = new StringReader(data);
- for (int character = -1; (character = reader.read()) != -1;) {
- writer.write(character);
- }
- } finally {
- if (writer != null) {
- writer.flush();
- writer.close();
- }
- if (reader != null) {
- reader.close();
- }
- }
- }
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.DomainRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.fakes.TestSSHKey;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class DomainTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallDomainCreateResponse() throws IOException, OpenshiftException {
+ String expectedRequestString =
+ "password="
+ + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+"
+ + "%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22"
+ + "%2C+%22debug%22+%3A+%22true%22"
+ + "%2C+%22namespace%22+%3A+%22toolsjboss%40gmail.com%22"
+ + "%2C+%22alter%22+%3A+%22false%22"
+ + "%2C+%22ssh%22+%3A+%22AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke%2FhE8MLBBG1%2B5ZwktsrE%2Bf2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX%2BzeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA%2F7EzzyneS6iyw%3D%3D%22"
+ + "%7D";
+
+ SSHKey sshKey = TestSSHKey.create();
+ CreateDomainRequest request = new CreateDomainRequest(USERNAME, sshKey, USERNAME, true);
+ String requestString =
+ new OpenshiftJsonRequestFactory(
+ PASSWORD,
+ new DomainRequestJsonMarshaller().marshall(request))
+ .create();
+ assertEquals(expectedRequestString, requestString);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/DomainTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.net.URLEncoder;
+import java.text.MessageFormat;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class ListCartridgesTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallListCartridgesRequest() throws Exception {
+ String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
+ + URLEncoder.encode(USERNAME, "UTF-8")
+ + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
+
+ String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
+ new ListCartridgesRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, listCartridgeRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+
+ @Test
+ public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
+ String cartridgeListResponse =
+ "{"
+ + "\"messages\":\"\","
+ + "\"debug\":\"\","
+ + "\"data\":"
+ + "{\"carts\":[\"perl-5.10\",\"jbossas-7.0\",\"wsgi-3.2\",\"rack-1.1\",\"php-5.3\"]},"
+ + "\"api\":\"1.1.1\","
+ + "\"api_c\":[\"placeholder\"],"
+ + "\"result\":null,"
+ + "\"broker\":\"1.1.1\","
+ + "\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
+ + "\"exit_code\":0}";
+
+ OpenshiftResponse<List<Cartridge>> response = new ListCartridgesResponseUnmarshaller(cartridgeListResponse)
+ .unmarshall();
+ assertEquals("", response.getMessages());
+ assertEquals(false, response.isDebug());
+
+ List<Cartridge> cartridges = response.getData();
+ assertEquals(5, cartridges.size());
+ assertThatContainsCartridge("perl-5.10", cartridges);
+ assertThatContainsCartridge("jbossas-7.0", cartridges);
+ assertThatContainsCartridge("wsgi-3.2", cartridges);
+ assertThatContainsCartridge("rack-1.1", cartridges);
+ assertThatContainsCartridge("php-5.3", cartridges);
+ assertEquals(null, response.getResult());
+ assertEquals(0, response.getExitCode());
+ }
+
+ private void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
+ boolean found = false;
+ for (Cartridge cartridge : cartridges) {
+ if (cartridgeName.equals(cartridge.getName())) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ListCartridgesTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftServiceTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftServiceTest.java 2011-09-10 00:02:46 UTC (rev 34622)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftServiceTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.net.URLEncoder;
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ApplicationRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.ListCartridgesRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationAction;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ApplicationRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
-import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.ListCartridgesResponseUnmarshaller;
-import org.jboss.ide.eclipse.as.openshift.internal.core.response.OpenshiftResponse;
-import org.junit.Test;
-
-/**
- * @author André Dietisheim
- */
-public class OpenshiftServiceTest {
-
- private static final String USERNAME = "toolsjboss(a)gmail.com";
- private static final String PASSWORD = "1q2w3e";
-
- @Test
- public void canMarshallUserInfoRequest() throws Exception {
- String expectedRequestString =
- "password=" + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22%2C+"
- + "%22debug%22+%3A+%22true%22"
- + "%7D";
-
- String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new UserInfoRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, userInfoRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canMarshallListCartridgesRequest() throws Exception {
- String expectedRequestString = "password=" + PASSWORD + "&json_data=%7B%22rhlogin%22+%3A+%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22%2C+%22debug%22+%3A+%22true%22%2C+%22cart_type%22+%3A+%22standalone%22%7D";
-
- String listCartridgeRequest = new ListCartridgesRequestJsonMarshaller().marshall(
- new ListCartridgesRequest(USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, listCartridgeRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canMarshallApplicationCreateRequest() throws Exception {
- String expectedRequestString =
- "password="
- + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22"
- + "%2C+%22debug%22+%3A+%22true%22"
- + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
- + "%2C+%22action%22+%3A+%22configure%22"
- + "%2C+%22app_name%22+%3A+%22test-application%22"
- + "%7D";
-
- String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
- new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.CONFIGURE, USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canMarshallApplicationDestroyRequest() throws Exception {
- String expectedRequestString =
- "password="
- + PASSWORD
- + "&json_data=%7B"
- + "%22rhlogin%22+%3A+%22"
- + URLEncoder.encode(USERNAME, "UTF-8")
- + "%22"
- + "%2C+%22debug%22+%3A+%22true%22"
- + "%2C+%22cartridge%22+%3A+%22jbossas-7.0%22"
- + "%2C+%22action%22+%3A+%22deconfigure%22"
- + "%2C+%22app_name%22+%3A+%22test-application%22"
- + "%7D";
-
- String createApplicationRequest = new ApplicationRequestJsonMarshaller().marshall(
- new ApplicationRequest(
- "test-application", Cartridge.JBOSSAS_7, ApplicationAction.DECONFIGURE, USERNAME, true));
- String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, createApplicationRequest).create();
-
- assertEquals(expectedRequestString, effectiveRequest);
- }
-
- @Test
- public void canUnmarshallCartridgeListResponse() throws OpenshiftException {
- String cartridgeListResponse =
- "{"
- + "\"messages\":\"\","
- + "\"debug\":\"\","
- + "\"data\":"
- + "{\"carts\":[\"perl-5.10\",\"jbossas-7.0\",\"wsgi-3.2\",\"rack-1.1\",\"php-5.3\"]},"
- + "\"api\":\"1.1.1\","
- + "\"api_c\":[\"placeholder\"],"
- + "\"result\":null,"
- + "\"broker\":\"1.1.1\","
- + "\"broker_c\":[\"namespace\",\"rhlogin\",\"ssh\",\"app_uuid\",\"debug\",\"alter\",\"cartridge\",\"cart_type\",\"action\",\"app_name\",\"api\"],"
- + "\"exit_code\":0}";
-
- OpenshiftResponse<List<Cartridge>> response = new ListCartridgesResponseUnmarshaller(cartridgeListResponse)
- .unmarshall();
- assertEquals("", response.getMessages());
- assertEquals(false, response.isDebug());
-
- List<Cartridge> cartridges = response.getData();
- assertEquals(5, cartridges.size());
- assertThatContainsCartridge("perl-5.10", cartridges);
- assertThatContainsCartridge("jbossas-7.0", cartridges);
- assertThatContainsCartridge("wsgi-3.2", cartridges);
- assertThatContainsCartridge("rack-1.1", cartridges);
- assertThatContainsCartridge("php-5.3", cartridges);
- assertEquals(null, response.getResult());
- assertEquals(0, response.getExitCode());
-
- }
-
- private void assertThatContainsCartridge(String cartridgeName, List<Cartridge> cartridges) {
- boolean found = false;
- for (Cartridge cartridge : cartridges) {
- if (cartridgeName.equals(cartridge.getName())) {
- found = true;
- break;
- }
- }
- if (!found) {
- fail(MessageFormat.format("Could not find cartridge with name \"{0}\"", cartridgeName));
- }
- }
-}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+(a)RunWith(Suite.class)
+(a)Suite.SuiteClasses({
+ ApplicationTest.class,
+ ListCartridgesTest.class,
+ DomainTest.class,
+ UserInfoTest.class
+})
+/**
+ * @author André Dietisheim
+ */
+public class OpenshiftTestSuite {
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftTestSuite.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java (from rev 34585, trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/OpenshiftServiceTest.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core;
+
+import static org.junit.Assert.assertEquals;
+
+import java.net.URLEncoder;
+
+import org.jboss.ide.eclipse.as.openshift.core.internal.marshalling.UserInfoRequestJsonMarshaller;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
+import org.jboss.ide.eclipse.as.openshift.internal.core.request.UserInfoRequest;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class UserInfoTest {
+
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
+ private static final String PASSWORD = "1q2w3e";
+
+ @Test
+ public void canMarshallUserInfoRequest() throws Exception {
+ String expectedRequestString =
+ "password=" + PASSWORD
+ + "&json_data=%7B"
+ + "%22rhlogin%22+%3A+%22" + URLEncoder.encode(USERNAME, "UTF-8") + "%22%2C+"
+ + "%22debug%22+%3A+%22true%22"
+ + "%7D";
+
+ String userInfoRequest = new UserInfoRequestJsonMarshaller().marshall(new UserInfoRequest(USERNAME, true));
+ String effectiveRequest = new OpenshiftJsonRequestFactory(PASSWORD, userInfoRequest).create();
+
+ assertEquals(expectedRequestString, effectiveRequest);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/UserInfoTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core.fakes;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.SSHKey;
+import org.jboss.ide.eclipse.as.openshift.internal.test.core.utils.StreamUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class TestSSHKey {
+
+ private static final String privateKey =
+ "-----BEGIN RSA PRIVATE KEY-----\n" +
+ "Proc-Type: 4,ENCRYPTED\n" +
+ "DEK-Info: DES-EDE3-CBC,30E8B3A668E44D77\n" +
+ "\n" +
+ "wsXCU31SUTYhjPnOiW56UlZ7VXKlIjItLo5Wrk5LwCLv/OERK7UWJkrwM2bHPb6n\n" +
+ "3zAaDDZfQe786URQjfmUYWBdVeI7DrRMwoLaaUcR1tuJtMu3Jv3CK72YMkOzGapZ\n" +
+ "ZAAoTno/GRhTwptXG1KPSqKyzfqlxjbZry1HZmY+P6ikw9DWOPZC6rISIqQ3u9zm\n" +
+ "iPvi/Oo7JWZtX1d1MYp3vVt2bo2duD4RSoXWWaW471WUOIQZUh0V4dxp+eAHZziu\n" +
+ "osAfU4WoIrrSCSVl2uiKS2Zijn77PvcCXnm45eMQpww32AlslzIBNsMzUXhPtVAZ\n" +
+ "a9uvfZxlOIRu4ObN7AB3WExucbBHCvTOgxpSs95br1QtfMVl62d9VkIAXg1x9gH8\n" +
+ "kjcEP+0OS3EItYTFj1tCKC8GgBImj44AxbPSWu3SfTnYfAtFnO0pUqhPOBN63DCC\n" +
+ "XxzMm13UeER7Z3s968Swa48r6LRAbHI8JD0Ld4E02fgBYM/N/aGtPppD0FoJJwo3\n" +
+ "QVafS2PY+bALgy4qrI9daOo1mTS3gWDSAG0QbLoKd3hD8ZnLEk6rfR/0SE34Fc7j\n" +
+ "mviCy78C16hkllhWz27ROl5pheHV0Xt6ZlUsNWVz7tg/AcIFB0geMuzuM0Kd7ufj\n" +
+ "g5c8mhlI06n4vzo0uB6UXtwTBzNqyUl8yxA31S2VJfBZxkEwKc5cktNUiejQuWbU\n" +
+ "iwapdiSR0gNGyYBNMYax9OOfYH+BBQeD5kboVU3yvT7UNcz0T9GZiEhfvcaYSP8C\n" +
+ "ejQ1vuTNTKMrgyLpNi/4Sq8lm8OukRqQyE0EKYCwvkI=\n" +
+ "-----END RSA PRIVATE KEY-----";
+
+ private static final String publicKey =
+ "ssh-rsa "
+ +
+ "AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5Z" +
+ "wktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG" +
+ "1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw" +
+ "== created by org.jboss.ide.eclipse.as.openshift.core";
+
+ public static SSHKey create() throws IOException, OpenshiftException {
+ File privateKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(privateKey, privateKeyFile);
+
+ File publicKeyFile = File.createTempFile(createRandomString(), null);
+ StreamUtils.writeTo(publicKey, publicKeyFile);
+
+ return SSHKey.load(privateKeyFile.getAbsolutePath(), publicKeyFile.getAbsolutePath());
+ }
+
+ private static String createRandomString() {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/fakes/TestSSHKey.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java 2011-09-12 10:08:05 UTC (rev 34623)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.ide.eclipse.as.openshift.internal.test.core.utils;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+
+public class StreamUtils {
+
+ public static void writeTo(String data, String path) throws IOException {
+ writeTo(data, new File(path));
+ }
+
+ public static void writeTo(String data, File file) throws IOException {
+ StringReader reader = null;
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(file);
+ reader = new StringReader(data);
+ for (int character = -1; (character = reader.read()) != -1;) {
+ writer.write(character);
+ }
+ } finally {
+ if (writer != null) {
+ writer.flush();
+ writer.close();
+ }
+ if (reader != null) {
+ reader.close();
+ }
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/utils/StreamUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
JBoss Tools SVN: r34622 - in trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test: projects/Seam3DependentPersistenceTest/bin and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-09 20:02:46 -0400 (Fri, 09 Sep 2011)
New Revision: 34622
Added:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/resin-javaee-4.0.16.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-3.0.0.CR1.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-api-3.0.0.CR1.jar
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/MyQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/SeamJmsValidationTest.java
Removed:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3DependentPersistenceTest/.settings/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3DependentPersistenceTest/bin/test/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/.settings/
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/Seam3PersistenceTest/bin/test/
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project
trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java
Log:
https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be aware of JMS resource injections
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project 2011-09-09 22:57:44 UTC (rev 34621)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/.project 2011-09-10 00:02:46 UTC (rev 34622)
@@ -43,7 +43,6 @@
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
<nature>org.jboss.tools.cdi.core.cdinature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
- <nature>org.jboss.tools.jsf.jsfnature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/resin-javaee-4.0.16.jar
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/resin-javaee-4.0.16.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-3.0.0.CR1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-3.0.0.CR1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-api-3.0.0.CR1.jar
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/WebContent/WEB-INF/lib/seam-jms-api-3.0.0.CR1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java 2011-09-10 00:02:46 UTC (rev 34622)
@@ -0,0 +1,42 @@
+package org.jboss.tools.seam.jms.validation.test;
+
+import javax.inject.Inject;
+import javax.jms.Connection;
+import javax.jms.Queue;
+import javax.jms.QueueReceiver;
+import javax.jms.QueueSender;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicPublisher;
+import javax.jms.TopicSubscriber;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+
+public class JmsResourceInjection {
+
+ @Inject Queue broken;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") Connection cOk;
+ @Inject @MyQualifier Connection c1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") Session sOk;
+ @Inject @MyQualifier Session s1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") Topic tOk;
+ @Inject @MyQualifier Topic t1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") Queue qOk;
+ @Inject @MyQualifier Queue q1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") TopicPublisher tpOk;
+ @Inject @MyQualifier TopicPublisher tp1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") QueueSender qsOk;
+ @Inject @MyQualifier QueueSender qs1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") TopicSubscriber tsOk;
+ @Inject @MyQualifier TopicSubscriber ts1Ok;
+
+ @Inject @JmsDestination(jndiName = "/jms/Q") QueueReceiver qrOk;
+ @Inject @MyQualifier QueueReceiver qr1Ok;
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/MyQualifier.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/MyQualifier.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/MyQualifier.java 2011-09-10 00:02:46 UTC (rev 34622)
@@ -0,0 +1,24 @@
+package org.jboss.tools.seam.jms.validation.test;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+import org.jboss.seam.jms.annotations.JmsDestination;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Qualifier
+@Target({ TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@JmsDestination(jndiName = "/jms/Q")
+public @interface MyQualifier {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/projects/SeamCoreTest/src/org/jboss/tools/seam/jms/validation/test/MyQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java 2011-09-09 22:57:44 UTC (rev 34621)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/CDISeamCoreAllTests.java 2011-09-10 00:02:46 UTC (rev 34622)
@@ -17,6 +17,7 @@
import org.eclipse.wst.validation.ValidationFramework;
import org.jboss.tools.cdi.seam.core.test.international.BundleModelTest;
import org.jboss.tools.cdi.seam.core.test.international.SeamResourceBundlesTest;
+import org.jboss.tools.cdi.seam.core.test.jms.SeamJmsValidationTest;
import org.jboss.tools.cdi.seam.core.test.persistence.SeamPersistenceTest;
import org.jboss.tools.cdi.seam.core.test.persistence.SeamPersistenceTestSetup;
import org.jboss.tools.cdi.seam.core.test.servlet.SeamServletValidationTest;
@@ -41,6 +42,7 @@
suite.addTestSuite(SeamServletValidationTest.class);
suite.addTestSuite(SeamResourceBundlesTest.class);
suite.addTestSuite(BundleModelTest.class);
+ suite.addTestSuite(SeamJmsValidationTest.class);
suiteAll.addTest(new SeamCoreTestSetup(suite));
suite = new TestSuite("Seam Persistence Project Tests");
Added: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/SeamJmsValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/SeamJmsValidationTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/SeamJmsValidationTest.java 2011-09-10 00:02:46 UTC (rev 34622)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.cdi.seam.core.test.jms;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
+import org.jboss.tools.cdi.seam.core.test.international.SeamCoreTest;
+import org.jboss.tools.tests.AbstractResourceMarkerTest;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class SeamJmsValidationTest extends SeamCoreTest {
+
+ /**
+ * See https://issues.jboss.org/browse/JBIDE-9685
+ *
+ * @throws Exception
+ */
+ public void testJmsResourceInjection() throws Exception {
+ IFile file = getTestProject().getFile("src/org/jboss/tools/seam/jms/validation/test/JmsResourceInjection.java");
+ AbstractResourceMarkerTest.assertMarkerIsCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 17);
+ assertNoError(file, 19, 20, 22, 23, 25, 26, 28, 29, 31, 32, 34, 35, 37, 38, 40, 41);
+ }
+
+ private void assertNoError(IFile file, Integer... integers) throws Exception {
+ for (Integer integer : integers) {
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, integer);
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, integer);
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.seam.core.test/src/org/jboss/tools/cdi/seam/core/test/jms/SeamJmsValidationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
JBoss Tools SVN: r34621 - in trunk/cdi: tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-09-09 18:57:44 -0400 (Fri, 09 Sep 2011)
New Revision: 34621
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigInjectedPointHyperlink.java
trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/InjectedPointHyperlinkTest.java
Log:
JBIDE-9347
https://issues.jboss.org/browse/JBIDE-9347
Initial implementation of Assignable Beans dialog.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigInjectedPointHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigInjectedPointHyperlink.java 2011-09-09 22:57:11 UTC (rev 34620)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/SeamConfigInjectedPointHyperlink.java 2011-09-09 22:57:44 UTC (rev 34621)
@@ -10,29 +10,12 @@
******************************************************************************/
package org.jboss.tools.cdi.seam.text.ext.hyperlink;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.IProducerField;
-import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.internal.core.impl.AbstractBeanElement;
import org.jboss.tools.cdi.seam.config.core.definition.IConfigDefinition;
-import org.jboss.tools.cdi.seam.text.ext.CDISeamExtMessages;
-import org.jboss.tools.cdi.seam.text.ext.CDISeamExtPlugin;
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlink;
-import org.jboss.tools.common.editor.ObjectMultiPageEditor;
-import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
import org.jboss.tools.common.text.ITextSourceReference;
public class SeamConfigInjectedPointHyperlink extends InjectedPointHyperlink {
@@ -42,31 +25,7 @@
}
protected void doHyperlink(IRegion region) {
- IEditorPart part = null;
- ITextSourceReference source = ((AbstractBeanElement)bean).getDefinition().getOriginalDefinition();
- IFile resource = (IFile)source.getResource();
- IWorkbenchWindow window = CDISeamExtPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window == null) return;
- IWorkbenchPage page = window.getActivePage();
- try {
- part = IDE.openEditor(page, resource);
- } catch (PartInitException e) {
- CDISeamExtPlugin.log(e);
- }
- if(part instanceof EditorPartWrapper) {
- part = ((EditorPartWrapper)part).getEditor();
- }
- if(part instanceof ObjectMultiPageEditor) {
- ObjectMultiPageEditor mpe = (ObjectMultiPageEditor)part;
- ITextEditor textEditor = (ITextEditor)mpe.getAdapter(ITextEditor.class);
- if(textEditor != null) {
- mpe.setActiveEditor(textEditor);
- part = textEditor;
- }
- }
- if(part != null) {
- part.getEditorSite().getSelectionProvider().setSelection(new TextSelection(source.getStartPosition(), source.getLength()));
- }
+ bean.open();
}
@Override
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/InjectedPointHyperlinkTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/InjectedPointHyperlinkTest.java 2011-09-09 22:57:11 UTC (rev 34620)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/InjectedPointHyperlinkTest.java 2011-09-09 22:57:44 UTC (rev 34621)
@@ -6,6 +6,7 @@
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.seam.solder.core.test.SeamSolderTest;
import org.jboss.tools.cdi.text.ext.CDIExtensionsMessages;
+import org.jboss.tools.cdi.text.ext.hyperlink.AssignableBeansHyperlink;
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlink;
import org.jboss.tools.cdi.text.ext.hyperlink.InjectedPointHyperlinkDetector;
import org.jboss.tools.cdi.text.ext.test.CDIHyperlinkTestUtil;
@@ -22,27 +23,35 @@
ArrayList<TestRegion> regionList = new ArrayList<TestRegion>();
regionList.add(new TestRegion(/*97, 6*/"Inject", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.messageDispatcherProducer()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // Inject
regionList.add(new TestRegion(/*106, 7*/"Durable", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.messageDispatcherProducer()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // Logger
regionList.add(new TestRegion(/*115, 28*/"MessageDispatcher dispatcher", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.messageDispatcherProducer()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
regionList.add(new TestRegion(/*148, 6*/"Inject", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.getPolicy()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
regionList.add(new TestRegion(/*157, 7*/"Durable", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.getPolicy()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
regionList.add(new TestRegion(/*166, 23*/"DispatcherPolicy policy", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.getPolicy()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
regionList.add(new TestRegion(/*281, 31*/"Durable DispatcherPolicy policy", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.getPolicy()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
regionList.add(new TestRegion(/*318, 6*/"policy", new TestHyperlink[]{
new TestHyperlink(InjectedPointHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_OPEN_INJECT_BEAN+ " MessageManager.getPolicy()", bean),
+ new TestHyperlink(AssignableBeansHyperlink.class, CDIExtensionsMessages.CDI_INJECTED_POINT_HYPERLINK_SHOW_ASSIGNABLE)
})); // logger
CDIHyperlinkTestUtil.checkRegions(getTestProject(), "src/org/jboss/generic2/DurableMessageLogger.java", regionList, new InjectedPointHyperlinkDetector());
14 years, 7 months
JBoss Tools SVN: r34620 - trunk/common/plugins/org.jboss.tools.common.el.core/META-INF.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-09 18:57:11 -0400 (Fri, 09 Sep 2011)
New Revision: 34620
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
Log:
fixed META-INF
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2011-09-09 21:38:43 UTC (rev 34619)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2011-09-09 22:57:11 UTC (rev 34620)
@@ -26,6 +26,6 @@
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.jdt.core;bundle-version="3.7.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
- org.jboss.tools.common;bundle-version="3.3.0"
+ org.jboss.tools.common
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
14 years, 7 months
JBoss Tools SVN: r34619 - in trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common: meta/impl and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-09-09 17:38:43 -0400 (Fri, 09 Sep 2011)
New Revision: 34619
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/XModelMetaData.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XModelMetaDataImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
Log:
JBIDE-9111
https://issues.jboss.org/browse/JBIDE-9111
Fix for deadlock at stacktrace.txt
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/XModelMetaData.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/XModelMetaData.java 2011-09-09 21:13:37 UTC (rev 34618)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/XModelMetaData.java 2011-09-09 21:38:43 UTC (rev 34619)
@@ -12,6 +12,7 @@
import org.jboss.tools.common.meta.action.XActionList;
import org.jboss.tools.common.model.icons.XIconList;
+import org.jboss.tools.common.model.loaders.EntityRecognizer;
public interface XModelMetaData {
public String[] entities();
@@ -20,5 +21,6 @@
public XMapping getMapping(String name);
public XIconList getIconList();
public XParents getParentInfo();
+ public EntityRecognizer getEntityRecognizer();
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XModelMetaDataImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XModelMetaDataImpl.java 2011-09-09 21:13:37 UTC (rev 34618)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/meta/impl/XModelMetaDataImpl.java 2011-09-09 21:38:43 UTC (rev 34619)
@@ -22,6 +22,8 @@
import org.jboss.tools.common.meta.constraint.XAttributeConstraint;
import org.jboss.tools.common.meta.constraint.impl.XAttributeConstraintAList;
import org.jboss.tools.common.model.icons.impl.*;
+import org.jboss.tools.common.model.loaders.EntityRecognizer;
+import org.jboss.tools.common.model.loaders.impl.ModelEntityRecognizer;
public class XModelMetaDataImpl implements XModelMetaData, XMetaDataConstants {
private static XModelMetaDataImpl instance = null;
@@ -34,7 +36,9 @@
private XActionListImpl actions = new XActionListImpl();
private XExtensions extensions = new XExtensions();
private XParentsImpl parents = new XParentsImpl();
-
+
+ private ModelEntityRecognizer recognizer;
+
static Object lock = new Object();
public static XModelMetaData getInstance() {
@@ -67,8 +71,13 @@
long dt = - t + (t = System.currentTimeMillis());
ModelPlugin.getPluginLog().logInfo("Meta model loaded in " + dt + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
}
+ recognizer = new ModelEntityRecognizer(this);
}
+ public EntityRecognizer getEntityRecognizer() {
+ return recognizer;
+ }
+
private void makeStatistics(XModelEntity[] es) {
Set<String> attNames = new HashSet<String>();
Set<String> listValues = new HashSet<String>();
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2011-09-09 21:13:37 UTC (rev 34618)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/impl/XModelImpl.java 2011-09-09 21:38:43 UTC (rev 34619)
@@ -68,7 +68,6 @@
private XUndoManager undoer = new XUndoManager();
private static ServiceDialog service = null;
private static XModelBufferImpl buffer = new XModelBufferImpl();
- private static ModelEntityRecognizer recognizer = new ModelEntityRecognizer();
private XModelChangeManager changemanager = new XModelChangeManager();
private FileSystemPeer fileregistry = new FileSystemPeer();
private PrintWriter out = new PrintWriter(System.out, true);
@@ -78,7 +77,6 @@
public XModelImpl(Properties properties, XModelMetaData metadata) {
this.metadata = metadata;
this.properties = properties;
- recognizer.setMetaData(metadata);
if(properties.getProperty(XModelObjectConstants.PROP_ROOT_ENTITY) != null) {
rootEntity = properties.getProperty(XModelObjectConstants.PROP_ROOT_ENTITY);
}
@@ -122,7 +120,7 @@
}
public EntityRecognizer getEntityRecognizer() {
- return recognizer;
+ return metadata.getEntityRecognizer();
}
public XModelChangeManager getChangeManager() {
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2011-09-09 21:13:37 UTC (rev 34618)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/loaders/impl/ModelEntityRecognizer.java 2011-09-09 21:38:43 UTC (rev 34619)
@@ -17,20 +17,13 @@
import org.jboss.tools.common.model.util.ModelFeatureFactory;
public class ModelEntityRecognizer implements EntityRecognizer {
- private XModelMetaData meta = null;
private HashMap<String,EntityRecognizer[]> recognizers = new HashMap<String,EntityRecognizer[]>();
private Set<String> umbiguousExtensions = new HashSet<String>();
- public ModelEntityRecognizer() {}
-
- boolean loaded = false;
-
- public void setMetaData(XModelMetaData meta) {
- if(this.meta != null) return;
- this.meta = meta;
- load();
+ public ModelEntityRecognizer(XModelMetaData meta) {
+ load(meta);
}
-
+
public String getEntityName(EntityRecognizerContext context) {
String ext = context.getExtension();
if(ext != null) ext = ext.toLowerCase();
@@ -48,7 +41,7 @@
|| (context.getExtension() != null && umbiguousExtensions.contains(context.getExtension()));
}
- private void load() {
+ private void load(XModelMetaData meta) {
XMapping m = meta.getMapping("Recognizers"); //$NON-NLS-1$
if(m == null) return;
HashMap<String,RL> ext_list = new HashMap<String,RL>();
14 years, 7 months
JBoss Tools SVN: r34618 - in trunk: common/plugins/org.jboss.tools.common.el.core/META-INF and 11 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-09-09 17:13:37 -0400 (Fri, 09 Sep 2011)
New Revision: 34618
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java
Removed:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/MessagePropertyELSegmentImpl.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNatureExtension.java
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
trunk/common/plugins/org.jboss.tools.common.resref.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferencePlugin.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath
trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
Log:
refactored dependencies for dommon.el.core and common.resref.core
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.core/src/org/jboss/tools/cdi/seam/core/international/el/CDIInternationalMessagesELResolver.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -52,13 +52,13 @@
import org.jboss.tools.common.el.core.resolver.ELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.IRelevanceCheck;
import org.jboss.tools.common.el.core.resolver.IVariable;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.PositionHolder;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
+import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.jst.web.kb.internal.ResourceBundle;
/**
@@ -217,7 +217,7 @@
true); // is Final and equal names are because of
// we have no more to resolve the parts of expression,
// but we have to resolve arguments of probably a message component
- if (resolvedVariables != null && !resolvedVariables.isEmpty()) {
+ if (!resolvedVariables.isEmpty()) {
resolution.setLastResolvedToken(left);
ELSegmentImpl segment = new MessagePropertyELSegmentImpl(combineLexicalTokensForExpression(left));
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2011-09-09 21:13:37 UTC (rev 34618)
@@ -20,9 +20,12 @@
Require-Bundle: org.eclipse.jface.text;bundle-version="3.7.0",
org.eclipse.wst.sse.core;bundle-version="1.1.600",
org.eclipse.wst.sse.ui;bundle-version="1.3.0",
- org.jboss.tools.common.model,
org.jboss.tools.common.resref.core;visibility:=reexport,
org.eclipse.ui;bundle-version="3.7.0",
- org.eclipse.jdt.ui;bundle-version="3.7.0"
+ org.eclipse.jdt.ui;bundle-version="3.7.0",
+ org.eclipse.core.resources;bundle-version="3.7.100",
+ org.eclipse.jdt.core;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.jboss.tools.common;bundle-version="3.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: .
Deleted: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/MessagePropertyELSegmentImpl.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/MessagePropertyELSegmentImpl.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/MessagePropertyELSegmentImpl.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010-2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.el.core.resolver;
-
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.common.el.core.ElCoreMessages;
-import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
-import org.jboss.tools.common.el.core.parser.LexicalToken;
-import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.util.FindObjectHelper;
-import org.jboss.tools.common.text.ITextSourceReference;
-
-/**
- * @author Daniel Azarov
- */
-public class MessagePropertyELSegmentImpl extends ELSegmentImpl implements
- MessagePropertyELSegment {
-
- private IFile messageBundleResource = null;
- private ITextSourceReference messagePropertySourceReference = null;
- private int propertyStart=0, propertyLength=0;
- private String baseName=null;
- private boolean isBundle = false;
-
- private List<XModelObject> objects = new ArrayList<XModelObject>();
-
- public MessagePropertyELSegmentImpl(LexicalToken token) {
- super(token);
- }
-
- public IFile getMessageBundleResource() {
- return messageBundleResource;
- }
-
- public void setMessageBundleResource(IFile resource){
- messageBundleResource = resource;
- setResource(resource);
- }
-
- public void setBundleOnlySegment(boolean set) {
- isBundle = set;
- }
-
- public boolean isBundle() {
- return isBundle;
- }
-
- public boolean isProperty() {
- return !isBundle && (messagePropertySourceReference != null);
- }
-
- public ITextSourceReference getMessagePropertySourceReference() {
- if(messagePropertySourceReference==null) {
- messagePropertySourceReference = new ITextSourceReference() {
- public int getStartPosition() {
- return propertyStart;
- }
- public int getLength() {
- return propertyLength;
- }
- public IResource getResource() {
- return resource;
- }
- };
- }
- return messagePropertySourceReference;
- }
-
- public void setMessagePropertySourceReference(int start, int lenght) {
- propertyStart = start;
- propertyLength = lenght;
- }
-
- public String getBaseName(){
- return baseName;
- }
-
- public void setBaseName(String name){
- baseName = name;
- }
-
- public void addObject(XModelObject object) {
- objects.add(object);
- }
-
- public IOpenableReference[] getOpenable() {
- if(objects != null) {
- IOpenableReference[] result = new IOpenableReference[objects.size()];
- for (int i = 0; i < objects.size(); i++) {
- final XModelObject o = objects.get(i);
- result[i] = new IOpenableReference() {
- @Override
- public boolean open() {
- int q = FindObjectHelper.findModelObject(o, FindObjectHelper.IN_EDITOR_ONLY);
- return q < 1;
- }
-
- @Override
- public String getLabel() {
- XModelObject p = o;
- while(p != null && p.getFileType() < XModelObject.FILE) p = p.getParent();
-
- // Improve label - add a locale for a resource bundle
- String baseName = getBaseName();
- String propertyName = isBundle() ? null : AbstractELCompletionEngine.trimQuotes(getToken().getText());
- if (propertyName == null)
- return MessageFormat.format(ElCoreMessages.OpenBundle, baseName);
-
- return MessageFormat.format(ElCoreMessages.OpenBundleProperty, propertyName, baseName);
-
- //improve label - now it returns file name, with locale
-// return p.getAttributeValue("name");
- }
-
- @Override
- public Image getImage() {
- return null;
- }
- };
- }
- return result;
- }
- return super.getOpenable();
- }
-}
\ No newline at end of file
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -36,7 +36,7 @@
import org.jboss.tools.common.el.core.ELCorePlugin;
import org.jboss.tools.common.el.core.ca.preferences.ELContentAssistPreferences;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
-import org.jboss.tools.common.model.util.EclipseJavaUtil;
+import org.jboss.tools.common.util.EclipseJavaUtil;
import org.jboss.tools.common.util.BeanUtil;
/**
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNatureExtension.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNatureExtension.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/project/ModelNatureExtension.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -17,6 +17,14 @@
public ModelNatureExtension() {}
+ public ModelNatureExtension(String name, String displayName, String pathEncoder, String watcherContributor) {
+ super();
+ this.name = name;
+ this.displayName = displayName;
+ this.pathEncoder = pathEncoder;
+ this.watcherContributor = watcherContributor;
+ }
+
public String getName() {
return name;
}
@@ -33,21 +41,24 @@
return watcherContributor;
}
- static ModelNatureExtension[] INSTANCES;
+ private static final ModelNatureExtension[] INSTANCES;
- public static ModelNatureExtension[] getInstances() {
- if(INSTANCES != null) return INSTANCES;
+ static {
List<ModelNatureExtension> list = new ArrayList<ModelNatureExtension>();
IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
IConfigurationElement[] es = point.getConfigurationElements();
for (IConfigurationElement e: es) {
- ModelNatureExtension n = new ModelNatureExtension();
- n.name = e.getAttribute("name"); //$NON-NLS-1$
- n.displayName = e.getAttribute("displayName"); //$NON-NLS-1$
- n.pathEncoder = e.getAttribute("pathEncoder"); //$NON-NLS-1$
- n.watcherContributor = e.getAttribute("watcherContributor"); //$NON-NLS-1$
+ ModelNatureExtension n = new ModelNatureExtension(
+ e.getAttribute("name"), //$NON-NLS-1$
+ e.getAttribute("displayName"), //$NON-NLS-1$
+ e.getAttribute("pathEncoder"), //$NON-NLS-1$
+ e.getAttribute("watcherContributor")); //$NON-NLS-1$
list.add(n);
}
- return INSTANCES = list.toArray(new ModelNatureExtension[0]);
+ INSTANCES = list.toArray(new ModelNatureExtension[0]);
}
+
+ public static ModelNatureExtension[] getInstances() {
+ return INSTANCES;
+ }
}
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/util/EclipseResourceUtil.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -221,7 +221,7 @@
}
}
- private static String[] MODEL_NATURES = new String[0];
+ private static final String[] MODEL_NATURES;
static {
ModelNatureExtension[] es = ModelNatureExtension.getInstances();
@@ -1071,7 +1071,6 @@
}
public static boolean isJar(String path) {
- if(path == null) return false;
path = path.toLowerCase();
return path.endsWith(".jar") || path.endsWith(".zip"); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/common/plugins/org.jboss.tools.common.resref.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.resref.core/META-INF/MANIFEST.MF 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.resref.core/META-INF/MANIFEST.MF 2011-09-09 21:13:37 UTC (rev 34618)
@@ -6,7 +6,8 @@
Bundle-Activator: org.jboss.tools.common.resref.core.ResourceReferencePlugin
Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.core.runtime;bundle-version="3.7.0",
- org.jboss.tools.common.model
+ org.jboss.tools.common;bundle-version="3.3.0",
+ org.eclipse.core.resources;bundle-version="3.7.100"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.tools.common.resref.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferenceList.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -20,8 +20,6 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.osgi.service.prefs.BackingStoreException;
import org.osgi.service.prefs.Preferences;
@@ -151,11 +149,11 @@
//Fix for JBIDE-2979
private static String[] decodeResourceString(String resource) {
- String[] results = XModelObjectUtil.asStringArray(resource);
+ String[] results = resource.split("[,;]");
String[] returnValues = new String [results.length];
try {
for (int i=0;i<results.length;i++) {
- returnValues[i] = URLDecoder.decode(results[i], CODING);
+ returnValues[i] = URLDecoder.decode(results[i].trim(), CODING);
}
} catch (UnsupportedEncodingException e) {
ResourceReferencePlugin.getPluginLog().logError(e);
@@ -165,7 +163,6 @@
return returnValues;
}
-
public void setAllResources(IFile file, ResourceReference[] entries) {
IResource changed = null;
boolean b = setDeclaredResources(file, entries, ResourceReference.FILE_SCOPE, 0);
@@ -266,8 +263,7 @@
* https://jira.jboss.org/jira/browse/JBIDE-3211
* Reading global preferences from instance scope.
*/
- IScopeContext instanceContext = new InstanceScope();
- Preferences root = instanceContext.getNode(ModelPlugin.PLUGIN_ID);
+ Preferences root = InstanceScope.INSTANCE.getNode(ResourceReferencePlugin.PREFERENCES_QUALIFIER);
if (null != root) {
Preferences node = root.node(ResourceReferencePlugin.PLUGIN_ID);
s = node.get(getPropertyName().getLocalName(), ""); //$NON-NLS-1$
@@ -284,7 +280,7 @@
*/
String old = null;
try {
- old = ModelPlugin.getWorkspace().getRoot()
+ old =ResourcesPlugin.getWorkspace().getRoot()
.getPersistentProperty(getPropertyName());
} catch (CoreException e) {
/*
@@ -330,8 +326,8 @@
* ${workspace}\.metadata\.plugins\org.eclipse.core.runtime\
* .settings\org.jboss.tools.common.model.prefs
*/
- IScopeContext instanceContext = new InstanceScope();
- Preferences root = instanceContext.getNode(ModelPlugin.PLUGIN_ID);
+
+ Preferences root = InstanceScope.INSTANCE.getNode(ResourceReferencePlugin.PREFERENCES_QUALIFIER);
if (null != root) {
Preferences node = root.node(ResourceReferencePlugin.PLUGIN_ID);
node.put(getPropertyName().getLocalName(), sb.toString());
Modified: trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferencePlugin.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferencePlugin.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/common/plugins/org.jboss.tools.common.resref.core/src/org/jboss/tools/common/resref/core/ResourceReferencePlugin.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -11,6 +11,7 @@
// The plug-in ID
public static final String PLUGIN_ID = "org.jboss.tools.common.resref.core"; //$NON-NLS-1$
+ public static final String PREFERENCES_QUALIFIER = "org.jboss.tools.common.model"; //$NON-NLS-1$
// The shared instance
private static ResourceReferencePlugin plugin;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFMessageELCompletionEngine.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -40,7 +40,6 @@
import org.jboss.tools.common.el.core.resolver.ELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.IRelevanceCheck;
import org.jboss.tools.common.el.core.resolver.IVariable;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegmentImpl;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector.MemberInfo;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
@@ -55,6 +54,7 @@
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
Modified: trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -8,9 +8,9 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.jboss.tools.common.el.core.parser.LexicalToken;
-import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegmentImpl;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.el.refactoring.RenameMessagePropertyProcessor;
+import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
import org.jboss.tools.test.util.ProjectImportTestSetup;
import org.jboss.tools.tests.AbstractRefactorTest;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/.classpath 2011-09-09 21:13:37 UTC (rev 34618)
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="resources"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/.settings/org.eclipse.jdt.core.prefs 2011-09-09 21:13:37 UTC (rev 34618)
@@ -1,9 +1,9 @@
-#Fri May 15 15:20:06 MSD 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.source=1.5
+#Thu Sep 08 16:44:25 PDT 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.source=1.6
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-09-09 20:47:09 UTC (rev 34617)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-09-09 21:13:37 UTC (rev 34618)
@@ -30,7 +30,7 @@
org.eclipse.jst.j2ee;bundle-version="1.1.500",
org.jboss.tools.common.validation
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %providerName
Export-Package: org.jboss.tools.jst.web.kb,
org.jboss.tools.jst.web.kb.action,
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java (from rev 34585, trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/MessagePropertyELSegmentImpl.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java 2011-09-09 21:13:37 UTC (rev 34618)
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.el;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.el.core.ElCoreMessages;
+import org.jboss.tools.common.el.core.ca.AbstractELCompletionEngine;
+import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.resolver.ELSegmentImpl;
+import org.jboss.tools.common.el.core.resolver.IOpenableReference;
+import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.FindObjectHelper;
+import org.jboss.tools.common.text.ITextSourceReference;
+
+/**
+ * @author Daniel Azarov
+ */
+public class MessagePropertyELSegmentImpl extends ELSegmentImpl implements
+ MessagePropertyELSegment {
+
+ private IFile messageBundleResource = null;
+ private ITextSourceReference messagePropertySourceReference = null;
+ private int propertyStart=0, propertyLength=0;
+ private String baseName=null;
+ private boolean isBundle = false;
+
+ private List<XModelObject> objects = new ArrayList<XModelObject>();
+
+ public MessagePropertyELSegmentImpl(LexicalToken token) {
+ super(token);
+ }
+
+ public IFile getMessageBundleResource() {
+ return messageBundleResource;
+ }
+
+ public void setMessageBundleResource(IFile resource){
+ messageBundleResource = resource;
+ setResource(resource);
+ }
+
+ public void setBundleOnlySegment(boolean set) {
+ isBundle = set;
+ }
+
+ public boolean isBundle() {
+ return isBundle;
+ }
+
+ public boolean isProperty() {
+ return !isBundle && (messagePropertySourceReference != null);
+ }
+
+ public ITextSourceReference getMessagePropertySourceReference() {
+ if(messagePropertySourceReference==null) {
+ messagePropertySourceReference = new ITextSourceReference() {
+ public int getStartPosition() {
+ return propertyStart;
+ }
+ public int getLength() {
+ return propertyLength;
+ }
+ public IResource getResource() {
+ return resource;
+ }
+ };
+ }
+ return messagePropertySourceReference;
+ }
+
+ public void setMessagePropertySourceReference(int start, int lenght) {
+ propertyStart = start;
+ propertyLength = lenght;
+ }
+
+ public String getBaseName(){
+ return baseName;
+ }
+
+ public void setBaseName(String name){
+ baseName = name;
+ }
+
+ public void addObject(XModelObject object) {
+ objects.add(object);
+ }
+
+ public IOpenableReference[] getOpenable() {
+ if(objects != null) {
+ IOpenableReference[] result = new IOpenableReference[objects.size()];
+ for (int i = 0; i < objects.size(); i++) {
+ final XModelObject o = objects.get(i);
+ result[i] = new IOpenableReference() {
+ @Override
+ public boolean open() {
+ int q = FindObjectHelper.findModelObject(o, FindObjectHelper.IN_EDITOR_ONLY);
+ return q < 1;
+ }
+
+ @Override
+ public String getLabel() {
+ XModelObject p = o;
+ while(p != null && p.getFileType() < XModelObject.FILE) p = p.getParent();
+
+ // Improve label - add a locale for a resource bundle
+ String baseName = getBaseName();
+ String propertyName = isBundle() ? null : AbstractELCompletionEngine.trimQuotes(getToken().getText());
+ if (propertyName == null)
+ return MessageFormat.format(ElCoreMessages.OpenBundle, baseName);
+
+ return MessageFormat.format(ElCoreMessages.OpenBundleProperty, propertyName, baseName);
+
+ //improve label - now it returns file name, with locale
+// return p.getAttributeValue("name");
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+ };
+ }
+ return result;
+ }
+ return super.getOpenable();
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/el/MessagePropertyELSegmentImpl.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months