JBoss Tools SVN: r29719 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-11 17:30:13 -0500 (Fri, 11 Mar 2011)
New Revision: 29719
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
Log:
JBIDE-8515
https://issues.jboss.org/browse/JBIDE-8515
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-03-11 22:25:12 UTC (rev 29718)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/wizard/NewCDIWizardTest.java 2011-03-11 22:30:13 UTC (rev 29719)
@@ -404,6 +404,14 @@
page.setBeanName("myNewBean");
+ page.setScope(CDIConstants.SESSION_SCOPED_ANNOTATION_TYPE_NAME);
+ String message = page.getMessage();
+ assertEquals(CDIUIMessages.MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE, message);
+ assertEquals(IMessageProvider.WARNING, page.getMessageType());
+
+ page.setScope(CDIConstants.APPLICATION_SCOPED_ANNOTATION_TYPE_NAME);
+ assertEquals(IMessageProvider.NONE, page.getMessageType());
+
context.wizard.performFinish();
String text = context.getNewTypeContent();
@@ -416,9 +424,9 @@
int f = type.getFlags();
assertTrue(Modifier.isPublic(f));
assertFalse(Modifier.isAbstract(f));
- String[] is = type.getSuperInterfaceNames();
- assertEquals(1, is.length);
- assertEquals("Serializable", is[0]);
+// String[] is = type.getSuperInterfaceNames();
+// assertEquals(1, is.length);
+// assertEquals("Serializable", is[0]);
} finally {
context.close();
}
13 years, 10 months
JBoss Tools SVN: r29718 - in branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-11 17:25:12 -0500 (Fri, 11 Mar 2011)
New Revision: 29718
Modified:
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
Log:
JBIDE-8515
https://issues.jboss.org/browse/JBIDE-8515
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 22:15:59 UTC (rev 29717)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 22:25:12 UTC (rev 29718)
@@ -82,6 +82,8 @@
public static String MESSAGE_QUALIFIER_NOT_SET;
+ public static String MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE;
+
public static String MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE;
public static String MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE;
public static String MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE;
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 22:15:59 UTC (rev 29717)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 22:25:12 UTC (rev 29718)
@@ -66,6 +66,8 @@
MESSAGE_QUALIFIER_NOT_SET=Qualifier is not set
+MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE=Bean with selected scope should implement java.io.Serializable.
+
MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' field static
MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' method public
MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE=Add ''{0}'' method to ''{1}'' interface
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2011-03-11 22:15:59 UTC (rev 29717)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2011-03-11 22:25:12 UTC (rev 29718)
@@ -55,9 +55,11 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUiImages;
import org.jboss.tools.common.ui.widget.editor.CheckBoxFieldEditor;
@@ -128,7 +130,7 @@
interfacesNames.add(name);
setDefaultTypeName(name);
}
- interfacesNames.add("java.io.Serializable");
+// interfacesNames.add("java.io.Serializable");
setSuperInterfaces(interfacesNames, true);
superInterfacesChanged();
}
@@ -394,9 +396,63 @@
ArrayList<String> values = new ArrayList<String>();
values.add("");
scope = createComboField("Scope", CDIUIMessages.FIELD_EDITOR_SCOPE_LABEL, composite, values);
+ scope.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ onScopeModified();
+ }
+ });
setScopes(getPackageFragmentRoot());
}
+ void onScopeModified() {
+ fSuperInterfacesStatus = superInterfacesChanged();
+ doStatusUpdate();
+ }
+
+ protected IStatus superInterfacesChanged() {
+ StatusInfo result = (StatusInfo)super.superClassChanged();
+ if(!checkScopeAndSerializable())
+ if (!result.isError() && !result.isWarning() && !checkScopeAndSerializable()) {
+ result.setWarning(CDIUIMessages.MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE);
+ }
+
+ return result;
+ }
+
+ boolean checkScopeAndSerializable() {
+ if(scope == null) return true;
+ IJavaProject jp = getJavaProject();
+ if(jp == null) return true;
+ boolean isPassivating = false;
+ String scopeName = scope.getValueAsString();
+ String qScopeName = scopes.get(scopeName);
+ if(CDIConstants.SESSION_SCOPED_ANNOTATION_TYPE_NAME.equals(qScopeName)) {
+ isPassivating = true;
+ } else {
+ ICDIProject cdi = NewCDIAnnotationWizardPage.getCDIProject(jp);
+ if(cdi != null) {
+ IScope s = cdi.getScope(qScopeName);
+ if(s != null && s.isNorlmalScope() && cdi.isPassivatingScope(s.getSourceType())) {
+ isPassivating = true;
+ }
+ }
+ }
+ if(isPassivating) {
+ boolean result = false;
+ List list = getSuperInterfaces();
+ if(list != null) {
+ for (int i = 0; i < list.size() && !result; i++) {
+ if("java.io.Serializable".equals(list.get(i).toString())) {
+ result = true;
+ }
+ }
+ }
+ return result;
+ }
+ return true;
+ }
+
+
protected ITaggedFieldEditor createComboField(String name, String label, Composite composite, List<String> values) {
ITaggedFieldEditor result = IFieldEditorFactory.INSTANCE.createComboEditor(name, label, values, values.get(0));
((CompositeEditor)result).addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name, "")});
@@ -409,5 +465,16 @@
return result;
}
+ public void setScope(String qScopeName) {
+ String[] tags = scope.getTags();
+ for (String t: tags) {
+ String n = scopes.get(t);
+ if(qScopeName.equals(n)) {
+ scope.setValue(t);
+ doStatusUpdate();
+ return;
+ }
+ }
+ }
}
\ No newline at end of file
13 years, 10 months
JBoss Tools SVN: r29717 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-11 17:15:59 -0500 (Fri, 11 Mar 2011)
New Revision: 29717
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
Log:
JBIDE-8515
https://issues.jboss.org/browse/JBIDE-8515
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 22:12:12 UTC (rev 29716)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 22:15:59 UTC (rev 29717)
@@ -82,6 +82,8 @@
public static String MESSAGE_QUALIFIER_NOT_SET;
+ public static String MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE;
+
public static String MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE;
public static String MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE;
public static String MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 22:12:12 UTC (rev 29716)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 22:15:59 UTC (rev 29717)
@@ -66,6 +66,8 @@
MESSAGE_QUALIFIER_NOT_SET=Qualifier is not set
+MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE=Bean with selected scope should implement java.io.Serializable.
+
MAKE_FIELD_STATIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' field static
MAKE_METHOD_PUBLIC_MARKER_RESOLUTION_TITLE=Make ''{0}'' method public
MAKE_METHOD_BUSINESS_MARKER_RESOLUTION_TITLE=Add ''{0}'' method to ''{1}'' interface
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2011-03-11 22:12:12 UTC (rev 29716)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/wizard/NewBeanWizardPage.java 2011-03-11 22:15:59 UTC (rev 29717)
@@ -55,9 +55,11 @@
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.IAnnotationDeclaration;
import org.jboss.tools.cdi.core.ICDIAnnotation;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IQualifier;
+import org.jboss.tools.cdi.core.IScope;
import org.jboss.tools.cdi.ui.CDIUIMessages;
import org.jboss.tools.cdi.ui.CDIUiImages;
import org.jboss.tools.common.ui.widget.editor.CheckBoxFieldEditor;
@@ -137,7 +139,7 @@
interfacesNames.add(name);
setDefaultTypeName(name);
}
- interfacesNames.add("java.io.Serializable");
+// interfacesNames.add("java.io.Serializable");
setSuperInterfaces(interfacesNames, true);
superInterfacesChanged();
}
@@ -432,9 +434,63 @@
ArrayList<String> values = new ArrayList<String>();
values.add("");
scope = createComboField("Scope", CDIUIMessages.FIELD_EDITOR_SCOPE_LABEL, composite, values);
+ scope.addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ onScopeModified();
+ }
+ });
setScopes(getPackageFragmentRoot());
}
+ void onScopeModified() {
+ fSuperInterfacesStatus = superInterfacesChanged();
+ doStatusUpdate();
+ }
+
+ protected IStatus superInterfacesChanged() {
+ StatusInfo result = (StatusInfo)super.superClassChanged();
+ if(!checkScopeAndSerializable())
+ if (!result.isError() && !result.isWarning() && !checkScopeAndSerializable()) {
+ result.setWarning(CDIUIMessages.MESSAGE_BEAN_SHOULD_BE_SERIALIZABLE);
+ }
+
+ return result;
+ }
+
+ boolean checkScopeAndSerializable() {
+ if(scope == null) return true;
+ IJavaProject jp = getJavaProject();
+ if(jp == null) return true;
+ boolean isPassivating = false;
+ String scopeName = scope.getValueAsString();
+ String qScopeName = scopes.get(scopeName);
+ if(CDIConstants.SESSION_SCOPED_ANNOTATION_TYPE_NAME.equals(qScopeName)) {
+ isPassivating = true;
+ } else {
+ ICDIProject cdi = NewCDIAnnotationWizardPage.getCDIProject(jp);
+ if(cdi != null) {
+ IScope s = cdi.getScope(qScopeName);
+ if(s != null && s.isNorlmalScope() && cdi.isPassivatingScope(s.getSourceType())) {
+ isPassivating = true;
+ }
+ }
+ }
+ if(isPassivating) {
+ boolean result = false;
+ List list = getSuperInterfaces();
+ if(list != null) {
+ for (int i = 0; i < list.size() && !result; i++) {
+ if("java.io.Serializable".equals(list.get(i).toString())) {
+ result = true;
+ }
+ }
+ }
+ return result;
+ }
+ return true;
+ }
+
+
protected ITaggedFieldEditor createComboField(String name, String label, Composite composite, List<String> values) {
ITaggedFieldEditor result = IFieldEditorFactory.INSTANCE.createComboEditor(name, label, values, values.get(0));
((CompositeEditor)result).addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name, "")});
@@ -462,4 +518,16 @@
return false;
}
+ public void setScope(String qScopeName) {
+ String[] tags = scope.getTags();
+ for (String t: tags) {
+ String n = scopes.get(t);
+ if(qScopeName.equals(n)) {
+ scope.setValue(t);
+ doStatusUpdate();
+ return;
+ }
+ }
+ }
+
}
13 years, 10 months
JBoss Tools SVN: r29716 - branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-11 17:12:12 -0500 (Fri, 11 Mar 2011)
New Revision: 29716
Modified:
branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
JBIDE-8515
https://issues.jboss.org/browse/JBIDE-8515
Modified: branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-03-11 22:09:24 UTC (rev 29715)
+++ branches/jbosstools-3.2.x/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-03-11 22:12:12 UTC (rev 29716)
@@ -742,7 +742,7 @@
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
- return true;
+ return false;
}
}
}
13 years, 10 months
JBoss Tools SVN: r29715 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-03-11 17:09:24 -0500 (Fri, 11 Mar 2011)
New Revision: 29715
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
Log:
JBIDE-8515
https://issues.jboss.org/browse/JBIDE-8515
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-03-11 21:39:17 UTC (rev 29714)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2011-03-11 22:09:24 UTC (rev 29715)
@@ -744,7 +744,7 @@
} catch (JavaModelException e) {
CDICorePlugin.getDefault().logError(e);
}
- return true;
+ return false;
}
}
}
13 years, 10 months
JBoss Tools SVN: r29714 - in trunk/cdi/tests: org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-03-11 16:39:17 -0500 (Fri, 11 Mar 2011)
New Revision: 29714
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.qfxresult
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
Log:
https://issues.jboss.org/browse/JBIDE-8550
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.java (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.java 2011-03-11 21:39:17 UTC (rev 29714)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.enterprise.context.SessionScoped;
+
+
+@SessionScoped
+class Hamina_Broken
+{
+}
Property changes on: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.qfxresult
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.qfxresult (rev 0)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/Hamina_Broken.qfxresult 2011-03-11 21:39:17 UTC (rev 29714)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.enterprise.context.SessionScoped;
+import java.io.Serializable;
+
+
+@SessionScoped
+class Hamina_Broken implements Serializable
+{
+}
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-03-11 21:13:04 UTC (rev 29713)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-03-11 21:39:17 UTC (rev 29714)
@@ -33,6 +33,7 @@
import org.jboss.tools.cdi.core.test.tck.validation.ValidationTest;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationErrorManager;
import org.jboss.tools.cdi.ui.marker.AddLocalBeanMarkerResolution;
+import org.jboss.tools.cdi.ui.marker.AddSerializableInterfaceMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllDisposerDuplicantMarkerResolution;
import org.jboss.tools.cdi.ui.marker.DeleteAllInjectedConstructorsMarkerResolution;
import org.jboss.tools.cdi.ui.marker.MakeFieldStaticMarkerResolution;
@@ -75,7 +76,6 @@
int messageId = attribute.intValue();
if(messageId == id){
String text = (String)marker.getAttribute(IMarker.MESSAGE,"none");
- System.out.println("Before quick fix: "+text);
IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry()
.getResolutions(marker);
@@ -119,7 +119,7 @@
}
}
- //rootChange.perform(new NullProgressMonitor());
+ rootChange.perform(new NullProgressMonitor());
}else if(resolution instanceof TestableResolutionWithSelectionWizard){
((TestableResolutionWithSelectionWizard)resolution).selectFirstElementAndRun(marker);
}else{
@@ -130,20 +130,9 @@
IMarker[] newMarkers = file.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
- System.out.println("Before: "+markers.length+" after: "+newMarkers.length);
-
-
-
- for(IMarker m : newMarkers){
- text = (String)m.getAttribute(IMarker.MESSAGE,"none");
- System.out.println("After quick fix: "+text);
- }
-
assertTrue("Marker resolution did not decrease number of problems. was: "+markers.length+" now: "+newMarkers.length, newMarkers.length < markers.length);
checkResults(project, fileNames, results);
-
-
return;
}
}
@@ -402,7 +391,6 @@
}
public void testSpecifyBeanWhenMultipleBeansAreEligibleForInjectedFieldResolution() throws CoreException {
- System.out.println("testSpecifyBeanWhenMultipleBeansAreEligibleForInjectedFieldResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken1.java",
@@ -417,7 +405,6 @@
}
public void testSelectBeanWhenMultipleBeansAreEligibleForInjectedFieldResolution() throws CoreException {
- System.out.println("testSelectBeanWhenMultipleBeansAreEligibleForInjectedFieldResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken1.java",
@@ -437,7 +424,6 @@
}
public void testSpecifyBeanWhenNoBeanIsEligibleForInjectedFieldResolution() throws CoreException {
- System.out.println("testSpecifyBeanWhenNoBeanIsEligibleForInjectedFieldResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken2.java",
@@ -452,7 +438,6 @@
}
public void testSelectBeanWhenNoBeanIsEligibleForInjectedFieldResolution() throws CoreException {
- System.out.println("testSelectBeanWhenNoBeanIsEligibleForInjectedFieldResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken2.java",
@@ -472,7 +457,6 @@
}
public void testSpecifyBeanWhenMultipleBeansAreEligibleForInjectedParameterResolution() throws CoreException {
- System.out.println("testSpecifyBeanWhenMultipleBeansAreEligibleForInjectedParameterResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken3.java",
@@ -487,7 +471,6 @@
}
public void testSelectBeanWhenMultipleBeansAreEligibleForInjectedParameterResolution() throws CoreException {
- System.out.println("testSelectBeanWhenMultipleBeansAreEligibleForInjectedParameterResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken3.java",
@@ -507,7 +490,6 @@
}
public void testSpecifyBeanWhenNoBeanIsEligibleForInjectedParameterResolution() throws CoreException {
- System.out.println("testSpecifyBeanWhenNoBeanIsEligibleForInjectedParameterResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Farm_Broken4.java",
@@ -522,7 +504,6 @@
}
public void testSelectBeanWhenNoBeanIsEligibleForInjectedParameterResolution() throws CoreException {
- System.out.println("testSelectBeanWhenNoBeanIsEligibleForInjectedParameterResolution...");
checkResolution(tckProject,
new String[]{
"JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Office_Broken4.java",
@@ -541,4 +522,18 @@
SelectBeanMarkerResolution.class);
}
+ public void testAddSerializableInterfaceResolution() throws CoreException {
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Hamina_Broken.java"
+ },
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/Hamina_Broken.qfxresult"
+ },
+ MARKER_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.NOT_PASSIVATION_CAPABLE_BEAN_ID,
+ AddSerializableInterfaceMarkerResolution.class);
+ }
+
}
13 years, 10 months
JBoss Tools SVN: r29713 - in trunk/cdi/plugins: org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-03-11 16:13:04 -0500 (Fri, 11 Mar 2011)
New Revision: 29713
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
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/CDIValidationErrorManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-8550
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-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -1759,7 +1759,7 @@
}
if(!passivatingCapable) {
ITextSourceReference reference = CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange());
- addError(MessageFormat.format(CDIValidationMessages.NOT_PASSIVATION_CAPABLE_BEAN, bean.getSimpleJavaName(), scope.getSourceType().getElementName()), CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, reference, bean.getResource());
+ addError(MessageFormat.format(CDIValidationMessages.NOT_PASSIVATION_CAPABLE_BEAN, bean.getSimpleJavaName(), scope.getSourceType().getElementName()), CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, reference, bean.getResource(), NOT_PASSIVATION_CAPABLE_BEAN_ID);
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationErrorManager.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -26,6 +26,7 @@
public static final int MULTIPLE_INJECTION_CONSTRUCTORS_ID = 6;
public static final int UNSATISFIED_INJECTION_POINTS_ID = 7;
public static final int AMBIGUOUS_INJECTION_POINTS_ID = 8;
+ public static final int NOT_PASSIVATION_CAPABLE_BEAN_ID = 9;
/*
* (non-Javadoc)
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -90,6 +90,7 @@
public static String DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE;
public static String MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE;
public static String SELECT_BEAN_TITLE;
+ public static String ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE;
public static String SELECT_BEAN_WIZARD_TITLE;
public static String SELECT_BEAN_WIZARD_ENTER_BEAN_NAME;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/CDIUIMessages.properties 2011-03-11 21:13:04 UTC (rev 29713)
@@ -74,6 +74,7 @@
DELETE_ALL_INJECTED_CONSTRUCTORS_MARKER_RESOLUTION_TITLE=Delete @Inject annotations from all constructors except ''{0}'' constructor
MAKE_INJECTED_POINT_UNAMBIGUOUS_TITLE=Specify ''{0}'' bean for injection to the injection point
SELECT_BEAN_TITLE=Select bean to configure the injection point
+ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE=Add java.io.Serializable interface to ''{0}'' class
SELECT_BEAN_WIZARD_TITLE=Specify CDI Bean for the Injection Point
SELECT_BEAN_WIZARD_ENTER_BEAN_NAME=Enter CDI Bean name prefix or pattern (? = any character, * = any string):
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.ui.marker;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMarkerResolution2;
+import org.jboss.tools.cdi.ui.CDIUIMessages;
+import org.jboss.tools.cdi.ui.CDIUIPlugin;
+import org.jboss.tools.common.EclipseUtil;
+
+/**
+ * @author Daniel Azarov
+ */
+public class AddSerializableInterfaceMarkerResolution implements IMarkerResolution2 {
+ public static final String SERIALIZABLE = "java.io.Serializable"; //$NON-NLS-1$
+
+ private String label;
+ private IType type;
+ private IFile file;
+
+
+ public AddSerializableInterfaceMarkerResolution(IType type, IFile file){
+ this.label = MessageFormat.format(CDIUIMessages.ADD_SERIALIZABLE_INTERFACE_MARKER_RESOLUTION_TITLE, new Object[]{type.getElementName()});
+ this.type = type;
+ this.file = file;
+ }
+
+ @Override
+ public String getLabel() {
+ return label;
+ }
+
+ @Override
+ public void run(IMarker marker) {
+ try{
+ ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
+
+ MarkerResolutionUtils.addInterfaceToClass(compilationUnit, type, SERIALIZABLE);
+
+ compilationUnit.commitWorkingCopy(false, new NullProgressMonitor());
+ compilationUnit.discardWorkingCopy();
+
+ }catch(CoreException ex){
+ CDIUIPlugin.getDefault().logError(ex);
+ }
+ }
+
+ @Override
+ public String getDescription() {
+ return null;
+ }
+
+ @Override
+ public Image getImage() {
+ return null;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -147,6 +147,14 @@
return resolutions;
}
}
+ }else if(messageId == CDIValidationErrorManager.NOT_PASSIVATION_CAPABLE_BEAN_ID){
+ IType type = findTypeWithNoSerializable(file, start);
+
+ if(type != null){
+ return new IMarkerResolution[] {
+ new AddSerializableInterfaceMarkerResolution(type, file)
+ };
+ }
}
}
return new IMarkerResolution[] {};
@@ -233,6 +241,23 @@
}
return null;
}
+
+ private IType findTypeWithNoSerializable(IFile file, int start) throws JavaModelException{
+ IJavaElement javaElement = findJavaElement(file, start);
+ if(javaElement != null && javaElement instanceof IType){
+ IType type = (IType)javaElement;
+ if(!type.isBinary()){
+ String shortName = MarkerResolutionUtils.getShortName(AddSerializableInterfaceMarkerResolution.SERIALIZABLE);
+ String[] interfaces = type.getSuperInterfaceNames();
+ for(String name : interfaces){
+ if(name.equals(shortName))
+ return null;
+ }
+ return type;
+ }
+ }
+ return null;
+ }
private IJavaElement findJavaElement(IFile file, int start){
try{
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-03-11 18:59:22 UTC (rev 29712)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-03-11 21:13:04 UTC (rev 29713)
@@ -52,8 +52,10 @@
*/
public class MarkerResolutionUtils {
public static final String DOT = "."; //$NON-NLS-1$
+ public static final String COMMA = ","; //$NON-NLS-1$
public static final String SPACE = " "; //$NON-NLS-1$
public static final String AT = "@"; //$NON-NLS-1$
+ public static final String IMPLEMENTS = "implements"; //$NON-NLS-1$
static final HashSet<String> primitives = new HashSet<String>();
static{
@@ -439,6 +441,37 @@
}
}
+ public static void addInterfaceToClass(ICompilationUnit compilationUnit, IType type, String qualifiedName) throws JavaModelException{
+ String shortName = getShortName(qualifiedName);
+
+ IType[] types = compilationUnit.getTypes();
+ IType workingType = null;
+ for(IType t : types){
+ if(t.getElementName().equals(type.getElementName())){
+ workingType = t;
+ break;
+ }
+ }
+
+ if(workingType != null){
+ addImport(qualifiedName, compilationUnit);
+
+ IBuffer buffer = compilationUnit.getBuffer();
+
+ String text = buffer.getText(workingType.getSourceRange().getOffset(), workingType.getSourceRange().getLength());
+
+ int namePosition = text.indexOf(workingType.getElementName());
+ if(namePosition >= 0){
+ int implementsPosition = text.indexOf(IMPLEMENTS,namePosition);
+ if(implementsPosition < 0)
+ buffer.replace(workingType.getSourceRange().getOffset()+namePosition+workingType.getElementName().length(),0,SPACE+IMPLEMENTS+SPACE+shortName);
+ else
+ buffer.replace(workingType.getSourceRange().getOffset()+implementsPosition+IMPLEMENTS.length(),0,SPACE+shortName+COMMA);
+ }
+ }
+
+ }
+
private static IJavaElement getInjectedJavaElement(ICompilationUnit compilationUnit, IInjectionPoint injectionPoint){
if(injectionPoint instanceof IInjectionPointField){
IField field = ((IInjectionPointField)injectionPoint).getField();
13 years, 10 months
JBoss Tools SVN: r29712 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-03-11 13:59:22 -0500 (Fri, 11 Mar 2011)
New Revision: 29712
Added:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Messages.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/messages.properties
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
Log:
JBIDE-8271
Help text for CDI filed conent assist proposal contains unnecessary text with weird symbols in header and doesn't contains any text in case of missing javadoc
"No Javadoc could be found" text is added in case of javadoc is absent
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-03-11 18:41:16 UTC (rev 29711)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoELContentAssistantProposal.java 2011-03-11 18:59:22 UTC (rev 29712)
@@ -82,7 +82,7 @@
if (elements[i] instanceof IMember ||
elements[i].getElementType() == IJavaElement.LOCAL_VARIABLE ||
elements[i].getElementType() == IJavaElement.TYPE_PARAMETER) {
- buffer.append('�').append(' ').append(getInfoText(elements[i]));
+ buffer.append('�').append(' ').append(getInfoText(elements[i]));
hasContents= true;
}
buffer.append("<br/>"); //$NON-NLS-1$
@@ -171,6 +171,10 @@
} catch (JavaModelException ex) {
JavaPlugin.log(ex);
}
+
+ if (reader == null) {
+ reader = new StringReader(Messages.NO_JAVADOC);
+ }
if (reader != null) {
HTMLPrinter.addParagraph(buffer, reader);
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Messages.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Messages.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Messages.java 2011-03-11 18:59:22 UTC (rev 29712)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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.jst.jsp.contentassist;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ * @author jeremy
+ *
+ */
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.jboss.tools.jst.jsp.contentassist.messages";//$NON-NLS-1$
+
+ private Messages() {
+ // Do not instantiate
+ }
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ public static String NO_JAVADOC;
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/Messages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/messages.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/messages.properties (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/messages.properties 2011-03-11 18:59:22 UTC (rev 29712)
@@ -0,0 +1 @@
+NO_JAVADOC=No Javadoc could be found<br>
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/messages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 10 months
JBoss Tools SVN: r29710 - in trunk/deltacloud/tests/org.jboss.tools.deltacloud.test: src/org/jboss/tools/internal/deltacloud/test and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-03-11 12:18:06 -0500 (Fri, 11 Mar 2011)
New Revision: 29710
Removed:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/APIResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ImageResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/InstanceResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/KeyResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/RealmResponseFakes.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerResponseFakes.java
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/.classpath
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/build.properties
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudIntegrationTestSuite.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerFake.java
Log:
[JBIDE-8562] removed client related tests
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test
___________________________________________________________________
Modified: svn:ignore
- deltacloud-dependencies
jruby-complete-1.5.3
build-custom-jruby.sh
jruby-src-1.5.3.zip
deltacloud2.jar
+ deltacloud-dependencies
jruby-complete-1.5.3
build-custom-jruby.sh
jruby-src-1.5.3.zip
deltacloud2.jar
target
jruby
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/.classpath
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/.classpath 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/.classpath 2011-03-11 17:18:06 UTC (rev 29710)
@@ -3,7 +3,5 @@
<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="lib" path="deltacloud-dependencies.jar"/>
- <classpathentry kind="lib" path="jruby-complete-1.5.3.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch 2011-03-11 17:18:06 UTC (rev 29710)
@@ -36,7 +36,7 @@
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.internal.deltacloud.test.DeltaCloudTestSuite"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.internal.deltacloud.test.DeltaCloudClientTestSuite"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.deltacloud.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/build.properties
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/build.properties 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/build.properties 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,5 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .,\
- jruby-complete-1.5.3.jar
+ .
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudIntegrationTestSuite.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudIntegrationTestSuite.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudIntegrationTestSuite.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -11,10 +11,6 @@
package org.jboss.tools.internal.deltacloud.test;
import org.jboss.tools.internal.deltacloud.test.core.DeltaCloudMockIntegrationTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.ImageMockIntegrationTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.InstanceMockIntegrationTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.KeyMockIntegrationTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.ServerTypeMockIntegrationTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -23,11 +19,7 @@
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
- DeltaCloudMockIntegrationTest.class,
- ImageMockIntegrationTest.class,
- InstanceMockIntegrationTest.class,
- KeyMockIntegrationTest.class,
- ServerTypeMockIntegrationTest.class
+ DeltaCloudMockIntegrationTest.class
})
public class DeltaCloudIntegrationTestSuite {
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -10,12 +10,6 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.test;
-import org.jboss.tools.internal.deltacloud.test.core.client.APIDomUnmarshallingTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.HardwareProfileDomUnmarshallingTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.ImageDomUnmarshallingTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.InstanceDomUnmarshallingTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.KeyDomUnmarshallingTest;
-import org.jboss.tools.internal.deltacloud.test.core.client.RealmDomUnmarshallingTest;
import org.jboss.tools.internal.deltacloud.test.core.job.CloudSchedulingRulesTest;
import org.jboss.tools.internal.deltacloud.test.ui.preferences.StringsPreferenceValueTest;
import org.junit.runner.RunWith;
@@ -27,12 +21,6 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({
CloudSchedulingRulesTest.class,
- KeyDomUnmarshallingTest.class,
- InstanceDomUnmarshallingTest.class,
- ImageDomUnmarshallingTest.class,
- HardwareProfileDomUnmarshallingTest.class,
- APIDomUnmarshallingTest.class,
- RealmDomUnmarshallingTest.class,
StringsPreferenceValueTest.class})
public class DeltaCloudTestSuite {
}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/APIResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/APIResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/APIResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-/**
- * @author André Dietisheim
- */
-public class APIResponseFakes {
-
- public static class APIResponse {
- public static final String url = "http://localhost:3001/api/keys/test1292840175447";
- public static final String driver = "ec2";
-
- public static final String apiResponse = getApiResponseXML(url, driver);
- public static final String invalidDriverApiResponse = getApiResponseXML(url, "foo");
- }
-
- private static final String getApiResponseXML(String url, String driver) {
- return "<api driver='" + driver + "' version='0.1'>"
- + " <link href='" + url + "realms' rel='realms'>"
- + " </link>"
- + " <link href='" + url + "images' rel='images'>"
- + " <feature name='owner_id'></feature>"
- + " </link>"
- + " <link href='" + url + "instance_states' rel='instance_states'>"
- + " </link>"
- + " <link href='" + url + "instances' rel='instances'>"
- + " <feature name='user_data'></feature>"
- + " <feature name='authentication_key'></feature>"
- + " <feature name='public_ip'></feature>"
- + " <feature name='security_group'></feature>"
- + " </link>"
- + " <link href='" + url + "hardware_profiles' rel='hardware_profiles'>"
- + " </link>"
- + " <link href='" + url + "storage_snapshots' rel='storage_snapshots'>"
- + " </link>"
- + " <link href='" + url + "storage_volumes' rel='storage_volumes'>"
- + " </link>"
- + " <link href='" + url + "keys' rel='keys'>"
- + " </link>"
- + " <link href='" + url + "buckets' rel='buckets'>"
- + " <feature name='bucket_location'></feature>"
- + " </link>"
- + "</api>";
-
- }
-
-}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-import org.jboss.tools.deltacloud.core.client.Property;
-import org.jboss.tools.deltacloud.core.client.Property.UNIT;
-
-/**
- * @author André Dietisheim
- */
-public class HardwareProfileResponseFakes {
-
- public static class HardwareProfile1Response {
- public static final String id = "m1-small";
- public static final String propMemKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propMemUnit = UNIT.MB.name();
- public static final String propMemValue = "1740.8";
- public static final String propStorageKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propStorageUnit = UNIT.GB.name();
- public static final String propStorageValue = "160";
- public static final String propCPUKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propCPUUnit = UNIT.COUNT.name().toLowerCase();
- public static final String propCPUValue = "1";
- public static final String propArchKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propArchUnit = UNIT.LABEL.name().toLowerCase();
- public static final String propArchValue = "i386";
-
- public static final String response = getHardwareProfileResponseXML(
- id,
- new String[] {
- getFixedPropertyXML(Property.Names.MEMORY.name().toLowerCase(), propMemUnit, propMemValue),
- getFixedPropertyXML(Property.Names.STORAGE.name().toLowerCase(), propStorageUnit,
- propStorageValue),
- getFixedPropertyXML(Property.Names.CPU.name().toLowerCase(), propCPUUnit, propCPUValue),
- getFixedPropertyXML(Property.Names.ARCHITECTURE.name().toLowerCase(), propArchUnit,
- propArchValue)
- });
- }
-
- public static class HardwareProfile2Response {
- public static final String id = "m1-large";
- public static final String propMemKind = Property.Kind.RANGE.name().toLowerCase();
- public static final String propMemUnit = UNIT.MB.name();
- public static final String propMemValue = "10240";
- public static final String propMemRangeFirst = "7680.0";
- public static final String propMemRangeLast = "15360";
- public static final String propStorageKind = Property.Kind.ENUM.name().toLowerCase();
- public static final String propStorageUnit = UNIT.GB.name();
- public static final String propStorageValue = "160";
- public static final String propStorageEnum1 = "850";
- public static final String propStorageEnum2 = "1024";
- public static final String propCPUKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propCPUUnit = UNIT.COUNT.name().toLowerCase();
- public static final String propCPUValue = "2";
- public static final String propArchKind = Property.Kind.FIXED.name().toLowerCase();
- public static final String propArchUnit = UNIT.LABEL.name().toLowerCase();
- public static final String propArchValue = "x86_64";
-
- public static final String response = getHardwareProfileResponseXML(
- id,
- new String[] {
- getRangePropertyXML(Property.Names.MEMORY.name().toLowerCase(), propMemUnit, propMemValue,
- propMemRangeFirst, propMemRangeLast),
- getEnumPropertyXML(Property.Names.STORAGE.name().toLowerCase(), propStorageUnit,
- propStorageValue, propStorageEnum1, propStorageEnum2),
- getFixedPropertyXML(Property.Names.CPU.name().toLowerCase(), propCPUUnit, propCPUValue),
- getFixedPropertyXML(Property.Names.ARCHITECTURE.name().toLowerCase(), propArchUnit,
- propArchValue)
- });
- }
-
- public static class HardwareProfilesResponse {
-
- public static final String response =
- "<hardware_profiles>"
- + HardwareProfile1Response.response
- + HardwareProfile2Response.response
- +"</hardware_profiles>";
- }
-
- private static final String getHardwareProfileResponseXML(String id, String[] properties) {
- StringBuilder builder = new StringBuilder();
- for (String propertyString : properties) {
- builder.append(propertyString);
- }
- return getHardwareProfileResponseXML(id, builder.toString());
- }
-
- private static final String getHardwareProfileResponseXML(String id, String properties) {
- return new StringBuilder()
- .append("<hardware_profile href=\"fakeUrl\" id=\"").append(id).append("\">")
- .append("<name>fakeName</name>")
- .append(properties)
- .append("</hardware_profile>")
- .toString();
- }
-
- private static String getFixedPropertyXML(String name, String unit, String value) {
- return getPropertyXML(name, "fixed", unit, value)
- + getClodingPropertyTag();
- }
-
- private static String getRangePropertyXML(String name, String unit, String value, String first, String last) {
- return getPropertyXML(name, "range", unit, value)
- + "<range first='" + first + "' last='" + last + "'/>"
- + getClodingPropertyTag();
- }
-
- private static String getEnumPropertyXML(String name, String unit, String value, String... enumValues) {
- StringBuilder builder = new StringBuilder(getPropertyXML(name, "enum", unit, value));
- builder.append("<enum>");
- for (String enumValue : enumValues) {
- builder.append("<entry value='").append(enumValue).append("' />");
- }
- builder.append("</enum>");
- builder.append(getClodingPropertyTag());
- return builder.toString();
- }
-
- private static String getPropertyXML(String name, String kind, String unit, String value) {
- return "<property kind=\"" + kind + "\" name=\"" + name + "\" unit=\"" + unit + "\" value=\"" + value + "\">";
- }
-
- private static String getClodingPropertyTag() {
- return "</property>";
-
- }
-
-}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ImageResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ImageResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ImageResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-
-/**
- * @author André Dietisheim
- */
-public class ImageResponseFakes {
-
- public static class ImageResponse {
- public static final String url = "http://try.steamcannon.org/deltacloud/api/images/ami-16a3577f";
- public static final String id = "ami-16a3577f";
- public static final String name = "sles-10-sp3-v1.00.i386";
- public static final String ownerId = "013907871322";
- public static final String description = "SUSE Linux Enterprise Server 10 Service Pack 3 for x86 (v1.00)";
- public static final String architecture = "i386";
-
- public static final String response = getImageResponseXML(url, id, name, ownerId, description, architecture);
- }
-
- public static class ImagesResponse {
-
- public static final String url1 = "http://try.steamcannon.org/deltacloud/api/images/ami-16a3577f";
- public static final String id1 = "ami-16a3577f";
- public static final String name1 = "sles-10-sp3-v1.00.i386";
- public static final String ownerId1 = "013907871322";
- public static final String description1 = "SUSE Linux Enterprise Server 10 Service Pack 3 for x86 (v1.00)";
- public static final String architecture1 = "i386";
-
- public static final String url2 = "http://try.steamcannon.org/deltacloud/api/images/ami-16a3578f";
- public static final String id2 = "ami-16a3578f";
- public static final String name2 = "sles-10-sp3-v2.00.i686";
- public static final String ownerId2 = "013907871422";
- public static final String description2 = "SUSE Linux Enterprise Server 10 Service Pack 3 for x86 (v2.00)";
- public static final String architecture2 = "i686";
-
- public static final String response =
- "<images>"
- + getImageResponseXML(url1, id1, name1, ownerId1, description1, architecture1)
- + getImageResponseXML(url2, id2, name2, ownerId2, description2, architecture2)
- + "</images>";
-
- }
-
- private static String getImageResponseXML(String url, String id, String name, String ownerId,
- String description, String architecture) {
- return "<image href='" + url + "' id='" + id + "'>"
- + "<name>" + name + "</name>"
- + "<owner_id>" + ownerId + "</owner_id>"
- + "<description>" + description + "</description>"
- + "<architecture>" + architecture + "</architecture>"
- + "<state></state>"
- + "</image>";
- }
-}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/InstanceResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/InstanceResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/InstanceResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-import org.jboss.tools.deltacloud.core.client.StateAware.State;
-
-/**
- * @author André Dietisheim
- */
-public class InstanceResponseFakes {
-
- public static class InstanceActionResponse {
- public static final String url = "http://try.steamcannon.org/deltacloud/api/instances/i-6f16e503/start";
- public static final String method = "post";
- public static final String name = "start";
- public static final String response = ServerResponseFakes.getActionXML(url, method, name);
- }
-
- public static class InstanceResponse {
- public static final String url1 = "http://try.steamcannon.org/deltacloud/api/instances/i-6f16e503";
- public static final String id1 = "i-6f16e503";
- public static final String name1 = "ami-7d07ec14";
- public static final String ownerId1 = "357159121505";
- public static final String image1Url = "http://try.steamcannon.org/deltacloud/api/images/ami-7d07ec14";
- public static final String image1Id = "ami-7d07ec14";
- public static final String realm1Url = "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a";
- public static final String realm1Id = "us-east-1a";
- public static final State state = State.RUNNING;
- public static final String hardwareProfile1Url = "http://try.steamcannon.org/deltacloud/api/hardware_profiles/m1.small";
- public static final String hardwareProfile1Id = "m1.small";
- public static final String keyname1 = "ad10";
- public static final String actionNameStop = "stop";
- public static final String actionNameReboot = "reboot";
- public static final String publicAddress1 = "ec2-50-16-108-18.compute-1.amazonaws.com";
- public static final String privateAddress1 = "ec2-50-16-108-18.compute-1.amazonaws.com";
-
- public static final String response = getInstanceResponseXML(url1, id1, name1, ownerId1, image1Url,
- image1Id, realm1Url, realm1Id, state, hardwareProfile1Url, hardwareProfile1Id, keyname1,
- actionNameStop, actionNameReboot, publicAddress1, privateAddress1);
- }
-
- public static class InstancesResponse {
-
- public static final String url1 = "http://try.steamcannon.org/deltacloud/api/instances/i-6f16e503";
- public static final String id1 = "i-6f16e503";
- public static final String name1 = "ami-7d07ec14";
- public static final String ownerId1 = "357159121505";
- public static final String image1Url = "http://try.steamcannon.org/deltacloud/api/images/ami-7d07ec14";
- public static final String image1Id = "ami-7d07ec14";
- public static final String realm1Url = "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a";
- public static final String realm1Id = "us-east-1a";
- public static final State state = State.RUNNING;
- public static final String hardwareProfile1Url = "http://try.steamcannon.org/deltacloud/api/hardware_profiles/m1.small";
- public static final String hardwareProfile1Id = "m1.small";
- public static final String keyname1 = "ad10";
- public static final String actionNameStop = "stop";
- public static final String actionNameReboot = "reboot";
- public static final String publicAddress1 = "ec2-50-16-108-18.compute-1.amazonaws.com";
- public static final String privateAddress1 = "ec2-50-16-108-18.compute-1.amazonaws.com";
-
- public static final String url2 = "http://try.steamcannon.org/deltacloud/api/instances/i-6f16e553";
- public static final String id2 = "i-6f16e503";
- public static final String name2 = "ami-7d07ec14";
- public static final String ownerId2 = "357159121505";
- public static final String image2Url = "http://try.steamcannon.org/deltacloud/api/images/ami-7d07ec17";
- public static final String image2Id = "ami-7d07ec14";
- public static final String realm2Url = "http://try.steamcannon.org/deltacloud/api/realms/us-east-2a";
- public static final String realm2Id = "us-east-2a";
- public static final State state2 = State.STOPPED;
- public static final String hardwareProfile2Url = "http://try.steamcannon.org/deltacloud/api/hardware_profiles/m1.large";
- public static final String hardwareProfile2Id = "m1.large";
- public static final String keyname2 = "ad11";
- public static final String publicAddress2 = "ec2-50-16-108-19.compute-2.amazonaws.com";
- public static final String privateAddress2 = "ec2-50-16-108-19.compute-2.amazonaws.com";
-
- public static final String response =
- "<instances>"
- + getInstanceResponseXML(url1, id1, name1, ownerId1, image1Url,
- image1Id, realm1Url, realm1Id, state, hardwareProfile1Url, hardwareProfile1Id,
- keyname1,
- actionNameStop, actionNameReboot, publicAddress1, privateAddress1)
- + getInstanceResponseXML(url2, id2, name2, ownerId2, image2Url,
- image2Id, realm2Url, realm2Id, state, hardwareProfile2Url, hardwareProfile2Id,
- keyname2,
- actionNameReboot, actionNameReboot, publicAddress2, privateAddress2)
- + "</instances>";
-
- }
-
- private static final String getInstanceResponseXML(String url, String id, String name, String owner,
- String imageUrl, String imageId, String realmUrl, String realmId, State state,
- String hardwareProfileUrl, String hardwareProfileId, String keyname, String actionName1,
- String actionName2, String publicAddress, String privateAddress) {
- return "<instance href=\""
- + url
- + "\" id=\""
- + id
- + "\">"
- + "<name>"
- + name
- + "</name>"
- + "<owner_id>"
- + owner
- + "</owner_id>"
- + "<image href=\""
- + imageUrl
- + "\" id=\""
- + imageId
- + "\"/>"
- + getRealmResponseXML(realmUrl, realmId)
- + "<state>"
- + state.toString()
- + "</state>"
- + getHardwareProfileXML(hardwareProfileUrl, hardwareProfileId)
- + "<actions>"
- + ServerResponseFakes.getActionXML("http://try.steamcannon.org/deltacloud/api/instances/" + id
- + "/reboot", "post", actionName1)
- + ServerResponseFakes.getActionXML("http://try.steamcannon.org/deltacloud/api/instances/" + id
- + "/stop", "post", actionName2)
- + "</actions>"
- + "<public_addresses>"
- + getAddressXML(publicAddress)
- + "</public_addresses>"
- + "<private_addresses>"
- + getAddressXML(privateAddress)
- + "</private_addresses>"
- + "<authentication type='key'>"
- + "<login>"
- + "<keyname>" + keyname + "</keyname>"
- + "</login>"
- + "</authentication>"
- + "</instance>";
- }
-
- private static String getAddressXML(String address) {
- return "<address>" + address + "</address>";
- }
-
- private static String getHardwareProfileXML(String url, String id) {
- return "<hardware_profile href=\"" + url + "\" id=\"" + id + "\"></hardware_profile>";
- }
-
- private static String getRealmResponseXML(String url, String id) {
- return "<realm href=\"" + url + "\" id=\"" + id + "\"/>";
- }
-
-}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/KeyResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/KeyResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/KeyResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-/**
- * @author André Dietisheim
- */
-public class KeyResponseFakes {
-
- public static class KeyActionResponse {
- public static final String url = "http://localhost:3001/api/keys/test1292840175447";
- public static final String method = "delete";
- public static final String name = "destroy";
- public static final String keyActionResponse = ServerResponseFakes.getActionXML(url, method, name);
- }
-
- public static class KeyResponse {
- public static final String url = "http://localhost:3001/api/keys/test1292840175447";
- public static final String method = "delete";
- public static final String id = "test1292840175447";
- public static final String name = "destroy";
- public static final String fingerprint = "60:7c:f6:9e:e0:a1:52:bc:c0:9a:11:80:a7:1b:f6:8b:c6:55:cd:1f";
- public static final String pem =
- "-----BEGIN RSA PRIVATE KEY-----"
- + "YkFqsstgVJqYc=sxypCDk=qJbHOmhQNYxaQR4vna=ccPbj68MuxQSZ9tiyu+Z8yAog0DI65/j6u\n"
- + "xE6gTMsqqTrDkGmAwhiGLsgORkQyxEthGyDfA40YaBf5/5F=Cvuj2zpnp63JIrUrqoqI1FQYhnA\n"
- + "U34yKaj8+3/0AqsdEmWsWLMbV4HXaRtGZOPbERnJE28EhLlq/v+9wC59hpIZt6s4K0eRBYxCWz/\n"
- + "xvEG=7wZJi7WE0/tsH9YIAHaLRqyxV7H5kRqaYExZhUpBgf/x745KJlPpr1I20BJSrj6Fw4z4P5\n"
- + "DIUPDWit8aQdnBpO2fq9eQLGZKyWmj5xpzFm5DxbV1K=bdmqCnC6XHTLcfV4fqW1egYg2DK5WCj\n"
- + "nsl+mQjn4CNvEdymhna7+Bw0D3JcPcW/EGUrsBGEGLT/suQbEi8x0vQscpBEAizq5GZaKZ6Kec9\n"
- + "7MOHpx7qDqIAPjH9Y3ben7EaR0O3laY/OPrFREw8jP=mptePHF2r07s52QkdqkbU4ePC5BSWOcb\n"
- + "bhOqypbbv9V8YssYLyt6m3VOJFHOoERaDJQ2fMmqTDuFc87lxDrChJk4cw0q9o6Q+YzEnjTqGQo\n"
- + "XcwTtutpL97f1HjO34XlcHn3B1iZ8lsQGJWry9MWaiCdjj02v0mfN+UpbIQNBX452Xllf8YM//0\n"
- + "Kaylt3GZvr2bJsJ=lQIUIxVzREHd7ym/hRNTBx5qK2/=8h57IdyQHZSnjDT05qDRsSPcm5nQmbM\n"
- + "dgivv0/vXogWg9ehbym4DNez38QVkQaoJuKd/ESBIU2p8PIEXWC13HHzIMDbkbM235nFn3Roj59\n"
- + "xt2AJoQnltdfuhA4+5ApnnIYcWzgkd8vWZPhNL2u40Sw1ZPrM+g4n7H48IdwtE3vZ0XfF3Lpdee\n"
- + "IReubErRzxIMNVz=PrLQMAOhukYNJeH63PdxfSsJf7rtGwA1qEF1WcZ1ibvAuFr0G3KQalGCgCh\n"
- + "zkF63HCWcjafUTJ3jE6/U5ZPu8GrhAQQqu=r3NyzLgoTBaNwfe7ybxvBBofjdmD9xPipOhrQjDC\n"
- + "PDeaMDZ6XzwAddh4fd1K3kl29DXNBmPAgfaG8CgdnHVc/gQgAv40RvWDNnYae0/MGE+qrLN0XXF\n"
- + "1g3qHLkmqdtg88nCH=X7kf6FZZ3LE+bLKIF2Y4Xh3X8sqHlImLWSlKvKu6/CuB4GsrfLxu1VLdc\n"
- + "ee3DxUIaqz3LmkERnT7ALcMBjBjRNp=DR=x7zON0f0Nht0gIj1vvDWQmEzRqGxgTwS2PtGL3bOZ\n"
- + "v2hiV3G3+S/9SAD9rfiW9Ws1YLH5mVDcHcKWhHXoM/UqPj3ob3yGzvYgR+X/dIg7tug/k=TTtD8\n"
- + "1wkG4gTjHkfEhCs05/+PZ4rFG15nVpv06e/a3nXtyDQ77qH3irRPsLZDp/CWFdt=Poe4NLX46gE\n"
- + "nU07L+ueqgZUa8Tq6A9oG7QUyjtJh4ZxkShYkIullvUksW0yppaIeB32Xxw2XVEtdu/v=rFHSHh\n"
- + "HwoZ1A/=ku7ICdMg5gD6U+Zg0YlxniHDaSJ8A6kdt2iUaPaZQQcH8T4yh90CKHhbl5NzhxAu3Jz\n"
- + "dc=oRQqdzizw9UrN84wEmQ6r9hDHUq2x14PR=xBzwLGzR2dh73GdjxF5OmOrp3m4yCkw\n"
- + "-----END RSA PRIVATE KEY-----\n";
- public static final String keyResponse = getKeyResponseXML(id, fingerprint, pem, url, method, name);
- }
-
- public static class KeysResponse {
-
- public static final String url1 = "http://localhost:3001/api/keys/test1292840175417";
- public static final String method1 = "delete";
- public static final String id1 = "test1292840175447";
- public static final String name1 = "destroy";
- public static final String fingerprint1 = "60:7c:f6:9e:e0:a1:52:bc:c0:9a:11:80:a7:1b:f6:8b:c6:55:cd:1f";
- public static final String pem1 = "-----BEGIN RSA PRIVATE KEY-----"
- + "YkFqsstgVJqYc=sxypCDk=qJbHOmhQNYxaQR4vna=ccPbj68MuxQSZ9tiyu+Z8yAog0DI65/j6u\n";
-
- public static final String url2 = "http://localhost:3001/api/keys/test1292840175427";
- public static final String method2 = "delete";
- public static final String id2 = "test1292840175447";
- public static final String name2 = "destroy";
- public static final String fingerprint2 = "60:7c:f6:9e:e0:a1:52:bc:c0:9a:11:80:a7:1b:f6:8b:c6:55:cd:1f";
- public static final String pem2 =
- "-----BEGIN RSA PRIVATE KEY-----"
- + "YkFqsstgVJqYc=sxypCDk=qJbHOmhQNYxaQR4vna=ccPbj68MuxQSZ9tiyu+Z8yAog0DI65/j6u";
-
- public static final String keysResponse =
- "<keys>"
- + getKeyResponseXML(id1, fingerprint1, pem1, url1, method1, name1)
- + getKeyResponseXML(id2, fingerprint2, pem2, url2, method2, name2)
- + "</keys>";
- }
-
- private static final String getKeyResponseXML(String id, String fingerprint, String pem, String url, String method,
- String name) {
- return "<key href='" + url + "' id='" + id + "' type='key'>"
- + "<actions>"
- + ServerResponseFakes.getActionXML(url, method, name)
- + "</actions>"
- + "<fingerprint>" + fingerprint + "</fingerprint>"
- + "<pem><pem>" + pem + "</pem></pem>"
- + "<state></state>"
- + "</key>";
-
- }
-
-}
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/RealmResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/RealmResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/RealmResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-import org.jboss.tools.deltacloud.core.client.Realm.RealmState;
-
-/**
- * @author André Dietisheim
- */
-public class RealmResponseFakes {
-
- public static final RealmResponse realmResponse = new RealmResponse(
- "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a",
- "us-east-1a",
- "us-east-1a",
- RealmState.AVAILABLE.toString().toLowerCase(),
- "22");
- public static final RealmResponse invalidLimitRealmResponse = new RealmResponse(
- "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a",
- "us-east-1a",
- "us-east-1a",
- RealmState.AVAILABLE.toString().toLowerCase(),
- "aa");
-
- public static class RealmResponse {
-
- public RealmResponse(String url, String id, String name, String state, String limit) {
- this.url = url;
- this.id = id;
- this.name = name;
- this.state = state;
- this.limit = limit;
- this.response = getRealmResponseXML(url, id, name, state, limit);
- }
-
- public String url = "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a";
- public String id = "us-east-1a";
- public String name = "us-east-1a";
- public String state = RealmState.AVAILABLE.toString().toLowerCase();
- public String limit = "22";
- public String response = getRealmResponseXML(url, id, name, state, limit);
-
- public int getIntLimit() {
- return Integer.parseInt(limit);
- }
- }
-
- public static class RealmsResponse {
-
- public static final String url1 = "http://try.steamcannon.org/deltacloud/api/realms/us-east-1a";
- public static final String id1 = "us-east-1a";
- public static final String name1 = "us-east-1a";
- public static final String state1 = RealmState.AVAILABLE.toString().toLowerCase();
- public static final String limit1 = "2";
-
- public static final String url2 = "http://try.steamcannon.org/deltacloud/api/realms/us-east-2a";
- public static final String id2 = "us-east-2a";
- public static final String name2 = "us-east-2a";
- public static final String state2 = RealmState.AVAILABLE.toString().toLowerCase();
- public static final String limit2 = "12";
-
- public static final String response =
- "<realms>"
- + getRealmResponseXML(url1, id1, name1, state1, limit1)
- + getRealmResponseXML(url2, id2, name2, state2, limit2)
- + "</realms>";
-
- }
-
- private static String getRealmResponseXML(String url, String id, String name, String state, String limit) {
- return "<realm href='" + url + "' id='" + id + "'>"
- + "<name>" + name + "</name>"
- + "<state>" + state + "</state>"
- + "<limit>" + limit + "</limit>"
- + "</realm>";
- }
-}
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerFake.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerFake.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerFake.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -17,6 +17,9 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+/**
+ * @author André Dietisheim
+ */
public class ServerFake {
public static final int DEFAULT_PORT = 3003;
Deleted: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerResponseFakes.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerResponseFakes.java 2011-03-11 16:56:12 UTC (rev 29709)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/ServerResponseFakes.java 2011-03-11 17:18:06 UTC (rev 29710)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.test.fakes;
-
-/**
- * @author André Dietisheim
- */
-public class ServerResponseFakes {
-
- public static final String getActionXML(String url, String method, String name) {
- return "<link "
- + "method='" + method + "' "
- + "href='" + url + "' "
- + "rel='" + name + "' />";
- }
-}
13 years, 10 months