JBoss Tools SVN: r34647 - trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-12 16:39:14 -0400 (Mon, 12 Sep 2011)
New Revision: 34647
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.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.core.test/resources/tck/tests/jbt/core/TestInjection.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java 2011-09-12 20:35:27 UTC (rev 34646)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java 2011-09-12 20:39:14 UTC (rev 34647)
@@ -4,18 +4,20 @@
public class TestInjection {
- @Inject @TestQualifier Object i1; // has @TestQualifier
- @Inject @TestQualifier1 Object i2; // has @TestQualifier and @TestQualifier1
- @Inject @TestQualifier2 Object i3; // has @TestQualifier, @TestQualifier1 and @TestQualifier2
- @Inject @TestQualifier3 Object i4; // @TestQualifier3
+ @Inject @TestQualifier Test i1; // has @TestQualifier
+ @Inject @TestQualifier1 Test i2; // has @TestQualifier and @TestQualifier1
+ @Inject @TestQualifier2 Test i3; // has @TestQualifier, @TestQualifier1 and @TestQualifier2
+ @Inject @TestQualifier3 Test i4; // @TestQualifier3
- @Inject @TestQualifier3 @TestQualifier2 Object i5; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
- @Inject @TestQualifier2 @TestQualifier3 Object i6; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
- @Inject @TestQualifier Object i7;
+ @Inject @TestQualifier3 @TestQualifier2 Test i5; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier2 @TestQualifier3 Test i6; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier Test i7;
- @Inject @TestStereotype Object i8; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestStereotype Test i8; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
@Inject
- public void foo(@TestQualifier2 @TestQualifier3 Object i8) { // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ public void foo(@TestQualifier2 @TestQualifier3 Test i8) { // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
}
+
+ public static class Test {}
}
\ No newline at end of file
14 years, 7 months
JBoss Tools SVN: r34646 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-09-12 16:35:27 -0400 (Mon, 12 Sep 2011)
New Revision: 34646
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InitializerMethod.java
Removed:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/testmodel/CDIBean.java
Log:
JBIDE-9698
https://issues.jboss.org/browse/JBIDE-9698
Replaced InjectionPointMethod by InitializerMethod, and modified validation and tests.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -71,4 +71,10 @@
*/
IClassBean getSuperClassBean();
+ /**
+ * Obtains the initializer methods of the class bean.
+ *
+ * @return the initializer methods of the class bean
+ */
+ Set<IInitializerMethod> getInitializers();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import org.jboss.tools.common.java.IAnnotationDeclaration;
+
/**
* Represents an initializer method (a method annotated @Inject)
* Each parameter of this method is an injection point.
@@ -18,4 +20,10 @@
*/
public interface IInitializerMethod extends IBeanMethod {
+ /**
+ * Returns the @Inject annotation declaration
+ *
+ * @return the @Inject annotation declaration.
+ */
+ IAnnotationDeclaration getInjectAnnotation();
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -27,6 +27,7 @@
import org.jboss.tools.cdi.core.IBeanMethod;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInitializerMethod;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
@@ -85,7 +86,7 @@
if(m.getProducesAnnotation() != null) {
bm = newProducerMethod(m);
} else if(m.getInjectAnnotation() != null) {
- bm = new InjectionPointMethod();
+ bm = new InitializerMethod();
} else if(m.isObserver()) {
bm = new ObserverMethod();
} else {
@@ -293,6 +294,17 @@
return ((TypeDefinition)definition).getType();
}
+ @Override
+ public Set<IInitializerMethod> getInitializers() {
+ Set<IInitializerMethod> result = new HashSet<IInitializerMethod>();
+ for (BeanMethod m: methods) {
+ if(m instanceof IInitializerMethod) {
+ result.add((IInitializerMethod)m);
+ }
+ }
+ return result;
+ }
+
public Set<IInjectionPoint> getInjectionPoints() {
Set<IInjectionPoint> result = new HashSet<IInjectionPoint>();
for (BeanField f: fields) {
@@ -301,9 +313,9 @@
}
}
for (BeanMethod m: methods) {
- if(m instanceof IInjectionPoint) {
- result.add((IInjectionPoint)m);
- }
+// if(m instanceof IInjectionPoint) {
+// result.add((IInjectionPoint)m);
+// }
List<IParameter> ps = m.getParameters();
for (IParameter p: ps) {
if(p instanceof IInjectionPoint) {
Copied: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InitializerMethod.java (from rev 34642, trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java)
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InitializerMethod.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InitializerMethod.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.tools.cdi.internal.core.impl;
+
+import org.jboss.tools.cdi.core.IInitializerMethod;
+import org.jboss.tools.cdi.internal.core.impl.definition.ParameterDefinition;
+import org.jboss.tools.common.java.IAnnotationDeclaration;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class InitializerMethod extends BeanMethod implements
+ IInitializerMethod {
+
+ public IAnnotationDeclaration getDelegateAnnotation() {
+ return getDefinition().getDelegateAnnotation();
+ }
+
+ public boolean isDelegate() {
+ return getDelegateAnnotation() != null;
+ }
+
+ @Override
+ protected Parameter newParameter(ParameterDefinition p) {
+ return new InjectionPointParameter();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IInjectionPoint#getInjectAnnotation()
+ */
+ public IAnnotationDeclaration getInjectAnnotation() {
+ return inject;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.cdi.core.IInjectionPoint#containsDefaultQualifier()
+ */
+ public boolean hasDefaultQualifier() {
+ return false;//CDIUtil.containsDefaultQualifier(this);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InitializerMethod.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InjectionPointMethod.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -1,60 +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.tools.cdi.internal.core.impl;
-
-import org.jboss.tools.cdi.core.CDIUtil;
-import org.jboss.tools.cdi.core.IInjectionPointMethod;
-import org.jboss.tools.cdi.internal.core.impl.definition.ParameterDefinition;
-import org.jboss.tools.common.java.IAnnotationDeclaration;
-
-/**
- *
- * @author Viacheslav Kabanovich
- *
- */
-public class InjectionPointMethod extends BeanMethod implements
- IInjectionPointMethod {
-
- public IAnnotationDeclaration getDelegateAnnotation() {
- return getDefinition().getDelegateAnnotation();
- }
-
- public boolean isDelegate() {
- return getDelegateAnnotation() != null;
- }
-
- @Override
- protected Parameter newParameter(ParameterDefinition p) {
- return new InjectionPointParameter();
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.cdi.core.IInjectionPoint#getInjectAnnotation()
- */
- public IAnnotationDeclaration getInjectAnnotation() {
- return inject;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.cdi.core.IInjectionPoint#containsDefaultQualifier()
- */
- public boolean hasDefaultQualifier() {
- return CDIUtil.containsDefaultQualifier(this);
- }
-
- @Override
- public String getBeanName() {
- return null;
- }
-
-}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -60,6 +60,7 @@
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IDecorator;
+import org.jboss.tools.cdi.core.IInitializerMethod;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInjectionPointMethod;
@@ -697,6 +698,7 @@
}
private void validateClassBean(IClassBean bean) {
+ validateInitializers(bean);
validateDisposers(bean);
validateObserves(bean);
if (!(bean instanceof ISessionBean)) {
@@ -1458,6 +1460,43 @@
return false;
}
+ private void validateInitializers(IClassBean bean) {
+ Set<IInitializerMethod> initializers = bean.getInitializers();
+ for (IInitializerMethod initializer: initializers) {
+ try {
+ validateInitializerMethod(initializer);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private void validateInitializerMethod(IInitializerMethod initializer) {
+ IAnnotationDeclaration named = initializer.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
+ if (named != null) {
+ boolean valueExists = named.getMemberValue(null) != null;
+ if (!valueExists) {
+ addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named, initializer.getResource());
+ }
+ }
+
+ IAnnotationDeclaration declaration = initializer.getInjectAnnotation();
+ /*
+ * 3.9.1. Declaring an initializer method
+ * - generic method of a bean is annotated @Inject
+ */
+ if(CDIUtil.isMethodGeneric(initializer)) {
+ addError(CDIValidationMessages.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, declaration, initializer.getResource());
+ }
+ /*
+ * 3.9. Initializer methods
+ * - initializer method may not be static
+ */
+ if(CDIUtil.isMethodStatic(initializer)) {
+ addError(CDIValidationMessages.STATIC_METHOD_ANNOTATED_INJECT, CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, declaration, initializer.getResource());
+ }
+ }
+
private void validateInjectionPoint(IInjectionPoint injection) {
/*
* 3.11. The qualifier @Named at injection points
@@ -1475,31 +1514,6 @@
injection.getResource());
}
}
- } else if (injection instanceof IInjectionPointMethod) {
- IAnnotationDeclaration named = injection.getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
- if (named != null) {
- boolean valueExists = named.getMemberValue(null) != null;
- if (!valueExists) {
- addError(CDIValidationMessages.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, named, injection.getResource());
- }
- }
-
- IInjectionPointMethod injectionMethod = (IInjectionPointMethod)injection;
- IAnnotationDeclaration declaration = injection.getInjectAnnotation();
- /*
- * 3.9.1. Declaring an initializer method
- * - generic method of a bean is annotated @Inject
- */
- if(CDIUtil.isMethodGeneric(injectionMethod)) {
- addError(CDIValidationMessages.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, declaration, injection.getResource());
- }
- /*
- * 3.9. Initializer methods
- * - initializer method may not be static
- */
- if(CDIUtil.isMethodStatic(injectionMethod)) {
- addError(CDIValidationMessages.STATIC_METHOD_ANNOTATED_INJECT, CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, declaration, injection.getResource());
- }
}
IAnnotationDeclaration declaration = injection.getInjectAnnotation();
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -16,6 +16,7 @@
import org.eclipse.jdt.core.IMethod;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInitializerMethod;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointField;
import org.jboss.tools.cdi.core.IInjectionPointMethod;
@@ -125,18 +126,12 @@
}
}
assertNotNull(cb);
- Set<IInjectionPoint> ps = cb.getInjectionPoints();
- IInjectionPointMethod mp = null;
- for (IInjectionPoint p: ps) {
- if(p instanceof IInjectionPointMethod) {
- mp = (IInjectionPointMethod)p;
- }
- }
+ Set<IInitializerMethod> ps = cb.getInitializers();
+ IInitializerMethod mp = ps.isEmpty() ? null : ps.iterator().next();
assertNotNull(mp);
assertEquals("foo", mp.getMethod().getElementName());
//no exception should happen on invoking resolveObserverMethods
- cdiProject.resolveObserverMethods(mp);
-
+// cdiProject.resolveObserverMethods(mp); not applicable to initializer method
}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/testmodel/CDIBean.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/testmodel/CDIBean.java 2011-09-12 20:03:10 UTC (rev 34645)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/testmodel/CDIBean.java 2011-09-12 20:35:27 UTC (rev 34646)
@@ -13,6 +13,7 @@
import org.jboss.tools.cdi.core.IBeanMethod;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInitializerMethod;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInterceptorBinding;
import org.jboss.tools.cdi.core.IInterceptorBindingDeclaration;
@@ -276,4 +277,10 @@
// TODO Auto-generated method stub
}
+
+ @Override
+ public Set<IInitializerMethod> getInitializers() {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
\ No newline at end of file
14 years, 7 months
JBoss Tools SVN: r34645 - workspace/snjeza/discovery.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-09-12 16:03:10 -0400 (Mon, 12 Sep 2011)
New Revision: 34645
Modified:
workspace/snjeza/discovery/org.jboss.tools.central.discovery_3.3.0.jar
Log:
Modified: workspace/snjeza/discovery/org.jboss.tools.central.discovery_3.3.0.jar
===================================================================
(Binary files differ)
14 years, 7 months
JBoss Tools SVN: r34644 - workspace/snjeza/discovery.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-09-12 15:56:57 -0400 (Mon, 12 Sep 2011)
New Revision: 34644
Added:
workspace/snjeza/discovery/.project
Modified:
workspace/snjeza/discovery/org.jboss.tools.central.discovery_3.3.0.jar
Log:
Added: workspace/snjeza/discovery/.project
===================================================================
--- workspace/snjeza/discovery/.project (rev 0)
+++ workspace/snjeza/discovery/.project 2011-09-12 19:56:57 UTC (rev 34644)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>discovery</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
Modified: workspace/snjeza/discovery/org.jboss.tools.central.discovery_3.3.0.jar
===================================================================
(Binary files differ)
14 years, 7 months
JBoss Tools SVN: r34643 - in trunk/cdi/tests/org.jboss.tools.cdi.core.test: resources/tck/tests/jbt/core and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-12 15:49:42 -0400 (Mon, 12 Sep 2011)
New Revision: 34643
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
Log:
https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be aware of JMS resource injections
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import javax.inject.Inject;
+
+public class TestInjection {
+
+ @Inject @TestQualifier Object i1; // has @TestQualifier
+ @Inject @TestQualifier1 Object i2; // has @TestQualifier and @TestQualifier1
+ @Inject @TestQualifier2 Object i3; // has @TestQualifier, @TestQualifier1 and @TestQualifier2
+ @Inject @TestQualifier3 Object i4; // @TestQualifier3
+
+ @Inject @TestQualifier3 @TestQualifier2 Object i5; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier2 @TestQualifier3 Object i6; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ @Inject @TestQualifier Object i7;
+
+ @Inject @TestStereotype Object i8; // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+
+ @Inject
+ public void foo(@TestQualifier2 @TestQualifier3 Object i8) { // has @TestQualifier, @TestQualifier1, @TestQualifier2 and @TestQualifier3
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestInjection.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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
+public @interface TestQualifier {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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
+@TestQualifier
+public @interface TestQualifier1 {
+
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier1.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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
+@TestQualifier1
+public @interface TestQualifier2 {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier2.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+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
+public @interface TestQualifier3 {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestQualifier3.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,22 @@
+package org.jboss.jsr299.tck.tests.jbt.test.core;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Stereotype;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Stereotype
+@Target({ TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@TestQualifier3
+@TestQualifier2
+public @interface TestStereotype {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/core/TestStereotype.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java 2011-09-12 19:49:42 UTC (rev 34643)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.core.test.tck;
+
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIUtil;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IInjectionPointMethod;
+import org.jboss.tools.common.java.IAnnotationDeclaration;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class CDIUtilTest extends TCKTest {
+
+ /**
+ * See https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be aware of JMS resource injections
+ */
+ public void testMethodParameter() {
+ IClassBean bean = getClassBean("JavaSource/org/jboss/jsr299/tck/tests/jbt/core/TestInjection.java");
+ assertNotNull("Can't find the bean.", bean);
+ Set<IInjectionPoint> injections = bean.getInjectionPoints();
+ for (IInjectionPoint injectionPoint : injections) {
+ if(injectionPoint instanceof IInjectionPointMethod) { // TODO Remove this check when https://issues.jboss.org/browse/JBIDE-9698 (Replace interface IInjectionPointMethod by IInitializerMethod) is fixed
+ continue;
+ }
+ IAnnotationDeclaration declaration = CDIUtil.getAnnotationDeclaration(injectionPoint, "org.jboss.jsr299.tck.tests.jbt.test.core.TestQualifier");
+ String elementName = injectionPoint.getSourceMember().getElementName();
+ if(elementName.equals("i4")) {
+ assertNull(declaration);
+ } else {
+ assertNotNull(declaration);
+ }
+ declaration = CDIUtil.getAnnotationDeclaration(injectionPoint, "org.jboss.jsr299.tck.tests.jbt.test.core.TestQualifier3");
+ if(elementName.equals("i1") || elementName.equals("i2") || elementName.equals("i3")) {
+ assertNull(declaration);
+ } else {
+ assertNotNull(declaration);
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/CDIUtilTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
JBoss Tools SVN: r34642 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-12 15:37:18 -0400 (Mon, 12 Sep 2011)
New Revision: 34642
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java
Log:
https://issues.jboss.org/browse/JBIDE-9698 Replace interface IInjectionPointMethod by IInitializerMethod
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java 2011-09-12 19:37:18 UTC (rev 34642)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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.core;
+
+/**
+ * Represents an initializer method (a method annotated @Inject)
+ * Each parameter of this method is an injection point.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IInitializerMethod extends IBeanMethod {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInitializerMethod.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 7 months
JBoss Tools SVN: r34640 - trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-09-12 13:06:18 -0400 (Mon, 12 Sep 2011)
New Revision: 34640
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java
Log:
Remove forgotten debug message.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java 2011-09-12 16:39:04 UTC (rev 34639)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.bot.test/src/org/jboss/tools/vpe/ui/bot/test/editor/VisualEditorContextMenuTest.java 2011-09-12 17:06:18 UTC (rev 34640)
@@ -474,7 +474,6 @@
bot.sleep(Timing.time2S());
webBrowser.setFocus();
// Test Cut
- System.out.println(1);
calendarNode = webBrowser.getDomNodeByTagName("INPUT",0);
bot.sleep(Timing.time2S());
webBrowser.selectDomNode(calendarNode,0);
14 years, 7 months
JBoss Tools SVN: r34639 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-09-12 12:39:04 -0400 (Mon, 12 Sep 2011)
New Revision: 34639
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
Log:
https://issues.jboss.org/browse/JBIDE-9685 Seam JMS: CDI validator should be aware of JMS resource injections
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-09-12 15:06:25 UTC (rev 34638)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2011-09-12 16:39:04 UTC (rev 34639)
@@ -412,7 +412,10 @@
return declaration;
}
if(type instanceof IAnnotated) {
- return getAnnotationDeclaration((IAnnotated)type, annotationTypeName);
+ IAnnotationDeclaration decl = getAnnotationDeclaration((IAnnotated)type, annotationTypeName);
+ if(decl!=null) {
+ return decl;
+ }
}
}
}
14 years, 7 months
JBoss Tools SVN: r34638 - in trunk/as/plugins: org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-12 11:06:25 -0400 (Mon, 12 Sep 2011)
New Revision: 34638
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.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.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
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] implement start & stop application
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/Application.java 2011-09-12 15:06:25 UTC (rev 34638)
@@ -15,10 +15,12 @@
private String name;
private Cartridge cartridge;
+ private IOpenshiftService service;
- public Application(String name, Cartridge cartridge) {
+ public Application(String name, Cartridge cartridge, IOpenshiftService service) {
this.name = name;
this.cartridge = cartridge;
+ this.service = service;
}
public String getName() {
@@ -29,4 +31,16 @@
return cartridge;
}
+ public void destroy() throws OpenshiftException {
+ service.destroyApplication(name, cartridge);
+ }
+
+ public void start() throws OpenshiftException {
+ service.startApplication(name, cartridge);
+ }
+
+ public void stop() throws OpenshiftException {
+ service.stopApplication(name, cartridge);
+ }
+
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/core/IOpenshiftService.java 2011-09-12 15:06:25 UTC (rev 34638)
@@ -25,6 +25,12 @@
public Application destroyApplication(String name, Cartridge cartridge) throws OpenshiftException;
+ public Application startApplication(String name, Cartridge cartridge) throws OpenshiftException;
+
+ public Application stopApplication(String name, Cartridge cartridge) throws OpenshiftException;
+
+ public Domain changeDomain(String domainName, SSHKey sshKey) throws OpenshiftException;
+
public Domain createDomain(String name, SSHKey keyPair) throws OpenshiftException;
public SSHKey createKey(String passPhrase, String privateKeyPath, String publicKeyPath) throws OpenshiftException;
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-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/OpenshiftService.java 2011-09-12 15:06:25 UTC (rev 34638)
@@ -34,6 +34,7 @@
import org.jboss.ide.eclipse.as.openshift.internal.core.request.AbstractDomainRequest;
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.ChangeDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.CreateDomainRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.ListCartridgesRequest;
import org.jboss.ide.eclipse.as.openshift.internal.core.request.OpenshiftJsonRequestFactory;
@@ -117,6 +118,11 @@
return requestDomainAction(new CreateDomainRequest(name, sshKey, username, true));
}
+ @Override
+ public Domain changeDomain(String newName, SSHKey sshKey) throws OpenshiftException {
+ return requestDomainAction(new ChangeDomainRequest(newName, sshKey, username, true));
+ }
+
protected Domain requestDomainAction(AbstractDomainRequest request) throws OpenshiftException {
String url = request.getUrlString(BASE_URL);
try {
@@ -149,6 +155,18 @@
new ApplicationRequest(name, cartridge, ApplicationAction.DECONFIGURE, username, true));
}
+ @Override
+ public Application startApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(name, cartridge,
+ new ApplicationRequest(name, cartridge, ApplicationAction.START, username, true));
+ }
+
+ @Override
+ public Application stopApplication(String name, Cartridge cartridge) throws OpenshiftException {
+ return requestApplicationAction(name, cartridge,
+ new ApplicationRequest(name, cartridge, ApplicationAction.STOP, username, true));
+ }
+
protected Application requestApplicationAction(String name, Cartridge cartridge,
ApplicationRequest applicationRequest) throws OpenshiftException {
String url = applicationRequest.getUrlString(BASE_URL);
@@ -160,7 +178,7 @@
response = JsonSanitizer.sanitize(response);
OpenshiftResponse<Application> openshiftResponse =
- new ApplicationResponseUnmarshaller(name, cartridge).unmarshall(response);
+ new ApplicationResponseUnmarshaller(name, cartridge, this).unmarshall(response);
return openshiftResponse.getData();
} catch (MalformedURLException e) {
throw new OpenshiftException(
@@ -181,5 +199,4 @@
private IHttpClient createHttpClient(String url) throws MalformedURLException {
return new UrlConnectionHttpClient(new URL(url));
}
-
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/src/org/jboss/ide/eclipse/as/openshift/internal/core/response/ApplicationResponseUnmarshaller.java 2011-09-12 15:06:25 UTC (rev 34638)
@@ -13,6 +13,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.openshift.core.Application;
import org.jboss.ide.eclipse.as.openshift.core.Cartridge;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
/**
* @author André Dietisheim
@@ -21,14 +22,16 @@
private String applicationName;
private Cartridge cartridge;
+ private IOpenshiftService service;
- public ApplicationResponseUnmarshaller(String applicationName, Cartridge cartridge) {
+ public ApplicationResponseUnmarshaller(String applicationName, Cartridge cartridge, IOpenshiftService service) {
this.applicationName = applicationName;
this.cartridge = cartridge;
+ this.service = service;
}
@Override
protected Application createOpenshiftObject(ModelNode node) {
- return new Application(applicationName, cartridge);
+ return new Application(applicationName, cartridge, service);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-12 14:17:02 UTC (rev 34637)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/internal/test/core/ApplicationIntegrationTest.java 2011-09-12 15:06:25 UTC (rev 34638)
@@ -68,10 +68,37 @@
@Test(expected = OpenshiftException.class)
public void createDuplicateApplicationThrowsException() throws Exception {
String applicationName = createRandomApplicationName();
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
- openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
}
+ @Test
+ public void canStopApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
+ @Test
+ public void canStartStoppedApplication() throws Exception {
+ String applicationName = createRandomApplicationName();
+ try {
+ openshiftService.createApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.stopApplication(applicationName, Cartridge.JBOSSAS_7);
+ openshiftService.startApplication(applicationName, Cartridge.JBOSSAS_7);
+ } finally {
+ silentlyDestroyApplication(applicationName, openshiftService);
+ }
+ }
+
private String createRandomApplicationName() {
return String.valueOf(System.currentTimeMillis());
}
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-12 14:17:02 UTC (rev 34637)
+++ 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 15:06:25 UTC (rev 34638)
@@ -25,7 +25,7 @@
private OpenshiftService openshiftService;
- private static final String USERNAME = "openshift.only.domain(a)gmail.com";
+ private static final String USERNAME = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
@Before
@@ -48,6 +48,21 @@
assertNotNull(user.getUuid());
}
+ @Test
+ public void canChangeDomain() throws Exception {
+
+ String domainName = createRandomString();
+ SSHKey sshKey = TestSSHKey.create();
+ Domain domain = openshiftService.changeDomain(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());
}
14 years, 7 months