JBoss Tools SVN: r28053 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model.
by jbosstools-commits@lists.jboss.org
Author: vyemialyanchyk
Date: 2011-01-10 13:19:07 -0500 (Mon, 10 Jan 2011)
New Revision: 28053
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java
Log:
https://issues.jboss.org/browse/JBIDE-8074 - fixed
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2011-01-10 18:11:38 UTC (rev 28052)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/ElementsFactory.java 2011-01-10 18:19:07 UTC (rev 28053)
@@ -16,7 +16,9 @@
import java.util.Iterator;
import java.util.Set;
+import org.hibernate.HibernateException;
import org.hibernate.cfg.Configuration;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
@@ -115,8 +117,14 @@
OrmShape s = null;
Property property = (Property)element;
if (!property.isComposite()) {
- Type type = ((Property)element).getType();
- if (type.isEntityType()) {
+ Type type = null;
+ try {
+ type = property.getType();
+ } catch (HibernateException e) {
+ //type is not accessible
+ HibernateConsolePlugin.getDefault().logErrorMessage("HibernateException: ", e); //$NON-NLS-1$
+ }
+ if (type != null && type.isEntityType()) {
EntityType et = (EntityType) type;
Object clazz = config != null ?
config.getClassMapping(et.getAssociatedEntityName()) : null;
@@ -139,7 +147,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
protected void refreshComponentReferences(ComponentShape componentShape) {
Property property = (Property)componentShape.getOrmElement();
if (!(property.getValue() instanceof Collection)) {
@@ -230,7 +238,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
protected OrmShape getOrCreateDatabaseTable(Table databaseTable) {
OrmShape tableShape = null;
if (databaseTable != null) {
@@ -256,7 +264,7 @@
return tableShape;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "rawtypes", "unchecked" })
protected OrmShape getOrCreatePersistentClass(PersistentClass persistentClass,
Table componentClassDatabaseTable) {
OrmShape classShape = null;
@@ -432,7 +440,7 @@
return ormShape;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
private boolean createConnections(ExpandableShape persistentClass, ExpandableShape dbTable) {
boolean res = false;
if (persistentClass == null || dbTable == null) {
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2011-01-10 18:11:38 UTC (rev 28052)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/Shape.java 2011-01-10 18:19:07 UTC (rev 28053)
@@ -17,10 +17,13 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+import org.hibernate.HibernateException;
+import org.hibernate.eclipse.console.HibernateConsolePlugin;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Value;
+import org.hibernate.type.Type;
import org.jboss.tools.hibernate.ui.diagram.editors.model.Connection.ConnectionType;
import org.jboss.tools.hibernate.ui.view.HibernateUtils;
@@ -290,7 +293,16 @@
if (value instanceof Component) {
res = prop.getValue().toString();
} else {
- res = prop.getType().getReturnedClass().getName();
+ Type type = null;
+ try {
+ type = prop.getType();
+ } catch (HibernateException e) {
+ //type is not accessible
+ HibernateConsolePlugin.getDefault().logErrorMessage("HibernateException: ", e); //$NON-NLS-1$
+ }
+ if (type != null) {
+ res = type.getReturnedClass().getName();
+ }
}
} else if (PROPERTY_VALUE.equals(propertyId)) {
res = prop.getValue().toString();
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2011-01-10 18:11:38 UTC (rev 28052)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui/src/org/jboss/tools/hibernate/ui/diagram/editors/model/SpecialOrmShape.java 2011-01-10 18:19:07 UTC (rev 28053)
@@ -12,7 +12,7 @@
import java.util.Iterator;
-import org.hibernate.MappingException;
+import org.hibernate.HibernateException;
import org.hibernate.console.ConsoleConfiguration;
import org.hibernate.console.execution.ExecutionContext.Command;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
@@ -60,13 +60,14 @@
type = (Type) cfg.execute(new Command() {
public Object execute() {
return fField.getValue().getType();
- }});
+ }
+ });
} else {
- try{
+ try {
type = field.getValue().getType();
- } catch (MappingException e) {
+ } catch (HibernateException e) {
//type is not accessible
- HibernateConsolePlugin.getDefault().logErrorMessage("MappingException: ", e); //$NON-NLS-1$
+ HibernateConsolePlugin.getDefault().logErrorMessage("HibernateException: ", e); //$NON-NLS-1$
}
}
Shape bodyOrmShape = null;
13 years, 5 months
JBoss Tools SVN: r28052 - in trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui: dialogs and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2011-01-10 13:11:38 -0500 (Mon, 10 Jan 2011)
New Revision: 28052
Modified:
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java
Log:
https://issues.jboss.org/browse/JBIDE-8045
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2011-01-10 17:52:38 UTC (rev 28051)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/Messages.java 2011-01-10 18:11:38 UTC (rev 28052)
@@ -349,6 +349,7 @@
public static String FaultCatchNameDetails_Namespace__21;
public static String FaultCatchNameDetails_User_defined_15;
public static String FaultCatchNameSection_Variable_Name_3;
+ public static String FaultCatchNameSection_Error_Invalid_Type;
public static String FaultHandlerAdapter_Fault_Handlers_1;
public static String FaultThrowNameDetails_Built_in_14;
public static String FaultThrowNameDetails_Fault_Name__16;
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2011-01-10 17:52:38 UTC (rev 28051)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/dialogs/TypeSelectorDialog.java 2011-01-10 18:11:38 UTC (rev 28052)
@@ -93,7 +93,7 @@
// https://jira.jboss.org/browse/JBIDE-7107
// set by caller if a selection from the lower tree (typically message parts or XSD elements)
// are required before "OK" button can be enabled.
- protected boolean requireLowerTreeSelection = true;
+ protected boolean requireLowerTreeSelection = false;
/**
@@ -316,4 +316,15 @@
return true;
}
+
+ /**
+ * https://issues.jboss.org/browse/JBIDE-8045
+ * Enable or disable lower tree selection required flag (see this.requireLowerTreeSelection)
+ *
+ * @param enabled
+ */
+ public void setRequireLowerTreeSelection(boolean enabled)
+ {
+ this.requireLowerTreeSelection = enabled;
+ }
}
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2011-01-10 17:52:38 UTC (rev 28051)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/messages.properties 2011-01-10 18:11:38 UTC (rev 28052)
@@ -248,6 +248,7 @@
FaultCatchNameDetails_User_defined_15=&User-defined
FaultCatchNameSection_Variable_Name_3=Variable Name\:
FaultCatchNameSection_None_0=(none)
+FaultCatchNameSection_Error_Invalid_Type=Data caught by a Fault Handler must be a Message Type or an XSD Element
FaultHandlerAdapter_Fault_Handlers_1=Fault Handlers
FaultThrowNameDetails_Built_in_14=&Built-in
FaultThrowNameDetails_Fault_Name__16=Faul&t Name\:
Modified: trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java 2011-01-10 17:52:38 UTC (rev 28051)
+++ trunk/bpel/plugins/org.eclipse.bpel.ui/src/org/eclipse/bpel/ui/properties/FaultCatchNameSection.java 2011-01-10 18:11:38 UTC (rev 28052)
@@ -70,6 +70,7 @@
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.commands.Command;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.events.SelectionEvent;
@@ -526,12 +527,17 @@
variable = BPELFactory.eINSTANCE.createVariable();
_catch.setFaultVariable(variable);
}
+ // https://issues.jboss.org/browse/JBIDE-8045
+ // Data caught by fault handler can be either a Message Type
+ // or an XSD Element.
if (type instanceof Message) {
- variable.setMessageType((Message)type);
- } else {
- variable.setMessageType(null);
+ _catch.setFaultMessageType((Message)type);
+ _catch.setFaultElement(null);
}
- _catch.setFaultMessageType(variable.getMessageType());
+ else if (type instanceof XSDElementDeclaration) {
+ _catch.setFaultMessageType(null);
+ _catch.setFaultElement((XSDElementDeclaration)type);
+ }
}
});
getCommandFramework().execute(wrapInShowContextCommand(command));
@@ -562,9 +568,17 @@
if (!command.isEmpty()) getCommandFramework().execute(wrapInShowContextCommand(command));
}
- public void selectXSDType(XSDTypeDefinition xsdType) { store(xsdType); }
- public void selectXSDElement(XSDElementDeclaration xsdElement) { }
- public void selectMessageType(Message message) { store(message); }
+ // https://issues.jboss.org/browse/JBIDE-8045
+ public void selectXSDType(XSDTypeDefinition xsdType) {
+ MessageDialog.openError(null, Messages.SelectionAndCreationDialog_Error_2,
+ Messages.FaultCatchNameSection_Error_Invalid_Type);
+ }
+ public void selectXSDElement(XSDElementDeclaration xsdElement) {
+ store(xsdElement);
+ }
+ public void selectMessageType(Message message) {
+ store(message);
+ }
}
protected void createVariableWidgets(Composite parent) {
@@ -714,6 +728,10 @@
if (_catch.getFaultMessageType() != null) {
variableTypeSelector.setVariableType(_catch.getFaultMessageType());
}
+ // https://issues.jboss.org/browse/JBIDE-8045
+ if (_catch.getFaultElement() != null) {
+ variableTypeSelector.setVariableType(_catch.getFaultElement());
+ }
}
@Override
13 years, 5 months
JBoss Tools SVN: r28051 - trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-01-10 12:52:38 -0500 (Mon, 10 Jan 2011)
New Revision: 28051
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/jsf-api.jar
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/mail.jar
Log:
JBIDE-6198 - mail and jsf api's used from jboss AS 5.1
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/jsf-api.jar
===================================================================
(Binary files differ)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/lib/javaee-5.0/mail.jar
===================================================================
(Binary files differ)
13 years, 5 months
JBoss Tools SVN: r28050 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core: publishers and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-01-10 12:46:35 -0500 (Mon, 10 Jan 2011)
New Revision: 28050
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
Log:
JBIDE-8070 and small other fixes
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-01-10 17:20:25 UTC (rev 28049)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/Messages.properties 2011-01-10 17:46:35 UTC (rev 28050)
@@ -48,7 +48,7 @@
DeleteModuleFail2=Some files were not removed from the server
CountModifiedMembers={0} files modified in module {1}
ModuleDeleted=Module {0} deleted.
-ModulePublished=Module {0} published.
+ModulePublished=Module {0} published without error.
NoPublisherFound=No publisher found for module {0}
ServerTypeDiscovererFail=Name '{0}' cannot be converted to a ServerType
TerminateTwiddleFailed=Cannot terminate twiddle process
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java 2011-01-10 17:20:25 UTC (rev 28049)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractPublishMethod.java 2011-01-10 17:46:35 UTC (rev 28050)
@@ -78,7 +78,7 @@
this,
behaviour.getServer(), module,
publishType, deltas, monitor);
- if( result != null )
+ if( result != null && result.isOK())
ServerLogger.getDefault().log(behaviour.getServer(), result);
} catch( CoreException ce) {
// Let the user know
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-01-10 17:20:25 UTC (rev 28049)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/AbstractServerToolsPublisher.java 2011-01-10 17:46:35 UTC (rev 28050)
@@ -26,7 +26,6 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResource;
@@ -41,7 +40,6 @@
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.IPublishCopyCallbackHandler;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.wtp.core.util.ServerModelUtilities;
@@ -196,8 +194,7 @@
File temp = deployRoot.toFile().createTempFile(module.getName(), ".tmp", deployRoot.toFile()); //$NON-NLS-1$
IPath tempFile = new Path(temp.getAbsolutePath());
list.addAll(Arrays.asList(PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile)));
- String root = (deployPath.getDevice() == null ? "" : deployPath.getDevice()) + "/"; //$NON-NLS-1$//$NON-NLS-2$
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path(root));
+ IPublishCopyCallbackHandler handler = getCallbackHandler(getRootPath(deployPath));
String parentFolder = deployPath.removeLastSegments(1).toString();
handler.makeDirectoryIfRequired(new Path(parentFolder), getSubMon(monitor, 200));
ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
@@ -210,9 +207,19 @@
monitor.done();
if( list.size() > 0 )
return createMultiStatus(list, module);
- return Status.OK_STATUS;
+
+ Status status = new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
+ IEventCodes.JST_PUB_FULL_SUCCESS,
+ NLS.bind(Messages.ModulePublished, module.getName()), null);
+ return status;
}
+ private Path getRootPath(IPath deployPath) {
+ String root = (deployPath.getDevice() == null ? "" : deployPath.getDevice()) + "/"; //$NON-NLS-1$//$NON-NLS-2$
+ return new Path(root);
+ }
+
+
protected IStatus incrementalPublish(IModule[] moduleTree, IModule module, IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Incremental Publish: " + moduleTree[moduleTree.length-1].getName(), 100); //$NON-NLS-1$
IStatus[] results = new IStatus[] {};
@@ -234,7 +241,7 @@
File temp = File.createTempFile(module.getName(), ".tmp", localDeployRoot.toFile()); //$NON-NLS-1$
IPath tempFile = new Path(temp.getAbsolutePath());
PublishUtil.packModuleIntoJar(moduleTree[moduleTree.length-1], tempFile);
- handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ handler = getCallbackHandler(getRootPath(deployPath));
String parentFolder = deployPath.removeLastSegments(1).toString();
handler.makeDirectoryIfRequired(new Path(parentFolder), getSubMon(monitor, 50));
ModuleFile mf = new ModuleFile(tempFile.toFile(), tempFile.lastSegment(), tempFile);
@@ -279,7 +286,7 @@
IModuleResource[] members = PublishUtil.getResources(moduleTree);
File source = PublishUtil.getFile(members[0]);
if( source != null ) {
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ IPublishCopyCallbackHandler handler = getCallbackHandler(getRootPath(destinationPath));
IPath localFilePath = new Path(source.getAbsolutePath());
ModuleFile mf = new ModuleFile(localFilePath.toFile(), localFilePath.lastSegment(), localFilePath);
handler.copyFile(mf, destinationPath, new NullProgressMonitor());
@@ -294,14 +301,14 @@
return new IStatus[] {ce.getStatus()};
}
monitor.done();
- return new IStatus[]{Status.OK_STATUS};
+ return new IStatus[]{};
}
protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Removing Module: " + module[module.length-1].getName(), 100); //$NON-NLS-1$
IPath remotePath = getDeployPath(module, server);
- IPublishCopyCallbackHandler handler = getCallbackHandler(new Path("/")); //$NON-NLS-1$
+ IPublishCopyCallbackHandler handler = getCallbackHandler(getRootPath(remotePath));
handler.deleteResource(remotePath, getSubMon(monitor, 100));
monitor.done();
return Status.OK_STATUS;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2011-01-10 17:20:25 UTC (rev 28049)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/xpl/PublishCopyUtil.java 2011-01-10 17:46:35 UTC (rev 28050)
@@ -148,7 +148,7 @@
IStatus ret = copyFile(in, deployRootFolder.append(relativePath), file.lastModified(), mf);
monitor.worked(100);
monitor.done();
- if( ret != null && ret.isOK())
+ if( ret != null && !ret.isOK())
return new IStatus[] { ret };
} // else silently ignore I guess
return new IStatus[]{};
13 years, 5 months
JBoss Tools SVN: r28049 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-01-10 12:20:25 -0500 (Mon, 10 Jan 2011)
New Revision: 28049
Modified:
trunk/build/publish.sh
Log:
trim up to suffix / when getting component name (avoid nesting)
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-01-10 17:02:56 UTC (rev 28048)
+++ trunk/build/publish.sh 2011-01-10 17:20:25 UTC (rev 28049)
@@ -159,9 +159,10 @@
mv $z ${z}.MD5 ${STAGINGDIR}/components
done
- # unpack component source zips
+ # unpack component source zips like jbosstools-pi4soa-3.1_trunk-Sources-SNAPSHOT.zip or jbosstools-3.2_trunk.component--ws-Sources-SNAPSHOT.zip
for z in $(find ${WORKSPACE}/sources/aggregate/site/zips -name "*Sources*.zip"); do
- zn=${z%*-Sources*.zip}; zn=${zn#*--};
+ zn=${z%*-Sources*.zip}; zn=${zn#*--}; zn=${zn##*/}; zn=${zn#jbosstools-};
+ # zn=${zn%_trunk}; zn=${zn%_stable_branch};
mkdir -p ${STAGINGDIR}/all/sources/${zn}/
unzip -qq -o -d ${STAGINGDIR}/all/sources/${zn}/ $z
done
13 years, 5 months
JBoss Tools SVN: r28048 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-01-10 12:02:56 -0500 (Mon, 10 Jan 2011)
New Revision: 28048
Modified:
trunk/build/publish.sh
Log:
create md5sum for 'additional sources' zip too
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-01-10 16:42:48 UTC (rev 28047)
+++ trunk/build/publish.sh 2011-01-10 17:02:56 UTC (rev 28048)
@@ -148,6 +148,7 @@
-x workingset\* -x labs\* -x build\* -x \*test\* -x \*target\* -x \*.class -x \*.svn\* -x \*classes\* -x \*bin\* -x \*.zip \
-x \*docs\* -x \*reference\* -x \*releng\* -x \*.git\*
popd
+z=${STAGINGDIR}/all/${srczipname}; for m in $(md5sum ${z}); do if [[ $m != ${z} ]]; then echo $m > ${z}.MD5; fi; done
# collect component zips from upstream aggregated build jobs
if [[ ${JOB_NAME/.aggregate} != ${JOB_NAME} ]] && [[ -d ${WORKSPACE}/sources/aggregate/site/zips ]]; then
@@ -172,8 +173,7 @@
popd
rm -fr ${STAGINGDIR}/all/sources
- z=${STAGINGDIR}/all/${SRCSNAME}
- for m in $(md5sum ${z}); do if [[ $m != ${z} ]]; then echo $m > ${z}.MD5; fi; done
+ z=${STAGINGDIR}/all/${SRCSNAME}; for m in $(md5sum ${z}); do if [[ $m != ${z} ]]; then echo $m > ${z}.MD5; fi; done
fi
# generate list of zips in this job
13 years, 5 months
JBoss Tools SVN: r28047 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-01-10 11:42:48 -0500 (Mon, 10 Jan 2011)
New Revision: 28047
Modified:
trunk/build/publish.sh
Log:
move composite md5sum file to logs/
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-01-10 16:20:36 UTC (rev 28046)
+++ trunk/build/publish.sh 2011-01-10 16:42:48 UTC (rev 28047)
@@ -187,7 +187,7 @@
echo "" >> ${STAGINGDIR}/logs/${METAFILE}
# generate md5sums in a single file
-md5sumsFile=${STAGINGDIR}/all/${JOB_NAME}-md5sums-${BUILD_ID}-H${BUILD_NUMBER}.txt
+md5sumsFile=${STAGINGDIR}/logs/${JOB_NAME}-md5sums-${BUILD_ID}-H${BUILD_NUMBER}.txt
echo "# Update Site Zips" > ${md5sumsFile}
echo "# ----------------" >> ${md5sumsFile}
md5sum $(find . -name "*Update*.zip" | egrep -v "aggregate-Sources|nightly-Update") >> ${md5sumsFile}
13 years, 5 months
JBoss Tools SVN: r28046 - in trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test: fakes and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-01-10 11:20:36 -0500 (Mon, 10 Jan 2011)
New Revision: 28046
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java
Log:
[JBIDE-7935] added tests to unmarshalling hardware profiles
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-01-10 16:13:52 UTC (rev 28045)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-01-10 16:20:36 UTC (rev 28046)
@@ -15,6 +15,8 @@
import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
import javax.xml.bind.JAXBException;
@@ -22,8 +24,10 @@
import org.jboss.tools.deltacloud.core.client.HardwareProfile;
import org.jboss.tools.deltacloud.core.client.Property;
import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfileUnmarshaller;
+import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfilesUnmarshaller;
import org.jboss.tools.internal.deltacloud.test.fakes.HardwareProfileResponseFakes.HardwareProfile1Response;
import org.jboss.tools.internal.deltacloud.test.fakes.HardwareProfileResponseFakes.HardwareProfile2Response;
+import org.jboss.tools.internal.deltacloud.test.fakes.HardwareProfileResponseFakes.HardwareProfilesResponse;
import org.junit.Test;
/**
@@ -32,6 +36,15 @@
public class HardwareProfileDomUnmarshallingTest {
@Test
+ public void HardwareProfilesCanBeUnmarshalled() throws MalformedURLException, JAXBException,
+ DeltaCloudClientException {
+ List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(HardwareProfilesResponse.response.getBytes());
+ new HardwareProfilesUnmarshaller().unmarshall(inputStream, profiles);
+ assertEquals(2, profiles.size());
+ }
+
+ @Test
public void fixedPropertyHardwareProfileMayBeUnmarshalled() throws MalformedURLException, JAXBException,
DeltaCloudClientException {
HardwareProfile profile = new HardwareProfile();
Modified: 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-01-10 16:13:52 UTC (rev 28045)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java 2011-01-10 16:20:36 UTC (rev 28046)
@@ -11,33 +11,26 @@
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 enum Units {
- GB, MB, COUNT, LABEL
- };
-
- public static class PropertyResponse {
-
- }
-
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 = Units.MB.name();
+ 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 = Units.GB.name();
+ 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 = Units.COUNT.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 = Units.LABEL.name().toLowerCase();
+ public static final String propArchUnit = UNIT.LABEL.name().toLowerCase();
public static final String propArchValue = "i386";
public static final String response = getHardwareProfileResponseXML(
@@ -55,20 +48,20 @@
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 = Units.MB.name();
+ 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 = Units.GB.name();
+ 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 = Units.COUNT.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 = Units.LABEL.name().toLowerCase();
+ public static final String propArchUnit = UNIT.LABEL.name().toLowerCase();
public static final String propArchValue = "x86_64";
public static final String response = getHardwareProfileResponseXML(
@@ -86,6 +79,11 @@
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) {
13 years, 5 months
JBoss Tools SVN: r28045 - 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-01-10 11:13:52 -0500 (Mon, 10 Jan 2011)
New Revision: 28045
Added:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java
Modified:
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch
trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java
Log:
[JBIDE-7935] added tests to unmarshalling hardware profiles
Modified: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch 2011-01-10 16:13:00 UTC (rev 28044)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/DeltaCloudTestSuite.launch 2011-01-10 16:13:52 UTC (rev 28045)
@@ -12,7 +12,7 @@
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
-<stringAttribute key="deselected_workspace_plugins" value="org.jboss.tools.deltacloud.integration,org.jboss.tools.tests,org.jboss.tools.deltacloud.docs,org.jboss.tools.deltacloud.ui"/>
+<stringAttribute key="deselected_workspace_plugins" value="org.jboss.ide.eclipse.as.wtp.ui,org.jboss.tools.ui.bot.ext,org.jboss.ide.eclipse.as.core,org.jboss.tools.common.projecttemplates,org.jboss.ide.eclipse.as.rse.core,org.jboss.tools.tests.performance,org.jboss.tools.common.el.core,org.jboss.ide.eclipse.as.ui.mbeans,org.jboss.tools.common.gef,org.jboss.ide.eclipse.as.archives.integration.test,org.jboss.tools.common.verification.test,org.jboss.ide.eclipse.archives.core,org.jboss.tools.common.verification,org.jboss.ide.eclipse.archives.jdt.integration,org.jboss.tools.jmx.core.test,org.jboss.tools.common.model,org.jboss.ide.eclipse.as.classpath.core,org.jboss.ide.eclipse.archives.test,org.jboss.ide.eclipse.as.classpath.ui,org.jboss.tools.deltacloud.integration,org.jboss.tools.common.ui,org.jboss.tools.usage,org.jboss.tools.usage.test,org.jboss.tools.common.text.ext,org.jboss.tools.jmx.ui,org.jboss.tools.ui.bot.ext.test,org.jboss.tools.common.el.core.test,org.jboss.tools.co!
mmon.model.ui.test,org.jboss.tools.tests,org.jboss.tools.common.text.xml,org.jboss.ide.eclipse.as.ui.test,org.jboss.tools.common.meta.ui,org.jboss.ide.eclipse.archives.webtools,org.jboss.tools.deltacloud.docs,org.jboss.tools.common.verification.ui.test,org.jboss.ide.eclipse.as.rse.ui,com.jboss.jbds.usage.branding,org.jboss.tools.common.verification.ui,org.jboss.ide.eclipse.as.wtp.core,org.jboss.tools.common.test,org.jboss.tools.deltacloud.ui,org.jboss.tools.gwt.ui,org.jboss.tools.common.model.ui.capabilities,org.jboss.tools.common.resref.core,org.eclipse.jsch.ui,org.jboss.ide.eclipse.archives.ui,org.jboss.ide.eclipse.as.test,org.jboss.tools.common.el.ui,org.jboss.tools.gwt.core,org.jboss.tools.jmx.ui.test,org.jboss.ide.eclipse.as.ssh,org.jboss.tools.common.resref.ui,org.jboss.ide.eclipse.as.ui,org.jboss.ide.eclipse.archives.ui.test,org.jboss.ide.eclipse.as.doc.user,org.jboss.tools.jmx.core,org.jboss.tools.common.model.ui,org.jboss.tools.common.model.test"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -38,8 +38,8 @@
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
-<stringAttribute key="selected_target_plugins" value="org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.ui.views@default:default,org.eclipse.ui.navigator@default:default,org.eclipse.core.variables@default:default,org.eclipse.ui.forms@default:default,org.eclipse.osgi@-1:true,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.core.runtime@default:true,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.jem.util@default:default,org.eclipse.osgi.util@default:default,org.eclipse.wst.common.emf@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.ecf@default:default,org.eclipse.core.jobs@default:default,org.eclipse.wst.sse.core@default:default,javax.servlet@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.ui.navigator.resources@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.jdt.core@default:default,org.eclipse.equinox.p!
2.metadata.repository@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.debug.ui@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ui.editors@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.ui@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.databinding@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.hamcrest.core@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.apache.xml.resolver@default:default,org.eclipse.debug.core@default:default,org.eclipse.jdt.ui@default:default,org.apache.xerces@default:default,org.eclipse.u!
i.ide@default:default,org.eclipse.jface@default:default,org.ec!
lipse.jd
t.debug@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.osgi.services@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.wst.common.frameworks@default:default,com.ibm.icu@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.equinox.common@2:true,org.eclipse.jdt.core.manipulation@default:default,org.eclipse.text@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.help@default:default,org.eclipse.compare@default:default,org.eclipse.core.net@default:default,org.eclipse.emf.edit@default:default,org.eclipse.equinox.app@default:default,org.eclipse.team.ui@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.emf.common@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.equinox.p2.repository@default:de!
fault,javax.xml@default:default,org.eclipse.wst.validation@default:default,org.eclipse.core.filebuffers@default:default,org.eclipse.core.commands@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.search@default:default,org.eclipse.core.expressions@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.team.core@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.ui.console@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.swt@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.wst.xml.core@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.!
wst.common.core@default:default,org.eclipse.equinox.concurrent!
@default
:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.ant.core@default:default,org.apache.xml.serializer@default:default,org.eclipse.core.runtime.compatibility.registry@default:false"/>
-<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.common.model.ui.test@default:default,org.jboss.ide.eclipse.as.ui.mbeans@default:default,org.jboss.ide.eclipse.archives.ui.test@default:default,org.jboss.ide.eclipse.archives.webtools@default:default,org.jboss.ide.eclipse.as.classpath.core@default:default,org.jboss.tools.common.el.ui@default:default,org.jboss.tools.deltacloud.core@default:default,org.jboss.tools.common.text.ext@default:default,org.jboss.tools.ui.bot.ext.test@default:default,org.jboss.ide.eclipse.as.core@default:default,org.jboss.ide.eclipse.as.archives.integration.test@default:default,org.jboss.tools.common.meta.ui@default:default,org.jboss.tools.common.verification.ui.test@default:default,org.jboss.tools.ui.bot.ext@default:default,org.jboss.tools.common.resref.ui@default:default,org.jboss.tools.common.gef@default:default,org.jboss.ide.eclipse.as.wtp.ui@default:default,org.jboss.tools.common.model.ui@default:default,org.jboss.ide.eclips!
e.archives.ui@default:default,org.jboss.tools.jmx.core.test@default:default,org.jboss.ide.eclipse.as.rse.core@default:default,org.jboss.tools.common.model.test@default:default,org.jboss.tools.common.ui@default:default,org.jboss.tools.common.model.ui.capabilities@default:default,org.jboss.tools.jmx.ui@default:default,org.jboss.tools.common.el.core@default:default,org.jboss.ide.eclipse.as.wtp.core@default:default,org.jboss.tools.common.verification@default:default,org.jboss.tools.common.text.xml@default:default,org.jboss.ide.eclipse.archives.jdt.integration@default:default,org.jboss.ide.eclipse.as.rse.ui@default:default,org.jboss.tools.tests.performance@default:default,org.jboss.ide.eclipse.as.test@default:default,org.jboss.ide.eclipse.as.ui.test@default:default,org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.common.projecttemplates@default:default,org.jboss.tools.common.model@default:default,org.jboss.ide.eclipse.as.doc.user@default:default,org.jboss.ide.ecli!
pse.archives.core@default:default,org.jboss.tools.common.test@!
default:
default,org.jboss.tools.common.verification.ui@default:default,org.jboss.tools.jmx.ui.test@default:default,org.jboss.tools.common@default:default,org.jboss.ide.eclipse.as.ssh@default:default,org.jboss.tools.common.verification.test@default:default,org.jboss.ide.eclipse.archives.test@default:default,org.jboss.tools.jmx.core@default:default,org.jboss.tools.common.resref.core@default:default,org.jboss.ide.eclipse.as.ui@default:default,org.jboss.ide.eclipse.as.classpath.ui@default:default,org.jboss.tools.common.el.core.test@default:default"/>
+<stringAttribute key="selected_target_plugins" value="org.eclipse.ui.navigator@default:default,org.apache.commons.codec*1.3.0.v20100518-1140@default:default,org.eclipse.ltk.core.refactoring@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.wst.common.emf@default:default,com.ibm.icu@default:default,org.eclipse.ui.views.properties.tabbed@default:default,org.eclipse.equinox.p2.core@default:default,javax.servlet@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.jface.databinding@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.jdt.compiler.apt@default:false,org.eclipse.jdt.debug@default:default,org.eclipse.ui@default:default,org.eclipse.search@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.compare.core@default:default,org.eclipse!
.core.runtime.compatibility.auth@default:default,org.eclipse.core.net@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.databinding@default:default,org.eclipse.jdt.compiler.tool@default:false,org.eclipse.core.resources@default:default,org.eclipse.wst.common.uriresolver@default:default,org.eclipse.jdt.launching@default:default,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.equinox.p2.metadata@default:default,org.apache.commons.httpclient*3.1.0.v201005080502@default:default,org.eclipse.wst.xml.core@default:default,org.apache.xerces@default:default,org.eclipse.osgi,org.eclipse.core.filebuffers@default:default,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.wst.common.core@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.debug.core@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.core.variables@default:default,org.eclipse.jf!
ace.text@default:default,org.eclipse.emf.edit@default:default,!
org.ecli
pse.help@default:default,org.eclipse.wst.common.frameworks@default:default,org.eclipse.team.ui@default:default,org.eclipse.wst.common.project.facet.core@default:default,org.eclipse.ui.console@default:default,org.eclipse.core.contenttype@default:default,org.hamcrest.core@default:default,org.eclipse.jdt.core@default:default,org.eclipse.core.filesystem@default:default,org.eclipse.wst.common.emfworkbench.integration@default:default,org.eclipse.ltk.ui.refactoring@default:default,org.eclipse.equinox.common@default:default,org.eclipse.core.jobs@default:default,org.apache.commons.logging*1.0.4.v201005080501@default:default,org.eclipse.ui.editors@default:default,org.eclipse.ui.navigator.resources@default:default,org.apache.xml.serializer@default:default,org.eclipse.compare@default:default,org.eclipse.ui.forms@default:default,org.eclipse.ui.views@default:default,org.eclipse.swt@default:default,org.eclipse.ui.ide@default:default,org.eclipse.equinox.preferences@default:default,org.eclip!
se.osgi.services@default:default,org.eclipse.ecf.identity@default:default,javax.xml@default:default,org.eclipse.osgi.util@default:default,org.eclipse.jdt.ui@default:default,org.eclipse.wst.validation@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.swt.gtk.linux.x86_64@default:false,org.eclipse.wst.sse.core@default:default,org.eclipse.text@default:default,org.eclipse.debug.ui@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.core.net.linux.x86_64@default:false,org.eclipse.ui.workbench@default:default,org.eclipse.jem.util@default:default,org.eclipse.ecf@default:default,org.eclipse.wst.common.environment@default:default,org.eclipse.equinox.concurrent@default:default,org.eclipse.core.filesystem.linux.x86_64@default:false,org.eclipse.ecf.ssl@default:false,org.eclipse.core.runtime@default:true,org.eclipse.jface@default:default,org.eclipse.jdt.core.manipulation@default:default,org!
.eclipse.core.runtime.compatibility.registry@default:false,org!
.eclipse
.equinox.security@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.team.core@default:default,org.eclipse.ant.core@default:default,org.apache.xml.resolver@default:default"/>
+<stringAttribute key="selected_workspace_plugins" value="org.jboss.tools.common@default:default,org.jboss.tools.deltacloud.test@default:default,org.jboss.tools.deltacloud.core@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
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-01-10 16:13:00 UTC (rev 28044)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/DeltaCloudTestSuite.java 2011-01-10 16:13:52 UTC (rev 28045)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.internal.deltacloud.test;
+import org.jboss.tools.internal.deltacloud.test.core.client.HardwareProfileDomUnmarshallingTest;
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.job.CloudSchedulingRulesTest;
@@ -23,6 +24,7 @@
@Suite.SuiteClasses({
CloudSchedulingRulesTest.class,
KeyDomUnmarshallingTest.class,
- InstanceDomUnmarshallingTest.class})
+ InstanceDomUnmarshallingTest.class,
+ HardwareProfileDomUnmarshallingTest.class})
public class DeltaCloudTestSuite {
}
Added: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java
===================================================================
--- trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java (rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java 2011-01-10 16:13:52 UTC (rev 28045)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.core.client;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
+
+import javax.xml.bind.JAXBException;
+
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.core.client.HardwareProfile;
+import org.jboss.tools.deltacloud.core.client.Property;
+import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfileUnmarshaller;
+import org.jboss.tools.internal.deltacloud.test.fakes.HardwareProfileResponseFakes.HardwareProfile1Response;
+import org.jboss.tools.internal.deltacloud.test.fakes.HardwareProfileResponseFakes.HardwareProfile2Response;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfileDomUnmarshallingTest {
+
+ @Test
+ public void fixedPropertyHardwareProfileMayBeUnmarshalled() throws MalformedURLException, JAXBException,
+ DeltaCloudClientException {
+ HardwareProfile profile = new HardwareProfile();
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(HardwareProfile1Response.response.getBytes());
+ new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
+ assertNotNull(profile);
+ assertEquals(HardwareProfile1Response.id, profile.getId());
+ assertEquals(HardwareProfile1Response.propMemValue + ' ' + HardwareProfile1Response.propMemUnit,
+ profile.getMemory());
+ assertEquals(HardwareProfile1Response.propStorageValue + ' ' + HardwareProfile1Response.propStorageUnit,
+ profile.getStorage());
+ assertEquals(HardwareProfile1Response.propCPUValue, profile.getCPU());
+ assertEquals(HardwareProfile1Response.propArchValue, profile.getArchitecture());
+ }
+
+ @Test
+ public void mixedPropertiesHardwareProfileMayBeUnmarshalled() throws MalformedURLException, JAXBException,
+ DeltaCloudClientException {
+ HardwareProfile profile = new HardwareProfile();
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(HardwareProfile2Response.response.getBytes());
+ new HardwareProfileUnmarshaller().unmarshall(inputStream, profile);
+ assertNotNull(profile);
+ assertEquals(HardwareProfile2Response.id, profile.getId());
+ assertEquals(HardwareProfile2Response.propMemValue + ' ' + HardwareProfile2Response.propMemUnit,
+ profile.getMemory());
+ Property property = profile.getNamedProperty(Property.Names.MEMORY);
+ assertNotNull(property);
+ assertEquals(HardwareProfile2Response.propMemRangeFirst, property.getRange().getFirst());
+ assertEquals(HardwareProfile2Response.propMemRangeLast, property.getRange().getLast());
+ assertEquals(HardwareProfile2Response.propStorageValue + ' ' + HardwareProfile2Response.propStorageUnit,
+ profile.getStorage());
+ property = profile.getNamedProperty(Property.Names.STORAGE);
+ assertNotNull(property);
+ assertNotNull(property.getEnums());
+ assertEquals(2, property.getEnums().size());
+ assertEquals(HardwareProfile2Response.propStorageEnum1, property.getEnums().get(0));
+ assertEquals(HardwareProfile2Response.propStorageEnum2, property.getEnums().get(1));
+ assertEquals(HardwareProfile2Response.propCPUValue, profile.getCPU());
+ assertEquals(HardwareProfile2Response.propArchValue, profile.getArchitecture());
+ }
+
+}
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/core/client/HardwareProfileDomUnmarshallingTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: 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 (rev 0)
+++ trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java 2011-01-10 16:13:52 UTC (rev 28045)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfileResponseFakes {
+
+ public static enum Units {
+ GB, MB, COUNT, LABEL
+ };
+
+ public static class PropertyResponse {
+
+ }
+
+ 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 = Units.MB.name();
+ public static final String propMemValue = "1740.8";
+ public static final String propStorageKind = Property.Kind.FIXED.name().toLowerCase();
+ public static final String propStorageUnit = Units.GB.name();
+ public static final String propStorageValue = "160";
+ public static final String propCPUKind = Property.Kind.FIXED.name().toLowerCase();
+ public static final String propCPUUnit = Units.COUNT.name().toLowerCase();
+ public static final String propCPUValue = "1";
+ public static final String propArchKind = Property.Kind.FIXED.name().toLowerCase();
+ public static final String propArchUnit = Units.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 = Units.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 = Units.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 = Units.COUNT.name().toLowerCase();
+ public static final String propCPUValue = "2";
+ public static final String propArchKind = Property.Kind.FIXED.name().toLowerCase();
+ public static final String propArchUnit = Units.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 {
+
+ }
+
+ 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>";
+
+ }
+
+}
Property changes on: trunk/deltacloud/tests/org.jboss.tools.deltacloud.test/src/org/jboss/tools/internal/deltacloud/test/fakes/HardwareProfileResponseFakes.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r28044 - in trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core: src/org/jboss/tools/deltacloud/core/client and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-01-10 11:13:00 -0500 (Mon, 10 Jan 2011)
New Revision: 28044
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfilesUnmarshaller.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java
Log:
[JBIDE-7935] moved HardwareProfile unmarshalling to HardwareProfileUnmarshaller
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-01-10 15:06:32 UTC (rev 28043)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-01-10 16:13:00 UTC (rev 28044)
@@ -1,3 +1,9 @@
+2011-01-10 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java:
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java (listProfile):
+ [JBIDE-7935] moved HardwareProfile unmarshalling to HardwareProfileUnmarshaller
+
2011-01-04 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstancesRepository.java:
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2011-01-10 15:06:32 UTC (rev 28043)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientImpl.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -42,7 +42,6 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.eclipse.core.runtime.Assert;
-import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProperty.Kind;
import org.jboss.tools.deltacloud.core.client.request.AbstractListObjectsRequest;
import org.jboss.tools.deltacloud.core.client.request.CreateInstanceRequest;
import org.jboss.tools.deltacloud.core.client.request.CreateKeyRequest;
@@ -60,6 +59,7 @@
import org.jboss.tools.deltacloud.core.client.request.ListRealmsRequest;
import org.jboss.tools.deltacloud.core.client.request.PerformInstanceActionRequest;
import org.jboss.tools.deltacloud.core.client.request.TypeRequest;
+import org.jboss.tools.deltacloud.core.client.unmarshal.HardwareProfilesUnmarshaller;
import org.jboss.tools.deltacloud.core.client.unmarshal.InstanceUnmarshaller;
import org.jboss.tools.deltacloud.core.client.unmarshal.InstancesUnmarshaller;
import org.jboss.tools.deltacloud.core.client.unmarshal.KeyUnmarshaller;
@@ -326,87 +326,16 @@
@Override
public List<HardwareProfile> listProfiles() throws DeltaCloudClientException {
try {
- return buildProfiles(request(new ListHardwareProfilesRequest(baseUrl)));
+ InputStream response = request(new ListHardwareProfilesRequest(baseUrl));
+ List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
+ new HardwareProfilesUnmarshaller().unmarshall(response, profiles);
+ return profiles;
} catch (Exception e) {
throw new DeltaCloudClientException(MessageFormat.format("could not get realms on cloud at \"{0}\"",
baseUrl), e);
}
}
- private List<HardwareProfile> buildProfiles(InputStream inputStream)
- throws ParserConfigurationException, SAXException, IOException, DeltaCloudClientException {
- Document document = getDocument(getResponse(inputStream));
- List<HardwareProfile> profiles = new ArrayList<HardwareProfile>();
- NodeList elements = document.getElementsByTagName("hardware_profile");
- for (int i = 0; i < elements.getLength(); i++) {
- HardwareProfile profile = createProfile(elements.item(i));
- profiles.add(profile);
- }
- return profiles;
- }
-
- private HardwareProfile createProfile(Node node) {
- Assert.isLegal(node instanceof Element);
- Element element = (Element) node;
- HardwareProfile profile = new HardwareProfile();
- profile.setId(element.getAttribute("id"));
- profile.setProperties(createProperties(element.getElementsByTagName("property")));
- return profile;
- }
-
- private List<Property> createProperties(NodeList propertiesList) {
- List<Property> properties = new ArrayList<Property>();
- for (int i = 0; i < propertiesList.getLength(); i++) {
- Property property = createProperty(propertiesList.item(i));
- properties.add(property);
- }
- return properties;
- }
-
- private Property createProperty(Node node) {
- Assert.isTrue(node instanceof Element);
- Element element = (Element) node;
- Property property = new Property();
- property.setName(element.getAttribute("name"));
- property.setId(element.getAttribute("id"));
- property.setUnit(element.getAttribute("unit"));
- property.setValue(element.getAttribute("value"));
- String kind = element.getAttribute("kind");
- Assert.isTrue(kind != null);
- kind = kind.toUpperCase();
- property.setKind(kind);
- if (Kind.RANGE.toString().equals(property.getKind())) {
- setRange(element, property);
- } else if (Kind.ENUM.toString().equals(property.getKind())) {
- setEnum(element, property);
- } else if (Kind.FIXED.toString().equals(property.getKind())) {
- // no special treatement
- }
- return property;
- }
-
- private void setRange(Element propertyElement, Property property) {
- Node node = propertyElement.getElementsByTagName("range").item(0);
- Assert.isLegal(node instanceof Element);
- Element rangeElement = (Element) node;
- property.setRange(rangeElement.getAttribute("first"), rangeElement.getAttribute("last"));
- }
-
- private void setEnum(Element propertyElement, Property property) {
- Node node = propertyElement.getElementsByTagName("enum").item(0);
- Assert.isLegal(node instanceof Element);
- Element enumElement = (Element) node;
- NodeList nodeList = enumElement.getElementsByTagName("entry");
- ArrayList<String> enumValues = new ArrayList<String>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node entryNode = nodeList.item(i);
- Assert.isTrue(entryNode instanceof Element);
- Element entryElement = (Element) entryNode;
- enumValues.add(entryElement.getAttribute("value"));
- }
- property.setEnums(enumValues);
- }
-
@Override
public List<Image> listImages() throws DeltaCloudClientException {
return listDeltaCloudObjects(Image.class,
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2011-01-10 15:06:32 UTC (rev 28043)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -13,30 +13,38 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.tools.deltacloud.core.client.Property.Names;
+
/**
* @author Martyn Taylor
+ * @author André Dietisheim
*/
-public class HardwareProfile extends AbstractDeltaCloudObject
-{
+public class HardwareProfile extends AbstractDeltaCloudObject {
private static final long serialVersionUID = 1L;
private List<Property> properties;
-
- protected HardwareProfile()
- {
+
+ public HardwareProfile() {
}
- protected void setProperties(List<Property> properties) {
+ public void setProperties(List<Property> properties) {
this.properties = properties;
}
-
+
public List<Property> getProperties() {
if (properties == null)
properties = new ArrayList<Property>();
return properties;
}
-
- private Property getNamedProperty(String name) {
+
+ public Property getNamedProperty(Names nameEnum) {
+ if (nameEnum == null) {
+ return null;
+ }
+ return getNamedProperty(nameEnum.name().toLowerCase());
+ }
+
+ public Property getNamedProperty(String name) {
if (properties != null) {
for (Property p : properties) {
if (p.getName().equals(name))
@@ -45,43 +53,37 @@
}
return null;
}
-
- public String getArchitecture()
- {
- Property p = getNamedProperty("architecture");
+
+ public String getArchitecture() {
+ Property p = getNamedProperty(Property.Names.ARCHITECTURE);
if (p != null)
return p.getValue();
return null;
}
- public String getMemory()
- {
+ public String getMemory() {
Property p = getNamedProperty("memory");
if (p != null)
return p.toString();
return null;
}
-
- public String getStorage()
- {
+
+ public String getStorage() {
Property p = getNamedProperty("storage");
if (p != null)
return p.toString();
return null;
}
- public String getCPU()
- {
+ public String getCPU() {
Property p = getNamedProperty("cpu");
if (p != null)
return p.getValue();
return null;
}
-
-
+
@Override
- public String toString()
- {
+ public String toString() {
String s = "";
s += "Hardware-profile:\t\t" + getId() + "\n";
for (Property p : properties) {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2011-01-10 15:06:32 UTC (rev 28043)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -12,121 +12,151 @@
import java.util.List;
-import javax.xml.bind.annotation.XmlElement;
-
/**
* @author Martyn Taylor
*/
public class Property extends AbstractDeltaCloudObject {
-
+
private static final long serialVersionUID = 1L;
- public static enum Kind {FIXED, RANGE, ENUM};
+ public static enum Kind {
+ FIXED, RANGE, ENUM
+ };
+ public static enum Names {
+ MEMORY, STORAGE, CPU, ARCHITECTURE
+ }
+
+ public static enum UNIT {
+ MB {
+ public boolean matches(String value) {
+ return name().equals(value);
+ }},
+ GB{
+ public boolean matches(String value) {
+ return name().equals(value);
+ }},
+ LABEL{
+ public boolean matches(String value) {
+ return name().toLowerCase().equals(value);
+ }},
+ COUNT{
+ public boolean matches(String value) {
+ return name().toLowerCase().equals(value);
+ }};
+
+ public abstract boolean matches(String value);
+ }
+
public class Range {
private String first;
private String last;
-
+
public Range(String first, String last) {
this.first = first;
this.last = last;
}
-
+
public String getFirst() {
return first;
}
-
+
public String getLast() {
return last;
}
}
-
- public Property()
- {
+
+ public Property() {
}
-
- @XmlElement
+
private String kind;
-
- @XmlElement
+
private String unit;
-
- @XmlElement
+
private String name;
-
- @XmlElement
+
private String value;
-
+
// For range
private String first;
private String last;
-
+
// For enum
private List<String> enums;
-
+
public String getKind() {
return kind;
}
-
+
public String getUnit() {
return unit;
}
-
+
public String getName() {
return name;
}
-
+
public String getValue() {
return value;
}
-
+
public Range getRange() {
return new Range(first, last);
}
-
+
public List<String> getEnums() {
return enums;
}
-
+
public void setName(String name) {
this.name = name;
}
-
+
public void setValue(String value) {
this.value = value;
}
-
+
public void setUnit(String unit) {
this.unit = unit;
}
-
+
public void setKind(String kind) {
this.kind = kind;
}
-
+
public void setRange(String first, String last) {
this.first = first;
this.last = last;
}
-
+
public void setEnums(List<String> enums) {
this.enums = enums;
}
-
+
public String toString() {
if (kind.equals("range")) {
- return first += "-" + last + "(default:" + value + ")";
- }
- else if (kind.equals("enum")) {
+ // return first += "-" + last + "(default:" + value + ")";
+ return new StringBuilder()
+ .append(first)
+ .append('-').append(last)
+ .append("(default: ").append(value).append(")")
+ .toString();
+ } else if (kind.equals("enum")) {
String s = enums.get(0);
for (int i = 1; i < enums.size(); ++i) {
s += ", " + enums.get(i);
}
- s += " (default:" + value + ")";
+ s += " (default:" + value + ")";
return s;
+ } else {
+ // return value += " " + (unit.equals("label") ? "" : unit);
+ StringBuilder builder = new StringBuilder();
+ builder.append(value);
+ if (!UNIT.LABEL.matches(unit)) {
+ builder.append(' ').append(unit);
+ }
+ return builder.toString();
}
- // must be "fixed"
- return value += " " + (unit.equals("label") ? "" : unit);
}
-
+
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java 2011-01-10 15:06:32 UTC (rev 28043)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/AbstractDOMUnmarshaller.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -41,10 +41,13 @@
this.tagName = tagName;
}
- public DELTACLOUDOBJECT unmarshall(InputStream inputStream, DELTACLOUDOBJECT resource) throws DeltaCloudClientException {
+ public DELTACLOUDOBJECT unmarshall(InputStream inputStream, DELTACLOUDOBJECT deltacloudObject) throws DeltaCloudClientException {
try {
Element element = getFirstElement(tagName, getDocument(inputStream));
- return unmarshall(element, resource);
+ if (element == null) {
+ return null;
+ }
+ return unmarshall(element, deltacloudObject);
} catch (Exception e) {
// TODO: internationalize strings
throw new DeltaCloudClientException(
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.deltacloud.core.client.unmarshal;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProperty.Kind;
+import org.jboss.tools.deltacloud.core.client.HardwareProfile;
+import org.jboss.tools.deltacloud.core.client.Property;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfileUnmarshaller extends AbstractDOMUnmarshaller<HardwareProfile> {
+
+ public HardwareProfileUnmarshaller() {
+ super("hardware_profile", HardwareProfile.class);
+ }
+
+ @Override
+ protected HardwareProfile doUnmarshall(Element element, HardwareProfile profile) throws Exception {
+ profile.setId(getAttributeText("id", element));
+ profile.setProperties(createProperties(element.getElementsByTagName("property")));
+ return profile;
+ }
+
+ private List<Property> createProperties(NodeList propertiesList) {
+ List<Property> properties = new ArrayList<Property>();
+ for (int i = 0; i < propertiesList.getLength(); i++) {
+ Property property = createProperty(propertiesList.item(i));
+ properties.add(property);
+ }
+ return properties;
+ }
+
+ private Property createProperty(Node node) {
+ Assert.isTrue(node instanceof Element);
+ Element element = (Element) node;
+ Property property = new Property();
+ property.setName(element.getAttribute("name"));
+ property.setId(element.getAttribute("id"));
+ property.setUnit(element.getAttribute("unit"));
+ property.setValue(element.getAttribute("value"));
+ String kind = element.getAttribute("kind");
+ Assert.isTrue(kind != null);
+ kind = kind.toUpperCase();
+ property.setKind(kind);
+ if (Kind.RANGE.toString().equals(property.getKind())) {
+ setRange(element, property);
+ } else if (Kind.ENUM.toString().equals(property.getKind())) {
+ setEnum(element, property);
+ } else if (Kind.FIXED.toString().equals(property.getKind())) {
+ // no special treatement
+ }
+ return property;
+ }
+
+ private void setRange(Element propertyElement, Property property) {
+ Node node = propertyElement.getElementsByTagName("range").item(0);
+ Assert.isLegal(node instanceof Element);
+ Element rangeElement = (Element) node;
+ property.setRange(rangeElement.getAttribute("first"), rangeElement.getAttribute("last"));
+ }
+
+ private void setEnum(Element propertyElement, Property property) {
+ Node node = propertyElement.getElementsByTagName("enum").item(0);
+ Assert.isLegal(node instanceof Element);
+ Element enumElement = (Element) node;
+ NodeList nodeList = enumElement.getElementsByTagName("entry");
+ ArrayList<String> enumValues = new ArrayList<String>();
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node entryNode = nodeList.item(i);
+ Assert.isTrue(entryNode instanceof Element);
+ Element entryElement = (Element) entryNode;
+ enumValues.add(entryElement.getAttribute("value"));
+ }
+ property.setEnums(enumValues);
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfileUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfilesUnmarshaller.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfilesUnmarshaller.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfilesUnmarshaller.java 2011-01-10 16:13:00 UTC (rev 28044)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.deltacloud.core.client.unmarshal;
+
+import org.jboss.tools.deltacloud.core.client.DeltaCloudClientException;
+import org.jboss.tools.deltacloud.core.client.HardwareProfile;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author André Dietisheim
+ */
+public class HardwareProfilesUnmarshaller extends AbstractDeltaCloudObjectsUnmarshaller<HardwareProfile> {
+
+ public HardwareProfilesUnmarshaller() {
+ super("hardware_profiles", "hardware_profile");
+ }
+
+ @Override
+ protected HardwareProfile unmarshallChild(Node node) throws DeltaCloudClientException {
+ return new HardwareProfileUnmarshaller().unmarshall((Element) node, new HardwareProfile());
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/unmarshal/HardwareProfilesUnmarshaller.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
13 years, 5 months