Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 87233 Details for
Bug 202695
Encrypted datapool variable support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Request for code review
patch_new.txt (text/plain), 158.73 KB, created by
Xin Ying Huang
on 2008-01-18 01:30:36 EST
(
hide
)
Description:
Request for code review
Filename:
MIME Type:
Creator:
Xin Ying Huang
Created:
2008-01-18 01:30:36 EST
Size:
158.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.models >Index: src-test/org/eclipse/hyades/models/common/datapool/DPLVariable.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/DPLVariable.java,v >retrieving revision 1.6 >diff -u -r1.6 DPLVariable.java >--- src-test/org/eclipse/hyades/models/common/datapool/DPLVariable.java 8 Feb 2006 19:57:07 -0000 1.6 >+++ src-test/org/eclipse/hyades/models/common/datapool/DPLVariable.java 18 Jan 2008 02:50:40 -0000 >@@ -32,6 +32,7 @@ > * <ul> > * <li>{@link org.eclipse.hyades.models.common.datapool.DPLVariable#getType <em>Type</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.DPLVariable#getRole <em>Role</em>}</li> >+ * <li>{@link org.eclipse.hyades.models.common.datapool.DPLVariable#isEncrypted <em>Encrypted</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.DPLVariable#getVariables <em>Variables</em>}</li> > * </ul> > * </p> >@@ -40,7 +41,7 @@ > * @model > * @generated > */ >-public interface DPLVariable extends CMNNamedElement, IDatapoolVariable{ >+public interface DPLVariable extends CMNNamedElement, IDatapoolVariable { > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -104,6 +105,36 @@ > void setRole(DPLRole value); > > /** >+ * Returns the value of the '<em><b>Encrypted</b></em>' attribute. >+ * The default value is <code>"false"</code>. >+ * <!-- begin-user-doc --> >+ * <p> >+ * If the meaning of the '<em>Encrypted</em>' attribute isn't clear, >+ * there really should be more of a description here... >+ * </p> >+ * <!-- end-user-doc --> >+ * <!-- begin-model-doc --> >+ * This boolean specifies whether or not this DPLVariable is encrypted. >+ * <!-- end-model-doc --> >+ * @return the value of the '<em>Encrypted</em>' attribute. >+ * @see #setEncrypted(boolean) >+ * @see org.eclipse.hyades.models.common.datapool.Common_DatapoolPackage#getDPLVariable_Encrypted() >+ * @model default="false" >+ * @generated >+ */ >+ boolean isEncrypted(); >+ >+ /** >+ * Sets the value of the '{@link org.eclipse.hyades.models.common.datapool.DPLVariable#isEncrypted <em>Encrypted</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @param value the new value of the '<em>Encrypted</em>' attribute. >+ * @see #isEncrypted() >+ * @generated >+ */ >+ void setEncrypted(boolean value); >+ >+ /** > * Returns the value of the '<em><b>Variables</b></em>' containment reference list. > * The list contents are of type {@link org.eclipse.hyades.models.common.datapool.DPLVariable}. > * <!-- begin-user-doc --> >@@ -119,4 +150,5 @@ > */ > EList getVariables(); > >+ > } // DPLVariable >Index: src-test/org/eclipse/hyades/models/common/datapool/Common_DatapoolPackage.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/Common_DatapoolPackage.java,v >retrieving revision 1.7 >diff -u -r1.7 Common_DatapoolPackage.java >--- src-test/org/eclipse/hyades/models/common/datapool/Common_DatapoolPackage.java 27 Mar 2006 23:53:28 -0000 1.7 >+++ src-test/org/eclipse/hyades/models/common/datapool/Common_DatapoolPackage.java 18 Jan 2008 02:50:39 -0000 >@@ -330,13 +330,22 @@ > int DPL_VARIABLE__ROLE = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 1; > > /** >+ * The feature id for the '<em><b>Encrypted</b></em>' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ * @ordered >+ */ >+ int DPL_VARIABLE__ENCRYPTED = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 2; >+ >+ /** > * The feature id for the '<em><b>Variables</b></em>' containment reference list. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int DPL_VARIABLE__VARIABLES = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 2; >+ int DPL_VARIABLE__VARIABLES = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 3; > > /** > * The number of structural features of the '<em>DPL Variable</em>' class. >@@ -345,7 +354,7 @@ > * @generated > * @ordered > */ >- int DPL_VARIABLE_FEATURE_COUNT = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 3; >+ int DPL_VARIABLE_FEATURE_COUNT = CommonPackage.CMN_NAMED_ELEMENT_FEATURE_COUNT + 4; > > /** > * The feature id for the '<em><b>Id</b></em>' attribute. >@@ -402,13 +411,22 @@ > int DPL_DATAPOOL__INSTANTIATIONS = Common_ConfigurationPackage.CFG_CLASS__INSTANTIATIONS; > > /** >+ * The feature id for the '<em><b>Challenge</b></em>' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ * @ordered >+ */ >+ int DPL_DATAPOOL__CHALLENGE = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 0; >+ >+ /** > * The feature id for the '<em><b>Equivalence Classes</b></em>' containment reference list. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> > * @generated > * @ordered > */ >- int DPL_DATAPOOL__EQUIVALENCE_CLASSES = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 0; >+ int DPL_DATAPOOL__EQUIVALENCE_CLASSES = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 1; > > /** > * The feature id for the '<em><b>Datapool Spec</b></em>' containment reference. >@@ -417,7 +435,7 @@ > * @generated > * @ordered > */ >- int DPL_DATAPOOL__DATAPOOL_SPEC = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 1; >+ int DPL_DATAPOOL__DATAPOOL_SPEC = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 2; > > /** > * The number of structural features of the '<em>DPL Datapool</em>' class. >@@ -426,7 +444,7 @@ > * @generated > * @ordered > */ >- int DPL_DATAPOOL_FEATURE_COUNT = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 2; >+ int DPL_DATAPOOL_FEATURE_COUNT = Common_ConfigurationPackage.CFG_CLASS_FEATURE_COUNT + 3; > > /** > * The meta object id for the '{@link org.eclipse.hyades.models.common.datapool.DPLRole <em>DPL Role</em>}' enum. >@@ -471,6 +489,17 @@ > EClass getDPLDatapool(); > > /** >+ * Returns the meta object for the attribute '{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getChallenge <em>Challenge</em>}'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return the meta object for the attribute '<em>Challenge</em>'. >+ * @see org.eclipse.hyades.models.common.datapool.DPLDatapool#getChallenge() >+ * @see #getDPLDatapool() >+ * @generated >+ */ >+ EAttribute getDPLDatapool_Challenge(); >+ >+ /** > * Returns the meta object for the containment reference list '{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getEquivalenceClasses <em>Equivalence Classes</em>}'. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -610,6 +639,17 @@ > EAttribute getDPLVariable_Role(); > > /** >+ * Returns the meta object for the attribute '{@link org.eclipse.hyades.models.common.datapool.DPLVariable#isEncrypted <em>Encrypted</em>}'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return the meta object for the attribute '<em>Encrypted</em>'. >+ * @see org.eclipse.hyades.models.common.datapool.DPLVariable#isEncrypted() >+ * @see #getDPLVariable() >+ * @generated >+ */ >+ EAttribute getDPLVariable_Encrypted(); >+ >+ /** > * Returns the meta object for the containment reference list '{@link org.eclipse.hyades.models.common.datapool.DPLVariable#getVariables <em>Variables</em>}'. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -767,6 +807,14 @@ > EAttribute DPL_VARIABLE__ROLE = eINSTANCE.getDPLVariable_Role(); > > /** >+ * The meta object literal for the '<em><b>Encrypted</b></em>' attribute feature. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ EAttribute DPL_VARIABLE__ENCRYPTED = eINSTANCE.getDPLVariable_Encrypted(); >+ >+ /** > * The meta object literal for the '<em><b>Variables</b></em>' containment reference list feature. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -785,6 +833,14 @@ > EClass DPL_DATAPOOL = eINSTANCE.getDPLDatapool(); > > /** >+ * The meta object literal for the '<em><b>Challenge</b></em>' attribute feature. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ EAttribute DPL_DATAPOOL__CHALLENGE = eINSTANCE.getDPLDatapool_Challenge(); >+ >+ /** > * The meta object literal for the '<em><b>Equivalence Classes</b></em>' containment reference list feature. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >Index: src-test/org/eclipse/hyades/models/common/datapool/DPLDatapool.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/DPLDatapool.java,v >retrieving revision 1.6 >diff -u -r1.6 DPLDatapool.java >--- src-test/org/eclipse/hyades/models/common/datapool/DPLDatapool.java 8 Feb 2006 19:57:07 -0000 1.6 >+++ src-test/org/eclipse/hyades/models/common/datapool/DPLDatapool.java 18 Jan 2008 02:50:40 -0000 >@@ -31,6 +31,7 @@ > * <p> > * The following features are supported: > * <ul> >+ * <li>{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getChallenge <em>Challenge</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getEquivalenceClasses <em>Equivalence Classes</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getDatapoolSpec <em>Datapool Spec</em>}</li> > * </ul> >@@ -40,7 +41,7 @@ > * @model > * @generated > */ >-public interface DPLDatapool extends CFGClass, CMNNamedElement, IDatapool{ >+public interface DPLDatapool extends CFGClass, CMNNamedElement, IDatapool { > /** > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -49,6 +50,31 @@ > String copyright = ""; > > /** >+ * Returns the value of the '<em><b>Challenge</b></em>' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * <!-- begin-model-doc --> >+ * This string is used to determine whether a user supplied password for an encrypted datapool is correct. >+ * <!-- end-model-doc --> >+ * @return the value of the '<em>Challenge</em>' attribute. >+ * @see #setChallenge(String) >+ * @see org.eclipse.hyades.models.common.datapool.Common_DatapoolPackage#getDPLDatapool_Challenge() >+ * @model >+ * @generated >+ */ >+ String getChallenge(); >+ >+ /** >+ * Sets the value of the '{@link org.eclipse.hyades.models.common.datapool.DPLDatapool#getChallenge <em>Challenge</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @param value the new value of the '<em>Challenge</em>' attribute. >+ * @see #getChallenge() >+ * @generated >+ */ >+ void setChallenge(String value); >+ >+ /** > * Returns the value of the '<em><b>Equivalence Classes</b></em>' containment reference list. > * The list contents are of type {@link org.eclipse.hyades.models.common.datapool.DPLEquivalenceClass}. > * <!-- begin-user-doc --> >@@ -90,4 +116,5 @@ > */ > void setDatapoolSpec(DPLDatapoolSpec value); > >+ > } // DPLDatapool >Index: src-test/org/eclipse/hyades/models/common/datapool/impl/Common_DatapoolPackageImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/impl/Common_DatapoolPackageImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 Common_DatapoolPackageImpl.java >--- src-test/org/eclipse/hyades/models/common/datapool/impl/Common_DatapoolPackageImpl.java 16 Jan 2008 18:24:31 -0000 1.9 >+++ src-test/org/eclipse/hyades/models/common/datapool/impl/Common_DatapoolPackageImpl.java 18 Jan 2008 02:50:42 -0000 >@@ -227,8 +227,17 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public EAttribute getDPLDatapool_Challenge() { >+ return (EAttribute)dplDatapoolEClass.getEStructuralFeatures().get(0); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EReference getDPLDatapool_EquivalenceClasses() { >- return (EReference)dplDatapoolEClass.getEStructuralFeatures().get(0); >+ return (EReference)dplDatapoolEClass.getEStructuralFeatures().get(1); > } > > /** >@@ -237,7 +246,7 @@ > * @generated > */ > public EReference getDPLDatapool_DatapoolSpec() { >- return (EReference)dplDatapoolEClass.getEStructuralFeatures().get(1); >+ return (EReference)dplDatapoolEClass.getEStructuralFeatures().get(2); > } > > /** >@@ -344,8 +353,17 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public EAttribute getDPLVariable_Encrypted() { >+ return (EAttribute)dplVariableEClass.getEStructuralFeatures().get(2); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EReference getDPLVariable_Variables() { >- return (EReference)dplVariableEClass.getEStructuralFeatures().get(2); >+ return (EReference)dplVariableEClass.getEStructuralFeatures().get(3); > } > > /** >@@ -402,9 +420,11 @@ > dplVariableEClass = createEClass(DPL_VARIABLE); > createEAttribute(dplVariableEClass, DPL_VARIABLE__TYPE); > createEAttribute(dplVariableEClass, DPL_VARIABLE__ROLE); >+ createEAttribute(dplVariableEClass, DPL_VARIABLE__ENCRYPTED); > createEReference(dplVariableEClass, DPL_VARIABLE__VARIABLES); > > dplDatapoolEClass = createEClass(DPL_DATAPOOL); >+ createEAttribute(dplDatapoolEClass, DPL_DATAPOOL__CHALLENGE); > createEReference(dplDatapoolEClass, DPL_DATAPOOL__EQUIVALENCE_CLASSES); > createEReference(dplDatapoolEClass, DPL_DATAPOOL__DATAPOOL_SPEC); > >@@ -464,9 +484,11 @@ > initEClass(dplVariableEClass, DPLVariable.class, "DPLVariable", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); > initEAttribute(getDPLVariable_Type(), ecorePackage.getEString(), "type", null, 0, 1, DPLVariable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEAttribute(getDPLVariable_Role(), this.getDPLRole(), "role", null, 0, 1, DPLVariable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >+ initEAttribute(getDPLVariable_Encrypted(), ecorePackage.getEBoolean(), "encrypted", "false", 0, 1, DPLVariable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEReference(getDPLVariable_Variables(), this.getDPLVariable(), null, "variables", null, 0, -1, DPLVariable.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > > initEClass(dplDatapoolEClass, DPLDatapool.class, "DPLDatapool", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >+ initEAttribute(getDPLDatapool_Challenge(), ecorePackage.getEString(), "challenge", null, 0, 1, DPLDatapool.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEReference(getDPLDatapool_EquivalenceClasses(), this.getDPLEquivalenceClass(), null, "equivalenceClasses", null, 0, -1, DPLDatapool.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEReference(getDPLDatapool_DatapoolSpec(), this.getDPLDatapoolSpec(), null, "datapoolSpec", null, 1, 1, DPLDatapool.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > >Index: src-test/org/eclipse/hyades/models/common/datapool/impl/DPLCellImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/impl/DPLCellImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 DPLCellImpl.java >--- src-test/org/eclipse/hyades/models/common/datapool/impl/DPLCellImpl.java 17 Jan 2008 01:38:45 -0000 1.10 >+++ src-test/org/eclipse/hyades/models/common/datapool/impl/DPLCellImpl.java 18 Jan 2008 02:50:42 -0000 >@@ -16,8 +16,10 @@ > > package org.eclipse.hyades.models.common.datapool.impl; > >+import java.util.HashMap; > import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.ecore.EClass; >+import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.emf.ecore.InternalEObject; > import org.eclipse.emf.ecore.impl.ENotificationImpl; > import org.eclipse.emf.ecore.impl.EObjectImpl; >@@ -28,7 +30,9 @@ > import org.eclipse.hyades.models.common.datapool.Common_DatapoolPackage; > import org.eclipse.hyades.models.common.datapool.DPLCell; > import org.eclipse.hyades.models.common.datapool.DPLVariable; >+import org.eclipse.hyades.models.common.datapool.util.DPLPasswordCollection; > import org.eclipse.hyades.models.common.util.DatapoolUtil; >+import org.eclipse.hyades.models.common.util.EncryptionManager; > import org.eclipse.hyades.models.common.util.XMLParserUtil; > import org.w3c.dom.Document; > >@@ -361,7 +365,7 @@ > { > Object cellValue = this.getCellValue(); > if(cellValue != null) >- return cellValue.toString(); >+ return decryptValue(cellValue.toString()); > else > return new String(); > } >@@ -376,7 +380,7 @@ > */ > public long getLongValue() > { >- return Long.parseLong((String)this.getCellValue()); >+ return Long.parseLong(decryptValue((String)this.getCellValue())); > } > > /** >@@ -389,7 +393,7 @@ > */ > public int getIntValue() > { >- return Integer.parseInt((String)this.getCellValue()); >+ return Integer.parseInt(decryptValue((String)this.getCellValue())); > } > > /** >@@ -402,7 +406,7 @@ > */ > public short getShortValue() > { >- return Short.parseShort((String)this.getCellValue()); >+ return Short.parseShort(decryptValue((String)this.getCellValue())); > } > > /** >@@ -415,7 +419,7 @@ > */ > public byte getByteValue() > { >- return Byte.parseByte((String)this.getCellValue()); >+ return Byte.parseByte(decryptValue((String)this.getCellValue())); > } > > /** >@@ -428,7 +432,7 @@ > */ > public double getDoubleValue() > { >- return Double.parseDouble((String)this.getCellValue()); >+ return Double.parseDouble(decryptValue((String)this.getCellValue())); > } > > /** >@@ -441,7 +445,7 @@ > */ > public float getFloatValue() > { >- return Float.parseFloat((String)this.getCellValue()); >+ return Float.parseFloat(decryptValue((String)this.getCellValue())); > } > > /** >@@ -454,7 +458,7 @@ > */ > public boolean getBooleanValue() > { >- return Boolean.getBoolean ((String)this.getCellValue()); >+ return Boolean.getBoolean (decryptValue((String)this.getCellValue())); > } > > /** >@@ -468,7 +472,7 @@ > */ > public char getCharValue() > { >- return ((String)this.getCellValue()).charAt(0); >+ return decryptValue(((String)this.getCellValue())).charAt(0); > } > > /** >@@ -504,7 +508,7 @@ > { > //get the tag and value from the XML fragment > try { >- Document doc = XMLParserUtil.parse(value.toString()); >+ Document doc = XMLParserUtil.parse(value.toString()); > tag = doc.getFirstChild().getNodeName(); > val = doc.getFirstChild().getFirstChild().getNodeValue(); > } >@@ -569,4 +573,23 @@ > else > return START_LITERAL + END_LITERAL; > } >+ /* >+ * decryptValue the cell value >+ */ >+ public String decryptValue(String value){ >+ String result = null; >+ if(value == null) >+ return result; >+ >+ result = value; >+ HashMap passes = DPLPasswordCollection.getInstance().getDatapoolPassword(); >+ String dpName = this.getCellRecord().getEquivalenceClass().getDatapool().getName(); >+ if(passes!=null && passes.size()>0 && dpName != null && this.getVariable().isEncrypted()){ >+ String pass = (String)passes.get(dpName); >+ if(pass != null){ >+ result = EncryptionManager.decrypt(value, pass); >+ } >+ } >+ return result; >+ } > } //DPLCellImpl >Index: src-test/org/eclipse/hyades/models/common/datapool/impl/DPLVariableImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/impl/DPLVariableImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 DPLVariableImpl.java >--- src-test/org/eclipse/hyades/models/common/datapool/impl/DPLVariableImpl.java 16 Jan 2008 18:24:31 -0000 1.9 >+++ src-test/org/eclipse/hyades/models/common/datapool/impl/DPLVariableImpl.java 18 Jan 2008 02:50:50 -0000 >@@ -48,6 +48,7 @@ > * <ul> > * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLVariableImpl#getType <em>Type</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLVariableImpl#getRole <em>Role</em>}</li> >+ * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLVariableImpl#isEncrypted <em>Encrypted</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLVariableImpl#getVariables <em>Variables</em>}</li> > * </ul> > * </p> >@@ -105,6 +106,26 @@ > protected DPLRole role = ROLE_EDEFAULT; > > /** >+ * The default value of the '{@link #isEncrypted() <em>Encrypted</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #isEncrypted() >+ * @generated >+ * @ordered >+ */ >+ protected static final boolean ENCRYPTED_EDEFAULT = false; >+ >+ /** >+ * The cached value of the '{@link #isEncrypted() <em>Encrypted</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #isEncrypted() >+ * @generated >+ * @ordered >+ */ >+ protected boolean encrypted = ENCRYPTED_EDEFAULT; >+ >+ /** > * The cached value of the '{@link #getVariables() <em>Variables</em>}' containment reference list. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -179,6 +200,27 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public boolean isEncrypted() { >+ return encrypted; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void setEncrypted(boolean newEncrypted) { >+ boolean oldEncrypted = encrypted; >+ encrypted = newEncrypted; >+ if (eNotificationRequired()) >+ eNotify(new ENotificationImpl(this, Notification.SET, Common_DatapoolPackage.DPL_VARIABLE__ENCRYPTED, oldEncrypted, encrypted)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EList getVariables() { > if (variables == null) { > variables = new EObjectContainmentEList(DPLVariable.class, this, Common_DatapoolPackage.DPL_VARIABLE__VARIABLES); >@@ -210,6 +252,8 @@ > return getType(); > case Common_DatapoolPackage.DPL_VARIABLE__ROLE: > return getRole(); >+ case Common_DatapoolPackage.DPL_VARIABLE__ENCRYPTED: >+ return isEncrypted() ? Boolean.TRUE : Boolean.FALSE; > case Common_DatapoolPackage.DPL_VARIABLE__VARIABLES: > return getVariables(); > } >@@ -229,6 +273,9 @@ > case Common_DatapoolPackage.DPL_VARIABLE__ROLE: > setRole((DPLRole)newValue); > return; >+ case Common_DatapoolPackage.DPL_VARIABLE__ENCRYPTED: >+ setEncrypted(((Boolean)newValue).booleanValue()); >+ return; > case Common_DatapoolPackage.DPL_VARIABLE__VARIABLES: > getVariables().clear(); > getVariables().addAll((Collection)newValue); >@@ -250,6 +297,9 @@ > case Common_DatapoolPackage.DPL_VARIABLE__ROLE: > setRole(ROLE_EDEFAULT); > return; >+ case Common_DatapoolPackage.DPL_VARIABLE__ENCRYPTED: >+ setEncrypted(ENCRYPTED_EDEFAULT); >+ return; > case Common_DatapoolPackage.DPL_VARIABLE__VARIABLES: > getVariables().clear(); > return; >@@ -267,7 +317,13 @@ > case Common_DatapoolPackage.DPL_VARIABLE__TYPE: > return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); > case Common_DatapoolPackage.DPL_VARIABLE__ROLE: >+ > return role != ROLE_EDEFAULT; >+ >+ case Common_DatapoolPackage.DPL_VARIABLE__ENCRYPTED: >+ >+ return encrypted != ENCRYPTED_EDEFAULT; >+ > case Common_DatapoolPackage.DPL_VARIABLE__VARIABLES: > return variables != null && !variables.isEmpty(); > } >@@ -287,10 +343,13 @@ > result.append(type); > result.append(", role: "); > result.append(role); >+ result.append(", encrypted: "); >+ result.append(encrypted); > result.append(')'); > return result.toString(); > } > >+ > //Beginning of non-generated classes > > //org.eclipse.hyades.edit.datapool.IDatapoolVariable methods >Index: src-test/org/eclipse/hyades/models/common/datapool/impl/DPLDatapoolImpl.java >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.models/src-test/org/eclipse/hyades/models/common/datapool/impl/DPLDatapoolImpl.java,v >retrieving revision 1.11 >diff -u -r1.11 DPLDatapoolImpl.java >--- src-test/org/eclipse/hyades/models/common/datapool/impl/DPLDatapoolImpl.java 16 Jan 2008 18:24:31 -0000 1.11 >+++ src-test/org/eclipse/hyades/models/common/datapool/impl/DPLDatapoolImpl.java 18 Jan 2008 02:50:47 -0000 >@@ -55,6 +55,7 @@ > * <p> > * The following features are implemented: > * <ul> >+ * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLDatapoolImpl#getChallenge <em>Challenge</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLDatapoolImpl#getEquivalenceClasses <em>Equivalence Classes</em>}</li> > * <li>{@link org.eclipse.hyades.models.common.datapool.impl.DPLDatapoolImpl#getDatapoolSpec <em>Datapool Spec</em>}</li> > * </ul> >@@ -73,6 +74,26 @@ > public static final String copyright = ""; > > /** >+ * The default value of the '{@link #getChallenge() <em>Challenge</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #getChallenge() >+ * @generated >+ * @ordered >+ */ >+ protected static final String CHALLENGE_EDEFAULT = null; >+ >+ /** >+ * The cached value of the '{@link #getChallenge() <em>Challenge</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #getChallenge() >+ * @generated >+ * @ordered >+ */ >+ protected String challenge = CHALLENGE_EDEFAULT; >+ >+ /** > * The cached value of the '{@link #getEquivalenceClasses() <em>Equivalence Classes</em>}' containment reference list. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -132,6 +153,27 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public String getChallenge() { >+ return challenge; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void setChallenge(String newChallenge) { >+ String oldChallenge = challenge; >+ challenge = newChallenge; >+ if (eNotificationRequired()) >+ eNotify(new ENotificationImpl(this, Notification.SET, Common_DatapoolPackage.DPL_DATAPOOL__CHALLENGE, oldChallenge, challenge)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EList getEquivalenceClasses() { > if (equivalenceClasses == null) { > equivalenceClasses = new EObjectContainmentEList(DPLEquivalenceClass.class, this, Common_DatapoolPackage.DPL_DATAPOOL__EQUIVALENCE_CLASSES); >@@ -204,6 +246,8 @@ > */ > public Object eGet(int featureID, boolean resolve, boolean coreType) { > switch (featureID) { >+ case Common_DatapoolPackage.DPL_DATAPOOL__CHALLENGE: >+ return getChallenge(); > case Common_DatapoolPackage.DPL_DATAPOOL__EQUIVALENCE_CLASSES: > return getEquivalenceClasses(); > case Common_DatapoolPackage.DPL_DATAPOOL__DATAPOOL_SPEC: >@@ -219,6 +263,9 @@ > */ > public void eSet(int featureID, Object newValue) { > switch (featureID) { >+ case Common_DatapoolPackage.DPL_DATAPOOL__CHALLENGE: >+ setChallenge((String)newValue); >+ return; > case Common_DatapoolPackage.DPL_DATAPOOL__EQUIVALENCE_CLASSES: > getEquivalenceClasses().clear(); > getEquivalenceClasses().addAll((Collection)newValue); >@@ -237,6 +284,9 @@ > */ > public void eUnset(int featureID) { > switch (featureID) { >+ case Common_DatapoolPackage.DPL_DATAPOOL__CHALLENGE: >+ setChallenge(CHALLENGE_EDEFAULT); >+ return; > case Common_DatapoolPackage.DPL_DATAPOOL__EQUIVALENCE_CLASSES: > getEquivalenceClasses().clear(); > return; >@@ -254,6 +304,8 @@ > */ > public boolean eIsSet(int featureID) { > switch (featureID) { >+ case Common_DatapoolPackage.DPL_DATAPOOL__CHALLENGE: >+ return CHALLENGE_EDEFAULT == null ? challenge != null : !CHALLENGE_EDEFAULT.equals(challenge); > case Common_DatapoolPackage.DPL_DATAPOOL__EQUIVALENCE_CLASSES: > return equivalenceClasses != null && !equivalenceClasses.isEmpty(); > case Common_DatapoolPackage.DPL_DATAPOOL__DATAPOOL_SPEC: >@@ -262,6 +314,22 @@ > return super.eIsSet(featureID); > } > >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public String toString() { >+ if (eIsProxy()) return super.toString(); >+ >+ StringBuffer result = new StringBuffer(super.toString()); >+ result.append(" (challenge: "); >+ result.append(challenge); >+ result.append(')'); >+ return result.toString(); >+ } >+ >+ > /* (non-Javadoc) > * @see org.eclipse.hyades.models.common.configuration.impl.CFGClassImpl#getLocation() > */ >Index: src-test/org/eclipse/hyades/models/common/datapool/util/DatapoolEncryptManager.java >=================================================================== >RCS file: src-test/org/eclipse/hyades/models/common/datapool/util/DatapoolEncryptManager.java >diff -N src-test/org/eclipse/hyades/models/common/datapool/util/DatapoolEncryptManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-test/org/eclipse/hyades/models/common/datapool/util/DatapoolEncryptManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,177 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolEncryptManager.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.models.common.datapool.util; >+ >+import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.edit.datapool.IDatapoolCell; >+import org.eclipse.hyades.edit.datapool.IDatapoolRecord; >+import org.eclipse.hyades.execution.runtime.datapool.IDatapoolEquivalenceClass; >+import org.eclipse.hyades.execution.runtime.datapool.IDatapoolVariable; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.datapool.DPLVariable; >+import org.eclipse.hyades.models.common.util.EncryptionManager; >+ >+/** >+ * It's used to provide functions of encryption for a datapool . >+ * >+ * @author Huang Xin Ying >+ */ >+public class DatapoolEncryptManager { >+ >+ public static void encryptedCellInVarible(IDatapoolVariable varible, >+ String key, IDatapool datapool) { >+ >+ // String key = DatapoolKeyManager.getKeyInDatapool(datapool); >+ // IDatapoolEquivalenceClass equivalenceClass = >+ // getDefaultEquivalenceClass(datapool); >+ int index = datapool.getDefaultEquivalenceClassIndex(); >+ if (index == -1) { >+ >+ return; >+ } >+ IDatapoolEquivalenceClass equivalenceClass = datapool >+ .getEquivalenceClass(index); >+ // datapool.get >+ for (int i = 0; i < equivalenceClass.getRecordCount(); i++) { >+ IDatapoolRecord record = (IDatapoolRecord) equivalenceClass >+ .getRecord(i); >+ int cellCount = record.getCellCount(); >+ >+ int variableCount = datapool.getVariableCount(); >+ String rowContents[] = new String[variableCount + 1]; >+ IDatapoolCell[] rowData = new IDatapoolCell[variableCount]; >+ rowContents[0] = String.valueOf(i); >+ >+ for (int k = 0; k < cellCount; k++) { >+ IDatapoolCell cell = (IDatapoolCell) record.getCell(k); >+ if (cell.getCellVariable().getId().equals(varible.getId())) { >+ cell.setCellValue(EncryptionManager.encrypt(cell.getStringValue(), >+ key)); >+ } >+ } >+ } >+ } >+ >+ public static void deencryptedCellInVarible(IDatapoolVariable varible, >+ String key, IDatapool datapool) { >+ int index = datapool.getDefaultEquivalenceClassIndex(); >+ if (index == -1) { >+ return; >+ } >+ IDatapoolEquivalenceClass equivalenceClass = datapool >+ .getEquivalenceClass(index); >+ >+ for (int i = 0; i < equivalenceClass.getRecordCount(); i++) { >+ IDatapoolRecord record = (IDatapoolRecord) equivalenceClass >+ .getRecord(i); >+ int cellCount = record.getCellCount(); >+ >+ int variableCount = datapool.getVariableCount(); >+ String rowContents[] = new String[variableCount + 1]; >+ IDatapoolCell[] rowData = new IDatapoolCell[variableCount]; >+ rowContents[0] = String.valueOf(i); >+ >+ for (int k = 0; k < cellCount; k++) { >+ IDatapoolCell cell = (IDatapoolCell) record.getCell(k); >+ if (cell.getCellVariable().getId().equals(varible.getId())) { >+ cell.setCellValue(EncryptionManager.decrypt(cell.getStringValue(), >+ key)); >+ } >+ } >+ } >+ } >+ >+ public static void ChangeKey(String newKey, IDatapool datapool) { >+ if (!(datapool instanceof DPLDatapool)) >+ return; >+ if (newKey == null || newKey.equals("")) >+ ((DPLDatapool) datapool).setChallenge(null); >+ else >+ ((DPLDatapool) datapool).setChallenge(newKey); >+ } >+ >+ public static void changeKeyOfEncryCell(IDatapool datapool, String oldKey, >+ String newKey) { >+ int variableCount = datapool.getVariableCount(); >+ IDatapoolVariable variable = null; >+ for (int i = 0; i < variableCount; i++) { >+ variable = datapool.getVariable(i); >+ if (isVaribelEncrypted(variable)) { >+ deencryptedCellInVarible(variable, oldKey, datapool); >+ encryptedCellInVarible(variable, newKey, datapool); >+ } >+ } >+ } >+ >+ public static void deencrypDatapool(IDatapool datapool, String key){ >+ int variableCount = datapool.getVariableCount(); >+ IDatapoolVariable variable = null; >+ for (int i = 0; i < variableCount; i++) { >+ variable = datapool.getVariable(i); >+ if (isVaribelEncrypted(variable)) { >+ deencryptedCellInVarible(variable, key, datapool); >+ } >+ } >+ } >+ >+ public static void encrypDatapool(IDatapool datapool, String key){ >+ int variableCount = datapool.getVariableCount(); >+ IDatapoolVariable variable = null; >+ for (int i = 0; i < variableCount; i++) { >+ variable = datapool.getVariable(i); >+ if (isVaribelEncrypted(variable)) { >+ encryptedCellInVarible(variable, key, datapool); >+ } >+ } >+ } >+ >+ public static boolean isDatapoolEncrypted(IDatapool datapool) { >+ if (!(datapool instanceof DPLDatapool)) >+ return false; >+ >+ if (((DPLDatapool) datapool).getChallenge() == null >+ || ((DPLDatapool) datapool).getChallenge().equals("")) >+ return false; >+ return true; >+ } >+ >+ public static boolean isKeyCorrect(IDatapool datapool, String key) { >+ if (!(datapool instanceof DPLDatapool)) >+ return false; >+ if (key == null) >+ return false; >+ boolean flag = false; >+ try { >+ flag = EncryptionManager.EncoderByMd5(key).equals( >+ ((DPLDatapool) datapool).getChallenge()); >+ } catch (Exception e) { >+ System.out.println("error while keycorrect"); >+ } >+ return flag; >+ >+ } >+ >+ public static boolean isVaribelEncrypted(IDatapoolVariable varible) { >+ return (varible instanceof DPLVariable) ? ((DPLVariable) varible) >+ .isEncrypted() : false; >+ } >+ >+ public static String encrypt(String content, String pass) { >+ return EncryptionManager.encrypt(content, pass); >+ } >+ >+ public static String decrypt(String content, String pass) { >+ return EncryptionManager.decrypt(content, pass); >+ } >+ >+} >Index: src-test/org/eclipse/hyades/models/common/datapool/util/DPLPasswordCollection.java >=================================================================== >RCS file: src-test/org/eclipse/hyades/models/common/datapool/util/DPLPasswordCollection.java >diff -N src-test/org/eclipse/hyades/models/common/datapool/util/DPLPasswordCollection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-test/org/eclipse/hyades/models/common/datapool/util/DPLPasswordCollection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,48 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DPLPasswordCollection.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.models.common.datapool.util; >+ >+import java.util.HashMap; >+ >+/** >+ * It's used to save HashMap of datapools and passwords for the test >+ * during executing a test in agent controller side . >+ * >+ * @author Huang Xin Ying >+ */ >+public class DPLPasswordCollection { >+ private static DPLPasswordCollection instance = null; >+ >+ private HashMap datapoolPassword = new HashMap(); >+ >+ private DPLPasswordCollection() { >+ } >+ >+ public static DPLPasswordCollection getInstance() { >+ if (instance == null) { >+ instance = new DPLPasswordCollection(); >+ } >+ return instance; >+ } >+ >+ public HashMap getDatapoolPassword() { >+ return datapoolPassword; >+ } >+ >+ public void setDatapoolPassword(HashMap datapoolPassword) { >+ this.datapoolPassword = datapoolPassword; >+ } >+ >+ public void clear(){ >+ this.datapoolPassword.clear(); >+ } >+} >Index: src-test/org/eclipse/hyades/models/common/util/EncryptionManager.java >=================================================================== >RCS file: src-test/org/eclipse/hyades/models/common/util/EncryptionManager.java >diff -N src-test/org/eclipse/hyades/models/common/util/EncryptionManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-test/org/eclipse/hyades/models/common/util/EncryptionManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,154 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: EncryptionManager.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.models.common.util; >+ >+import java.io.UnsupportedEncodingException; >+import java.security.MessageDigest; >+import java.security.NoSuchAlgorithmException; >+ >+import javax.crypto.Cipher; >+import javax.crypto.spec.SecretKeySpec; >+ >+/** >+ * It's used to provide encryption and decryption algorithm for a datapool . >+ * >+ * @author Huang Xin Ying >+ */ >+public class EncryptionManager { >+ >+ public static String encrypt(String content, String pass) { >+ RC4Encrypter encrypter = new RC4Encrypter(); >+ String encryptedStr = encrypter.cipherMessage(pass, content); >+ return encryptedStr; >+ } >+ >+ public static String decrypt(String content, String pass) { >+ RC4Encrypter rc4Encrypted = new RC4Encrypter(); >+ >+ String deencryptedStr = rc4Encrypted.decipherMessage(pass, content); >+ return deencryptedStr; >+ >+ } >+ >+ public static String EncoderByMd5(String str) >+ throws NoSuchAlgorithmException, UnsupportedEncodingException { >+ if (str == null) >+ return null; >+ MessageDigest md5 = MessageDigest.getInstance("MD5"); >+ RC4Encrypter rc4Encrypted = new RC4Encrypter(); >+ >+ return rc4Encrypted.byteArrayToHexString(md5.digest(str.getBytes())); >+ } >+ >+ public static class RC4Encrypter { >+ >+ public static final String[] HEXARRAY = { >+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f" >+ }; >+ >+ public String cipherMessage(String pass, String content) { >+ if (pass == null || pass.equals("") || content == null >+ || content.equals("")) { >+ return content; >+ } >+ try { >+ SecretKeySpec key = this.generateKey(pass); >+ Cipher cipher = Cipher.getInstance("RC4"); >+ cipher.init(Cipher.ENCRYPT_MODE, key); >+ byte[] code = cipher.update(content.getBytes()); >+ return byteArrayToHexString(code); >+ } catch (Exception e) { >+ e.printStackTrace(); >+ } >+ return null; >+ } >+ >+ public String decipherMessage(String pass, String encryptStr) >+ >+ { >+ if (pass == null || pass.equals("") || encryptStr == null >+ || encryptStr.equals("")) { >+ return encryptStr; >+ } >+ try { >+ SecretKeySpec key = this.generateKey(pass); >+ Cipher cipher = Cipher.getInstance("RC4"); >+ cipher.init(Cipher.DECRYPT_MODE, key); >+ byte[] text = hexStringToByteArray(encryptStr); >+ byte[] code = cipher.update(text); >+ return new String(code); >+ } catch (Exception e) { >+ e.printStackTrace(); >+ } >+ return null; >+ } >+ >+ private SecretKeySpec generateKey(String inpass) >+ >+ { >+ try { >+ byte[] pass = inpass.getBytes(); >+ >+ MessageDigest md5 = MessageDigest.getInstance("MD5"); >+ >+ md5.update(pass); >+ byte temp[] = md5.digest(); >+ >+ SecretKeySpec key = new SecretKeySpec(temp, "RC4"); >+ return key; >+ >+ } catch (Exception e) { >+ e.printStackTrace(); >+ } >+ return null; >+ } >+ >+ /** >+ * Method converting byte array into String. >+ * >+ * @param The byte array to be converted. >+ * @return A <code>String[]</code> containing String value of byte array. >+ */ >+ public String byteArrayToHexString(byte[] bytes){ >+ >+ String result = ""; >+ for (int i = 0; i < bytes.length; i++){ >+ //the up 4 bits >+ int tmp = bytes[i] >>> 4; >+ result += HEXARRAY[tmp % 16]; >+ //the lower 4 bits >+ tmp = bytes[i] & 0x0f; >+ result += HEXARRAY[tmp % 16]; >+ } >+ >+ return result; >+ } >+ >+ /** >+ * Method converting String into byte[]. >+ * >+ * @param The String to be converted. >+ * @return A <code>byte[]</code> containing byte[] value of string. >+ */ >+ public byte[] hexStringToByteArray(String hex){ >+ >+ byte[] bytes = new byte[hex.length() / 2]; >+ for (int i = 0; i < bytes.length; i++){ >+ bytes[i] = (byte) Integer.parseInt(hex.substring(2*i, 2*i+2), 16); >+ } >+ >+ >+ return bytes; >+ } >+ } >+} >#P org.eclipse.hyades.test.core >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/plugin.xml,v >retrieving revision 1.35 >diff -u -r1.35 plugin.xml >--- plugin.xml 14 Jan 2008 11:52:20 -0000 1.35 >+++ plugin.xml 18 Jan 2008 02:51:08 -0000 >@@ -32,6 +32,8 @@ > <extension-point id="RecorderApplication" name="%RecorderApplication" schema="schema/RecorderAppAdapter.exsd"/> > <extension-point id="Recorder" name="%Recorder" schema="schema/Recorder.exsd"/> > <extension-point id="executionHarnessListener" name="%executionHarnessListener" schema="schema/executionHarnessListener.exsd"/> >+ <extension-point id="launchconfigDatapoolHandler" name="launchconfigDatapoolHandler" schema="schema/launchconfigDatapoolHandler.exsd"/> >+ <extension-point id="launchDatapoolCheckPass" name="check passwords while launching" schema="schema/launchDatapoolCheckPass.exsd"/> > > <extension > id="org.eclipse.hyades.execution.harness.RegisteredExecutionComponentImpl.JAVA" >@@ -216,5 +218,22 @@ > point="org.eclipse.hyades.execution.testService"> > <testService class="org.eclipse.hyades.test.core.testservices.resources.FilesystemResourceProviderService"/> > </extension> >+ <extension >+ point="org.eclipse.hyades.test.core.launchconfigDatapoolHandler"> >+ <launchconfigDatapoolHandler >+ class="org.eclipse.hyades.test.core.internal.launch.datapool.extensions.JUnitLaunchconfigDatapoolHandler"> >+ <supportedTestType >+ name="org.eclipse.hyades.test.java.junit.testSuite"> >+ </supportedTestType> >+ </launchconfigDatapoolHandler> >+ </extension> >+ <extension >+ id="DatapoolPasswordProvider" >+ name="DatapoolPasswordProvider" >+ point="org.eclipse.hyades.execution.testService"> >+ <testService >+ class="org.eclipse.hyades.test.core.testservices.resources.DatapoolPasswordsService"> >+ </testService> >+ </extension> > > </plugin> >Index: src/org/eclipse/hyades/test/core/launch/delegates/AbstractLaunchConfigurationDelegate2.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/test/core/launch/delegates/AbstractLaunchConfigurationDelegate2.java,v >retrieving revision 1.12 >diff -u -r1.12 AbstractLaunchConfigurationDelegate2.java >--- src/org/eclipse/hyades/test/core/launch/delegates/AbstractLaunchConfigurationDelegate2.java 26 Apr 2007 18:49:48 -0000 1.12 >+++ src/org/eclipse/hyades/test/core/launch/delegates/AbstractLaunchConfigurationDelegate2.java 18 Jan 2008 02:51:11 -0000 >@@ -12,6 +12,7 @@ > package org.eclipse.hyades.test.core.launch.delegates; > > import java.util.ArrayList; >+import java.util.HashMap; > import java.util.Iterator; > import java.util.List; > >@@ -27,13 +28,20 @@ > import org.eclipse.emf.ecore.resource.ResourceSet; > import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; > import org.eclipse.hyades.execution.core.IExecutor; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; > import org.eclipse.hyades.test.core.TestCorePlugin; >+import org.eclipse.hyades.test.core.internal.launch.datapool.extensions.LaunchDatapoolExtensionManager; > import org.eclipse.hyades.test.core.internal.launch.extensions.LaunchConfigurationExtensionsManager; > import org.eclipse.hyades.test.core.internal.launch.processes.TestExecutionProcess; > import org.eclipse.hyades.test.core.internal.resources.TestCorePluginResourceBundle; >+import org.eclipse.hyades.test.core.launch.configurations.DeploymentLaunchConfigurationFacade; >+import org.eclipse.hyades.test.core.launch.configurations.TestLaunchConfigurationFacade; >+import org.eclipse.hyades.test.core.launch.extensions.ILaunchconfigDatapoolHandler; >+import org.eclipse.hyades.test.core.launch.extensions.IPassInfoCollector; > import org.eclipse.hyades.test.core.launch.extensions.IRunHandler; > import org.eclipse.hyades.test.core.launch.extensions.IRunHandler2; > import org.eclipse.hyades.test.core.launch.extensions.ITestLaunchConfigurationValidator; >+import org.eclipse.hyades.test.core.testservices.resources.PasswordCollection; > import org.eclipse.osgi.util.NLS; > > /** >@@ -185,10 +193,28 @@ > } > } > >+ // find the datapools which is encrypted >+ ILaunchconfigDatapoolHandler datapoolHandler = LaunchDatapoolExtensionManager.getInstance().getRunHandler(getLaunchedElement(configuration)); >+ DPLDatapool[] dp = null; >+ if(datapoolHandler != null){ >+ dp = datapoolHandler.getAllDatapools(TestLaunchConfigurationFacade.getTest(configuration, getResourceSet()), >+ DeploymentLaunchConfigurationFacade.getDeployment(configuration, getResourceSet())); >+ } >+ HashMap pass = PasswordCollection.getInstance().getDatapoolPassword(); >+ >+ // show a dialog to collect the passwords >+ if(dp!=null && dp.length > 0){ >+ IPassInfoCollector collector = LaunchDatapoolExtensionManager.getInstance().getCollector(getLaunchedElement(configuration)); >+ List isContinue = new ArrayList(); >+ isContinue.add(TestLaunchConfigurationFacade.getTest(configuration, getResourceSet()).getImplementor().getId()); >+ collector.execute(dp, pass, isContinue); >+ if(isContinue.size()==0) >+ return; >+ } > // Invoke the Test Execution Harness > StringBuffer errorMessages = new StringBuffer(); > IExecutor executor = null; >- try { >+ try { > executor = invokeTestExecutionHarness(configuration, mode, errorMessages, new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK)); > if (errorMessages.length() > 0) { > IStatus status = new Status(IStatus.ERROR, TestCorePlugin.getPluginId(), 0, TestCorePluginResourceBundle._EXC_AbstractLaunchConfigurationDelegate_testHarnessProblems + errorMessages, null); >Index: src/org/eclipse/hyades/test/core/internal/launch/processes/TestExecutionProcess.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.core/src/org/eclipse/hyades/test/core/internal/launch/processes/TestExecutionProcess.java,v >retrieving revision 1.11 >diff -u -r1.11 TestExecutionProcess.java >--- src/org/eclipse/hyades/test/core/internal/launch/processes/TestExecutionProcess.java 22 Mar 2007 14:42:35 -0000 1.11 >+++ src/org/eclipse/hyades/test/core/internal/launch/processes/TestExecutionProcess.java 18 Jan 2008 02:51:10 -0000 >@@ -44,6 +44,7 @@ > import org.eclipse.hyades.test.core.internal.resources.TestCorePluginResourceBundle; > import org.eclipse.hyades.test.core.launch.configurations.TestLaunchConfigurationFacade; > import org.eclipse.hyades.test.core.launch.extensions.IRunHandler; >+import org.eclipse.hyades.test.core.testservices.resources.PasswordCollection; > > /** > * Fake process that represents a Hyades Execution Session. The lifecycle of >@@ -146,6 +147,8 @@ > > protected synchronized void onTerminate() { > if (!terminated) { >+ //remove the dps and passwords from passwordCollection >+ PasswordCollection.getInstance().clear(test.getImplementor().getId()); > // Notify the run handler (if any) > IRunHandler runHandler = LaunchConfigurationExtensionsManager.getInstance().getRunHandler(test); > if (runHandler != null) { >Index: src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/LaunchDatapoolExtensionManager.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/LaunchDatapoolExtensionManager.java >diff -N src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/LaunchDatapoolExtensionManager.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/LaunchDatapoolExtensionManager.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,199 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: LaunchDatapoolExtensionManager.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.core.internal.launch.datapool.extensions; >+ >+import java.util.HashMap; >+import java.util.Map; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IConfigurationElement; >+import org.eclipse.core.runtime.IExtensionPoint; >+import org.eclipse.core.runtime.Platform; >+import org.eclipse.hyades.models.common.testprofile.TPFTest; >+import org.eclipse.hyades.test.core.TestCorePlugin; >+import org.eclipse.hyades.test.core.launch.extensions.ILaunchconfigDatapoolHandler; >+import org.eclipse.hyades.test.core.launch.extensions.IPassInfoCollector; >+ >+/** >+ * It's used to manage extensions for launchconfigDatapoolHandler and >+ * launchDatapoolCheckPass extension points ,based on the type of each test . >+ * >+ * @author Huang Xin Ying >+ * >+ */ >+public class LaunchDatapoolExtensionManager { >+ >+ private static LaunchDatapoolExtensionManager instance; >+ >+ public static LaunchDatapoolExtensionManager getInstance() { >+ if (instance == null) { >+ instance = new LaunchDatapoolExtensionManager(); >+ } >+ return instance; >+ } >+ >+ private LaunchDatapoolExtensionManager() { >+ registerDatapoolHandlers(); >+ registerCheckPass(); >+ } >+ >+ private Map datapoolHandlerExtensionMap = new HashMap(); >+ >+ public ILaunchconfigDatapoolHandler getRunHandler(Object testElement) { >+ LaunchDatapoolExtensionDescriper ed = getLaunchDatapoolDescriptor(testElement); >+ if (ed != null) { >+ return ed.getRunHandler(); >+ } >+ return null; >+ } >+ >+ public IPassInfoCollector getCollector(Object testElement) { >+ LaunchDatapoolExtensionDescriper ed = getLaunchDatapoolDescriptor(testElement); >+ if (ed != null && ed.getCollector()!= null) >+ return ed.getCollector(); >+ >+ return getExtensionDescriptor("default").getCollector(); >+ } >+ >+ private void registerDatapoolHandlers() { >+ IExtensionPoint extPoint = Platform.getExtensionRegistry() >+ .getExtensionPoint( >+ TestCorePlugin.getPluginId() >+ + ".launchconfigDatapoolHandler"); >+ if (extPoint != null) { >+ IConfigurationElement[] datapoolHandlers = extPoint >+ .getConfigurationElements(); >+ for (int i = 0; i < datapoolHandlers.length; i++) { >+ IConfigurationElement[] supportedTypes = datapoolHandlers[i] >+ .getChildren(); >+ for (int j = 0; j < supportedTypes.length; j++) { >+ String type = supportedTypes[j].getAttribute("name"); //$NON-NLS-1$ >+ try { >+ LaunchDatapoolExtensionDescriper ed = getExtensionDescriptor(type); >+ ed.launchDatapoolConfigElem = datapoolHandlers[i]; >+ } catch (Exception e) { >+ TestCorePlugin >+ .getDefault() >+ .logError( >+ "Extension " >+ + datapoolHandlers[i].getName() >+ + " was ignored. See next messages for details."); >+ TestCorePlugin.getDefault().logError(e); >+ } >+ } >+ } >+ } >+ } >+ >+ private void registerCheckPass() { >+ IExtensionPoint extPoint = Platform.getExtensionRegistry() >+ .getExtensionPoint( >+ TestCorePlugin.getPluginId() >+ + ".launchDatapoolCheckPass"); >+ if (extPoint != null) { >+ IConfigurationElement[] datapoolHandlers = extPoint >+ .getConfigurationElements(); >+ for (int i = 0; i < datapoolHandlers.length; i++) { >+ IConfigurationElement[] supportedTypes = datapoolHandlers[i] >+ .getChildren(); >+ for (int j = 0; j < supportedTypes.length; j++) { >+ String type = supportedTypes[j].getAttribute("name"); //$NON-NLS-1$ >+ if(type == null || type.equals("")) >+ type = "default"; >+ try { >+ LaunchDatapoolExtensionDescriper ed = getExtensionDescriptor(type); >+ ed.CheckPassConfigElem = datapoolHandlers[i]; >+ } catch (Exception e) { >+ TestCorePlugin >+ .getDefault() >+ .logError( >+ "Extension " >+ + datapoolHandlers[i].getName() >+ + " was ignored. See next messages for details."); >+ TestCorePlugin.getDefault().logError(e); >+ } >+ } >+ } >+ } >+ } >+ >+ private LaunchDatapoolExtensionDescriper getExtensionDescriptor(String type) { >+ >+ if (type == null) { >+ throw new NullPointerException("Type must be non-null"); //$NON-NLS-1$ >+ } >+ >+ Object o = datapoolHandlerExtensionMap.get(type); >+ if (o == null) { >+ o = new LaunchDatapoolExtensionDescriper(); >+ datapoolHandlerExtensionMap.put(type, o); >+ } >+ return (LaunchDatapoolExtensionDescriper) o; >+ } >+ >+ private LaunchDatapoolExtensionDescriper getLaunchDatapoolDescriptor( >+ Object testElement) { >+ if (testElement != null) { >+ if (testElement instanceof TPFTest) { >+ TPFTest test = (TPFTest) testElement; >+ if (test.getType() != null) { >+ return getExtensionDescriptor(test.getType()); >+ } >+ } >+ } >+ return null; >+ } >+ >+ private class LaunchDatapoolExtensionDescriper { >+ public IConfigurationElement launchDatapoolConfigElem = null; >+ public IConfigurationElement CheckPassConfigElem = null; >+ private ILaunchconfigDatapoolHandler hanler = null; >+ private IPassInfoCollector collector = null; >+ public String launchConfigurationType = null; >+ >+ public ILaunchconfigDatapoolHandler getRunHandler() { >+ if (this.hanler == null) { >+ if (this.launchDatapoolConfigElem != null) { >+ try { >+ this.hanler = (ILaunchconfigDatapoolHandler) this.launchDatapoolConfigElem >+ .createExecutableExtension("class"); //$NON-NLS-1$ >+ } catch (CoreException e) { >+ TestCorePlugin.getDefault().logError(e); >+ this.launchDatapoolConfigElem = null; >+ } >+ } >+ } >+ return this.hanler; >+ } >+ >+ public IPassInfoCollector getCollector() { >+ if (this.collector == null) { >+ if (this.CheckPassConfigElem != null) { >+ try { >+ this.collector = (IPassInfoCollector) this.CheckPassConfigElem >+ .createExecutableExtension("UIClass"); //$NON-NLS-1$ >+ } catch (CoreException e) { >+ TestCorePlugin.getDefault().logError(e); >+ this.CheckPassConfigElem = null; >+ } >+ } >+ } >+ return this.collector; >+ } >+ >+ public boolean isLaunchConfigurationTypeSupported(String lcType) { >+ return (this.launchConfigurationType == lcType) >+ || (lcType != null && lcType >+ .equals(this.launchConfigurationType)); >+ } >+ } >+} >Index: src/org/eclipse/hyades/test/core/launch/extensions/ILaunchconfigDatapoolHandler.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/launch/extensions/ILaunchconfigDatapoolHandler.java >diff -N src/org/eclipse/hyades/test/core/launch/extensions/ILaunchconfigDatapoolHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/launch/extensions/ILaunchconfigDatapoolHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: ILaunchconfigDatapoolHandler.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.test.core.launch.extensions; >+ >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.testprofile.TPFDeployment; >+import org.eclipse.hyades.models.common.testprofile.TPFTest; >+ >+/** >+* >+* It's the interface for the launchconfigDatapoolHandler extension point. >+* >+* @author Huang Xin Ying >+* >+*/ >+public interface ILaunchconfigDatapoolHandler { >+ >+ public DPLDatapool[] getAllDatapools(TPFTest test, TPFDeployment deploy); >+ >+} >Index: src/org/eclipse/hyades/test/core/launch/extensions/IPassInfoCollector.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/launch/extensions/IPassInfoCollector.java >diff -N src/org/eclipse/hyades/test/core/launch/extensions/IPassInfoCollector.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/launch/extensions/IPassInfoCollector.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: IPassInfoCollector.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.core.launch.extensions; >+ >+import java.util.List; >+import java.util.Map; >+ >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+ >+/** >+* >+* It's the interface for the launchDatapoolCheckPass extension point. >+* @author Huang Xin Ying >+* >+*/ >+public interface IPassInfoCollector { >+ >+ void execute(DPLDatapool[] dp, Map pass, List isContinue); >+} >Index: src/org/eclipse/hyades/test/core/testservices/resources/PasswordCollection.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/testservices/resources/PasswordCollection.java >diff -N src/org/eclipse/hyades/test/core/testservices/resources/PasswordCollection.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/testservices/resources/PasswordCollection.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,77 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: PasswordCollection.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.test.core.testservices.resources; >+ >+ >+ >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.Map; >+ >+/** >+ * This class runs on the workbench, and used to save HashMap of >+ * datapool & password for this datapool during luaching tests . >+ * >+ * It's supposed to support mult-lauch on the workbench side . >+ * >+ * @author Xin Ying Huang >+ * >+ */ >+public class PasswordCollection { >+ >+ private static PasswordCollection instance = null; >+ private HashMap datapoolPassword = new HashMap(); >+ >+ >+ private PasswordCollection(){} >+ >+ /** >+ * @param >+ * @return PasswordCollection >+ */ >+ public static PasswordCollection getInstance(){ >+ if(instance == null){ >+ instance = new PasswordCollection(); >+ } >+ return instance; >+ } >+ >+ /** >+ * @param >+ * @return HashMap >+ */ >+ public HashMap getDatapoolPassword() { >+ return datapoolPassword; >+ } >+ >+ /** >+ * @param testId >+ * @return HashMap >+ */ >+ public HashMap getDatapoolPassword(String testId){ >+ if(testId == null) >+ return null; >+ return (HashMap)datapoolPassword.get(testId); >+ } >+ >+ /** >+ * @param testId >+ * @return HashMap >+ */ >+ public void clear(String testId){ >+ if(testId == null) >+ return; >+ datapoolPassword.remove(testId); >+ return; >+ } >+} >Index: schema/launchconfigDatapoolHandler.exsd >=================================================================== >RCS file: schema/launchconfigDatapoolHandler.exsd >diff -N schema/launchconfigDatapoolHandler.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/launchconfigDatapoolHandler.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,135 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.hyades.test.core"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.hyades.test.core" id="launchconfigDatapoolHandler" name="launchconfigDatapoolHandler"/> >+ </appInfo> >+ <documentation> >+ This extension point provides a mechanism to get datapool model for each test type when launching a test case . >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="launchconfigDatapoolHandler"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="launchconfigDatapoolHandler"> >+ <complexType> >+ <sequence> >+ <element ref="supportedTestType"/> >+ </sequence> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="supportedTestType"> >+ <complexType> >+ <attribute name="name" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [4.5 ] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ The following example associates a DatapoolHandler class with tests of type org.eclipse.hyades.test.: >+ >+<pre> >+ >+ <extension >+ >+ point="org.eclipse.hyades.test.core.launchconfigDatapoolHandler"> >+ >+ <launchconfigDatapoolHandler class=" "> >+ >+ <supportedType >+ >+ name =" "/> >+ >+ </runHandler> >+ >+ </extension> >+ >+</pre> >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [org.eclipse.hyades.test.core.launch.extensions.ILaunchconfigDatapoolHandler] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="copyright"/> >+ </appInfo> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ >+</schema> >Index: schema/launchDatapoolCheckPass.exsd >=================================================================== >RCS file: schema/launchDatapoolCheckPass.exsd >diff -N schema/launchDatapoolCheckPass.exsd >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ schema/launchDatapoolCheckPass.exsd 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,140 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.hyades.test.core"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.hyades.test.core" id="launchDatapoolCheckPass" name="check passwords while launching"/> >+ </appInfo> >+ <documentation> >+ [Used to collect password for each enctypted datapool which used in current test on workbench side .] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="launchDatapoolCheckPass"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="launchDatapoolCheckPass"> >+ <complexType> >+ <sequence> >+ <element ref="supportedTestType"/> >+ </sequence> >+ <attribute name="UIClass" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="supportedTestType"> >+ <complexType> >+ <attribute name="name" type="string" use="default" value=""> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [4.5.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [ <element name="extension"> >+ <complexType> >+ <sequence> >+ <element ref="launchDatapoolCheckPass"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiInfo"/> >+ </appInfo> >+ <documentation> >+ [org.eclipse.hyades.test.core.launch.extensions.IPassInfoCollector .] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >Index: src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/JUnitLaunchconfigDatapoolHandler.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/JUnitLaunchconfigDatapoolHandler.java >diff -N src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/JUnitLaunchconfigDatapoolHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/internal/launch/datapool/extensions/JUnitLaunchconfigDatapoolHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,74 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: JUnitLaunchconfigDatapoolHandler.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.test.core.internal.launch.datapool.extensions; >+ >+import java.util.ArrayList; >+import java.util.Iterator; >+import java.util.List; >+ >+import org.eclipse.hyades.models.common.configuration.CFGArtifactLocationPair; >+import org.eclipse.hyades.models.common.configuration.CFGClass; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.testprofile.TPFDeployment; >+import org.eclipse.hyades.models.common.testprofile.TPFTest; >+import org.eclipse.hyades.test.core.launch.extensions.ILaunchconfigDatapoolHandler; >+ >+ >+/** >+ * This class runs on the workbench, and provides the workbench side >+ * implementation of the launchconfigDatapoolHandler extension point. >+ * >+ * It's used to get datapool[] from test or delpoy for Junit test type . >+ * >+ * @author Huang Xin Ying >+ * >+ */ >+public class JUnitLaunchconfigDatapoolHandler implements >+ ILaunchconfigDatapoolHandler { >+ >+ /** >+ * @param test,deploy >+ * @return DPLDatapool[] >+ */ >+ public DPLDatapool[] getAllDatapools(TPFTest test, TPFDeployment deploy) { >+ if(deploy == null) >+ return null; >+ >+ List keyList = new ArrayList(); >+ List pairs = deploy.getArtifactLocations(); >+ >+ if(pairs == null) >+ return null; >+ for(Iterator iti = pairs.iterator();iti.hasNext();){ >+ CFGArtifactLocationPair aflp = (CFGArtifactLocationPair)iti.next(); >+ if(aflp == null) >+ continue; >+ if(aflp.getArtifact() == null) >+ continue; >+ List deploys = aflp.getArtifact().getDeployableInstances(); >+ if(deploys == null) >+ continue; >+ for(Iterator it=deploys.iterator();it.hasNext();){ >+ CFGClass cfg = (CFGClass)it.next(); >+ if(cfg instanceof DPLDatapool && ((DPLDatapool)cfg).getChallenge()!= null){ >+ keyList.add(cfg); >+ } >+ } >+ } >+ >+ if(keyList.size() == 0) >+ return null; >+ >+ return (DPLDatapool[])(keyList.toArray(new DPLDatapool[]{})); >+ } >+} >Index: src/org/eclipse/hyades/test/core/testservices/resources/DatapoolPasswordsService.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/core/testservices/resources/DatapoolPasswordsService.java >diff -N src/org/eclipse/hyades/test/core/testservices/resources/DatapoolPasswordsService.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/core/testservices/resources/DatapoolPasswordsService.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,60 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolPasswordsService.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.core.testservices.resources; >+ >+import java.util.HashMap; >+import java.util.Iterator; >+import java.util.Map; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; >+ >+import org.eclipse.hyades.execution.local.testservices.AbstractTestService; >+import org.eclipse.hyades.execution.local.testservices.ITestService; >+import org.eclipse.hyades.internal.execution.local.control.Agent; >+ >+/** >+* >+* It's the class of DatapoolPasswordsService ,used to provide list of datapool and it's encryption >+* password to the agent controller side . >+* @author Huang Xin Ying >+* >+*/ >+public class DatapoolPasswordsService extends AbstractTestService implements ITestService{ >+ >+ /** >+ * @param agent >+ * @param methodArgs >+ * @param errBuf >+ * @return >+ */ >+ public String getDatapoolList(Agent agent, String methodArgs, StringBuffer errBuf){ >+ Pattern pattern = Pattern.compile("testId=(.*)"); //$NON-NLS-1$ >+ Matcher matcher = pattern.matcher(methodArgs); >+ String testId = null; >+ if (matcher.find()) { >+ testId = matcher.group(1); >+ } >+ HashMap data = PasswordCollection.getInstance().getDatapoolPassword(testId); >+ >+ if(data == null || data.size() == 0) >+ return null; >+ >+ StringBuffer result = new StringBuffer(); >+ >+ for( Iterator it = data.entrySet().iterator();it.hasNext();){ >+ Map.Entry entry = (Map.Entry)it.next(); >+ result.append(entry.getKey() + "=" + entry.getValue() + ";"); >+ } >+ >+ return result.toString(); >+ } >+} >#P org.eclipse.hyades.test.ui >Index: src/org/eclipse/hyades/test/ui/internal/editor/extension/DatapoolEditorExtension.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/editor/extension/DatapoolEditorExtension.java,v >retrieving revision 1.17 >diff -u -r1.17 DatapoolEditorExtension.java >--- src/org/eclipse/hyades/test/ui/internal/editor/extension/DatapoolEditorExtension.java 24 May 2007 12:06:54 -0000 1.17 >+++ src/org/eclipse/hyades/test/ui/internal/editor/extension/DatapoolEditorExtension.java 18 Jan 2008 02:51:49 -0000 >@@ -32,6 +32,7 @@ > import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; > import org.eclipse.hyades.ui.editor.IEditActionsExtension; > import org.eclipse.hyades.ui.editor.IHyadesEditorPart; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.text.IFindReplaceTarget; > import org.eclipse.jface.text.IFindReplaceTargetExtension3; > import org.eclipse.jface.viewers.ISelection; >@@ -39,6 +40,7 @@ > import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.swt.custom.TableCursor; > import org.eclipse.swt.graphics.Point; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.swt.widgets.Table; > import org.eclipse.swt.widgets.TableItem; > import org.eclipse.tptp.platform.common.ui.internal.util.UIUtil; >@@ -397,8 +399,11 @@ > /* (non-Javadoc) > * @see org.eclipse.hyades.ui.editor.IEditorExtension#createPages() > */ >+ private void showErrMes(Shell shell, String mes) { >+ MessageDialog.openError(shell, UiPluginResourceBundle.DatapoolDialog_ERRORDIALOGTITLE, mes); >+ } > public void createPages() { >- IHyadesEditorPart hyadesEditorPart = getHyadesEditorPart(); >+ IHyadesEditorPart hyadesEditorPart = getHyadesEditorPart(); > WidgetFactory widgetFactory = new WidgetFactory(); > > datapoolForm = new DatapoolForm(this, widgetFactory); >@@ -406,7 +411,7 @@ > hyadesEditorPart.setPageText(PAGE_OVERVIEW, UiPluginResourceBundle.W_OVERVIEW); > datapoolForm.updateTitle(); > >- IDatapool dp = getDatapool(); >+ IDatapool dp = getDatapool(); > for (int i = 0; i < dp.getEquivalenceClassCount(); i++) { > addEquivalenceClassPage(i); > } >@@ -631,5 +636,17 @@ > public void connectPart(IWorkbenchPart part) { > DatapoolActionHandlerListener.INSTANCE.connectPart(part); > } >- >+ /** >+ * used for DatapoolEditorPart to save >+ * deal with the encrypted datapool >+ * */ >+ public void save(){ >+ if(super.getProgressMonitor() != null){ >+ try{ >+ super.save(super.getProgressMonitor()); >+ }catch(Exception e){ >+ e.printStackTrace(); >+ } >+ } >+ } > } >Index: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolColumnDialog.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolColumnDialog.java,v >retrieving revision 1.14 >diff -u -r1.14 DatapoolColumnDialog.java >--- src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolColumnDialog.java 22 Mar 2007 14:42:05 -0000 1.14 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolColumnDialog.java 18 Jan 2008 02:51:46 -0000 >@@ -14,18 +14,26 @@ > > import org.eclipse.hyades.edit.datapool.IDatapool; > import org.eclipse.hyades.edit.datapool.IDatapoolVariable; >+import org.eclipse.hyades.models.common.datapool.DPLVariable; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; >+import org.eclipse.hyades.models.common.util.EncryptionManager; > import org.eclipse.hyades.test.ui.datapool.internal.util.DatapoolUtil; > import org.eclipse.hyades.test.ui.datapool.internal.util.GridDataUtil; > import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.events.KeyEvent; > import org.eclipse.swt.events.KeyListener; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.events.MouseListener; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.graphics.Color; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Combo; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; >@@ -43,7 +51,7 @@ > * @author psun > * > */ >-public class DatapoolColumnDialog extends DatapoolBaseDialog implements KeyListener, SelectionListener{ >+public class DatapoolColumnDialog extends DatapoolBaseDialog implements KeyListener, SelectionListener,MouseListener{ > > private static final String TAG_VARIABLES = "variables"; //$NON-NLS-1$ > >@@ -66,6 +74,17 @@ > private String insertionVariableName = null; > private int defaultNameCounter = 1; > >+ private Button okButton; >+ private Button checkBox; >+ private Button changeKeyButton; >+ private boolean isEncrypted; >+ private boolean isKeyChanged; >+ private String newKey; >+ //private String key; >+ >+ public boolean isKeyChanged() { >+ return isKeyChanged; >+ } > public DatapoolColumnDialog(Shell parentShell, > IDatapool datapool, > IDatapoolVariable selectedVariable, >@@ -78,6 +97,7 @@ > this.title = title; > this.selectedVariable = selectedVariable; > this.previousVariable = previousVariable; >+ boolean isKeyChanged = false; > } > > /** >@@ -122,6 +142,12 @@ > typeField.setLayoutData(gridData); > typeField.addKeyListener(this); > typeFieldForeground = typeField.getForeground(); >+ checkBox = new Button(superComposite,SWT.CHECK); >+ checkBox.setText(UiPluginResourceBundle.DatapoolDialog_ENCRYPTED); >+ checkBox.addMouseListener(this); >+ changeKeyButton = new Button(superComposite,SWT.NONE); >+ changeKeyButton.setText(UiPluginResourceBundle.DatapoolDialog_CHANGEKEY); >+ changeKeyButton.addMouseListener(this); > > IDatapoolVariable[] variables = DatapoolUtil.getInstance().getVariables(datapool, null); > if(selectedVariable != null) >@@ -156,7 +182,19 @@ > else { > insertionLabel.setText(UiPluginResourceBundle.DATA_DLG_MOVE); > } >- >+ if(isVaribelEncrypted(selectedVariable)) >+ { >+ if(DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ changeKeyButton.setEnabled(true); >+ checkBox.setSelection(true); >+ isEncrypted =true; >+ } >+ else >+ { >+ changeKeyButton.setEnabled(false); >+ checkBox.setSelection(false); >+ isEncrypted = false; >+ } > insertionVariables = new Combo(superComposite, SWT.DROP_DOWN | SWT.READ_ONLY); > insertionVariables.setItems(variableLabels); > insertionVariables.setData(TAG_VARIABLES, variables); >@@ -165,7 +203,7 @@ > > if(variables.length > 0 && previousVariable != null) > { >- int selectIndex = findVariableIndexInCombo(variables, previousVariable) - 1; >+ int selectIndex = findVariableIndexInCombo(variables, previousVariable); > if (selectIndex < 0) { > insertionVariables.select(0); > insertionVariableName = new String(); >@@ -184,7 +222,7 @@ > } > if (title.equals(UiPluginResourceBundle.DATA_COL_DLG_TITLE_EDIT) && variables.length == 1) { > //- Move field hidden >- insertionVariables.setVisible(false); >+ insertionVariables.setVisible(false); > insertionLabel.setVisible(false); > } > nameErrorLabel = new Label(superComposite, SWT.NONE); >@@ -387,4 +425,138 @@ > defaultNameCounter++; > return NLS.bind(UiPluginResourceBundle.DATA_VARIABLE_NAME_FORMAT, messageElements); > } >+ public void mouseDoubleClick(MouseEvent e) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void mouseDown(MouseEvent e) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void mouseUp(MouseEvent e) { >+ // TODO Auto-generated method stub >+ Button clickButton = (Button)e.getSource(); >+ if(clickButton == null) >+ { >+ return; >+ } >+ String title = clickButton.getText(); >+ if(title != null) >+ { >+ if(title.equals(UiPluginResourceBundle.DatapoolDialog_ENCRYPTED)) >+ { >+ dealClickCheckBox(clickButton); >+ } >+ else if(title.equals(UiPluginResourceBundle.DatapoolDialog_CHANGEKEY)) >+ { >+ dealClickChangeKey(clickButton); >+ } >+ } >+ >+ >+ >+ } >+ private void dealClickCheckBox(Button checkBoxButton) >+ { >+ //if(key == null || key.equals("")) >+ //{ >+ // isEncrypted = checkBox.getSelection(); >+ // changeKeyButton.setEnabled(false); >+ // return ; >+ //} >+ checkBox = checkBoxButton; >+ isEncrypted = checkBox.getSelection(); >+ if(changeKeyButton != null) >+ { >+ if(DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ changeKeyButton.setEnabled(isChangeKeyButtonEnable()); >+ } >+ } >+ public boolean isEncrypted() >+ { >+ return isEncrypted; >+ } >+ private void dealClickChangeKey(Button changeKeyButton) >+ { >+ >+ boolean errorKey = true; >+ Shell shell = Display.getCurrent().getActiveShell(); >+ DatapoolChangeKeyDialog changeKeyDialog = new DatapoolChangeKeyDialog(shell, datapool, UiPluginResourceBundle.DatapoolDialog_CHANGEKEYDIALOGTITLE); >+ String key = null; >+ int retVal = 0; >+ while(errorKey) >+ { >+ if (changeKeyDialog.open() == IDialogConstants.OK_ID) { >+ >+ key = changeKeyDialog.getOldKey(); >+ retVal = changeKeyDialog.isKeyChangeSuccess(datapool); >+ switch(retVal) >+ { >+ case DatapoolConstant.ORIGINTKEYERROR: >+ showErrMes(shell,UiPluginResourceBundle.DatapoolDialog_ORIGINKEYERRORMES); >+ break; >+ case DatapoolConstant.NEWKEYNULL: >+ showErrMes(shell,UiPluginResourceBundle.DatapoolDialog_NEWKEYNULLMES); >+ break; >+ case DatapoolConstant.NEWKEYNOTCONFIRM: >+ showErrMes(shell,UiPluginResourceBundle.DatapoolDialog_NEWKEYNOTCONFIRMMES); >+ break; >+ case DatapoolConstant.CHANGEKEYSUCCESS: >+ newKey = changeKeyDialog.getNewKey(); >+ DatapoolEncryptManager.changeKeyOfEncryCell(datapool, key, newKey); >+ key = newKey; >+ try{ >+ DatapoolEncryptManager.ChangeKey(EncryptionManager.EncoderByMd5(key), >+ datapool); >+ }catch(Exception e){ >+ } >+ errorKey = false; >+ isKeyChanged = true; >+ break; >+ default://error >+ errorKey = false; >+ isKeyChanged = false; >+ } >+ } >+ else >+ { >+ errorKey = false; >+ isKeyChanged = false; >+ } >+ >+ } >+ >+ } >+ private void showErrMes(Shell shell,String mes) >+ { >+ MessageDialog.openError(shell,UiPluginResourceBundle.DatapoolDialog_ERRORDIALOGTITLE ,mes); >+ } >+ private boolean isChangeKeyButtonEnable() >+ { >+ boolean retValue = true; >+ if(checkBox != null) >+ { >+ if(!checkBox.getSelection()) >+ { >+ retValue = false; >+ } >+ >+ } >+ >+ return retValue; >+ >+ } >+ >+ private boolean isVaribelEncrypted(IDatapoolVariable varible) >+ { >+ return (varible instanceof DPLVariable)?((DPLVariable)varible).isEncrypted():false; >+ } >+ >+ public String getNewKey() { >+ return newKey; >+ } >+ >+ > } >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java,v >retrieving revision 1.8 >diff -u -r1.8 DatapoolImportWizard.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java 7 Dec 2007 21:25:21 -0000 1.8 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportWizard.java 18 Jan 2008 02:52:03 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; > import org.eclipse.hyades.test.core.util.EMFUtil; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.datapool.internal.util.CSVImportExportUtil; >@@ -100,6 +101,22 @@ > datapool.removeEquivalenceClass(0); > } > >+ //TODO:first deencrpted all >+ String key = datapoolImportPageSelection.getTextArea().getText(); >+ >+ if(datapoolImportPageSelection.isEncrypted()){ >+ if(!DatapoolEncryptManager.isKeyCorrect(datapool, key)){ >+ datapoolImportPageSelection.setMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass,3); >+ datapoolImportPageSelection.getTextArea().setText(""); >+ datapoolImportPageSelection.getTextArea().setFocus(); >+ return false; >+ } >+ } >+ >+ if( DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ { >+ DatapoolEncryptManager.deencrypDatapool(datapool, key); >+ } > if(datapool.getVariableCount() == 0) > { > CSVImportExportUtil.getInstance().importCSV(datapool, >@@ -116,6 +133,12 @@ > datapoolImportPage.firstColumnContainsEquivalenceClassName(), > datapoolImportPage.getImportEncoding()); > } >+ //TODO:deal with the encrypted datapool >+ >+ if( DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ { >+ DatapoolEncryptManager.encrypDatapool(datapool, key); >+ } > Resource dp = ((EObject)datapool).eResource(); > EMFUtil.save(dp); > dp.unload(); >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportWizard.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportWizard.java,v >retrieving revision 1.11 >diff -u -r1.11 DatapoolExportWizard.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportWizard.java 22 Mar 2007 14:42:03 -0000 1.11 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportWizard.java 18 Jan 2008 02:52:00 -0000 >@@ -18,6 +18,7 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.Path; > import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; > import org.eclipse.hyades.test.ui.TestUIImages; > import org.eclipse.hyades.test.ui.UiPlugin; > import org.eclipse.hyades.test.ui.datapool.internal.util.CSVImportExportUtil; >@@ -28,6 +29,7 @@ > import org.eclipse.jface.wizard.Wizard; > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Shell; > import org.eclipse.ui.IExportWizard; > import org.eclipse.ui.IWorkbench; > >@@ -86,9 +88,27 @@ > /* (non-Javadoc) > * @see org.eclipse.jface.wizard.IWizard#performFinish() > */ >+ private void showErrMes(Shell shell, String mes) { >+ MessageDialog.openError(shell, UiPluginResourceBundle.DatapoolDialog_ERRORDIALOGTITLE, mes); >+ } > public boolean performFinish() > { > IDatapool datapool = datapoolSelectionPage.getDatapool(); >+ String key = datapoolSelectionPage.getTextArea().getText(); >+ >+ if(datapoolSelectionPage.isEncrypted()){ >+ if(!DatapoolEncryptManager.isKeyCorrect(datapool, key)){ >+ datapoolSelectionPage.setMessage(UiPluginResourceBundle.DatapoolExportWizard_wrongpass,3); >+ datapoolSelectionPage.getTextArea().setText(""); >+ datapoolSelectionPage.getTextArea().setFocus(); >+ return false; >+ } >+ } >+ //TODO:deal with the encrypted datapool >+ if( DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ { >+ DatapoolEncryptManager.deencrypDatapool(datapool, key); >+ } > String csvFileName = csvFileLocationPage.getCSVFileName(); > if(!csvFileName.endsWith(".csv") && !csvFileName.endsWith(".CSV")) > csvFileName = csvFileName + ".csv"; >@@ -125,6 +145,12 @@ > UiPlugin.logError(e); > } > } >+ >+ //Encrypted back >+ if( DatapoolEncryptManager.isDatapoolEncrypted(datapool)) >+ { >+ DatapoolEncryptManager.encrypDatapool(datapool, key); >+ } > return close; > } > } >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportSelectionPage.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportSelectionPage.java,v >retrieving revision 1.5 >diff -u -r1.5 DatapoolExportSelectionPage.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportSelectionPage.java 22 Mar 2007 14:42:03 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolExportSelectionPage.java 18 Jan 2008 02:51:59 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; > import org.eclipse.hyades.models.common.util.ICommonConstants; > import org.eclipse.hyades.test.ui.datapool.internal.util.GridDataUtil; > import org.eclipse.hyades.test.ui.dialog.EObjectResourceContentProvider; >@@ -27,13 +28,20 @@ > import org.eclipse.jface.viewers.ViewerSorter; > import org.eclipse.jface.wizard.WizardPage; > import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; > import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.layout.FormLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Group; >+import org.eclipse.swt.widgets.Text; > import org.eclipse.swt.widgets.Tree; > > /** >@@ -50,6 +58,10 @@ > private EObjectResourceContentProvider contentProvider; > private String[] fileExtensions; > private Image fileImage; >+ private Group group; >+ private Text textArea; >+ private FormData formData; >+ private boolean isEncrypted = false; > > /** > * @param pageName >@@ -148,8 +160,35 @@ > }; > assetViewer.setSorter(sorter); > >+ group = new Group(parent,SWT.NULL); >+ group.setText(UiPluginResourceBundle.DatapoolExportWizard_password); >+ group.setLayoutData(GridDataUtil.createHorizontalFill()); >+ group.setLayout(new FormLayout()); >+ group.setVisible(false); >+ textArea = new Text(group, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.PASSWORD); >+ formData = new FormData(); >+ formData.left = new FormAttachment(0,5); >+ formData.top = new FormAttachment(0,5); >+ formData.bottom = new FormAttachment(80,-5); >+ formData.width = 200; >+ textArea.setLayoutData(formData); >+ textArea.addModifyListener(new ModifyListener(){ >+ public void modifyText(ModifyEvent e){ >+ if(textArea.getText().length()>0){ >+ setPageComplete(true); >+ } >+ } >+ }); > return assetViewer; > } >+ >+ public Text getTextArea(){ >+ return textArea; >+ } >+ >+ public boolean isEncrypted(){ >+ return isEncrypted; >+ } > > private void setSelection() > { >@@ -162,8 +201,24 @@ > datapool = (IDatapool)selectedObject; > if(datapool != null) > { >- setPageComplete(true); >- getContainer().updateButtons(); >+ if(DatapoolEncryptManager.isDatapoolEncrypted(datapool)){ >+ isEncrypted = true; >+ setMessage(datapool.getName() + " " + UiPluginResourceBundle.DatapoolExportWizard_encrypted,WARNING); >+ group.setVisible(true); >+ group.setText(UiPluginResourceBundle.DatapoolExportWizard_password + " " + datapool.getName() + ".datapool"); >+ textArea.setFocus(); >+ >+ setPageComplete(false); >+ //getContainer().updateButtons(); >+ }else{ >+ isEncrypted = false; >+ setMessage(datapool.getName() + " " + UiPluginResourceBundle.DatapoolExportWizard_unencrypted); >+ group.setVisible(false); >+ textArea.setText(""); >+ >+ setPageComplete(true); >+ getContainer().updateButtons(); >+ } > } > } > } >Index: src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java,v >retrieving revision 1.2 >diff -u -r1.2 DatapoolImportPageSelection.java >--- src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java 11 Dec 2007 15:27:43 -0000 1.2 >+++ src/org/eclipse/hyades/test/ui/internal/wizard/DatapoolImportPageSelection.java 18 Jan 2008 02:52:02 -0000 >@@ -25,6 +25,7 @@ > import org.eclipse.emf.ecore.resource.Resource; > import org.eclipse.hyades.edit.datapool.IDatapool; > import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; > import org.eclipse.hyades.models.common.util.DatapoolUtil; > import org.eclipse.hyades.models.common.util.ICommonConstants; > import org.eclipse.hyades.test.ui.UiPlugin; >@@ -39,14 +40,21 @@ > import org.eclipse.osgi.util.NLS; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.StackLayout; >+import org.eclipse.swt.events.ModifyEvent; >+import org.eclipse.swt.events.ModifyListener; > import org.eclipse.swt.events.SelectionEvent; > import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.layout.FormLayout; > import org.eclipse.swt.layout.GridData; > import org.eclipse.swt.layout.GridLayout; > import org.eclipse.swt.widgets.Button; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Event; >+import org.eclipse.swt.widgets.Group; > import org.eclipse.swt.widgets.Listener; >+import org.eclipse.swt.widgets.Text; > import org.eclipse.tptp.platform.common.internal.util.EMFUtil; > import org.eclipse.tptp.platform.common.ui.internal.CommonUIMessages; > import org.eclipse.tptp.platform.common.ui.internal.CommonUIPlugin; >@@ -68,6 +76,11 @@ > private final static String nameExistingDatapool = "Select Existing Datapool"; > > private static final int SIZING_CONTAINER_GROUP_HEIGHT = 250; >+ private Group group; >+ private Text textArea; >+ private boolean valid = false; >+ private FormData formData; >+ private boolean isEncrypted = false; > > /** > * Constructor. >@@ -145,8 +158,52 @@ > { > super.setSelection(); > validateSelection(); >+ IDatapool datapool = getSelectedDatapool()[0]; >+ if(datapool != null) >+ { >+ if(DatapoolEncryptManager.isDatapoolEncrypted(datapool)){ >+ isEncrypted = true; >+ setMessage(datapool.getName() + " " + UiPluginResourceBundle.DatapoolExportWizard_encrypted,WARNING); >+ group.setVisible(true); >+ group.setText(UiPluginResourceBundle.DatapoolExportWizard_password + " " + datapool.getName() + ".datapool"); >+ textArea.setFocus(); >+ >+ setPageComplete(false); >+ //getContainer().updateButtons(); >+ }else{ >+ isEncrypted = false; >+ setMessage(datapool.getName() + " " + UiPluginResourceBundle.DatapoolExportWizard_unencrypted); >+ group.setVisible(false); >+ textArea.setText(""); >+ >+ //setPageComplete(true); >+ getContainer().updateButtons(); >+ } >+ } >+ > } > }; >+ group = new Group(topLevel,SWT.NULL); >+ group.setText(UiPluginResourceBundle.DatapoolExportWizard_password); >+ group.setLayoutData(GridDataUtil.createHorizontalFill()); >+ group.setLayout(new FormLayout()); >+ group.setVisible(false); >+ textArea = new Text(group, SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER | SWT.PASSWORD); >+ formData = new FormData(); >+ formData.left = new FormAttachment(0,5); >+ formData.top = new FormAttachment(0,5); >+ formData.bottom = new FormAttachment(80,-5); >+ formData.width = 200; >+ textArea.setLayoutData(formData); >+ >+ >+ textArea.addModifyListener(new ModifyListener(){ >+ public void modifyText(ModifyEvent e){ >+ if(textArea.getText().length()>0){ >+ setPageComplete(valid); >+ } >+ } >+ }); > setControl(topLevel); > validateSelection(); > } >@@ -319,7 +376,7 @@ > } > > protected boolean validateSelection() { >- boolean valid = true; >+ valid = true; > setMessage(null); > setErrorMessage(null); > if (existingDatapoolButtonStatus) { >@@ -403,4 +460,11 @@ > { > return datapoolSelectionViewer.getSelectedFiles(); > } >+ public Text getTextArea(){ >+ return textArea; >+ } >+ >+ public boolean isEncrypted(){ >+ return isEncrypted; >+ } > } >Index: src/org/eclipse/hyades/test/ui/datapool/internal/util/ValueObject.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/datapool/internal/util/ValueObject.java,v >retrieving revision 1.4 >diff -u -r1.4 ValueObject.java >--- src/org/eclipse/hyades/test/ui/datapool/internal/util/ValueObject.java 3 May 2007 18:21:30 -0000 1.4 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/util/ValueObject.java 18 Jan 2008 02:51:46 -0000 >@@ -23,7 +23,7 @@ > public class ValueObject { > > private Object theObject; >- private IDisplayValueClass valueClass; >+ protected IDisplayValueClass valueClass; > private String description; > private Object display; > >@@ -65,6 +65,21 @@ > return null; > } > >+ public Object getEncryptedDisplay(Composite parent) >+ { >+ if ( display != null && display instanceof CellEditor ) >+ { >+ Control control = ((CellEditor)display).getControl(); >+ if ( control != null && !control.isDisposed() ) >+ return display; >+ } >+ if ( valueClass != null ) >+ { >+ display = ((EncryptedStringValueClass)valueClass).getPropertyDisplay(theObject, parent, true); >+ return display; >+ } >+ return null; >+ } > public Object getDialogDisplay(Composite parent, boolean isEditable) > { > return null; >Index: src/org/eclipse/hyades/test/ui/internal/resources/UiPluginResourceBundle.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/resources/UiPluginResourceBundle.java,v >retrieving revision 1.5 >diff -u -r1.5 UiPluginResourceBundle.java >--- src/org/eclipse/hyades/test/ui/internal/resources/UiPluginResourceBundle.java 5 Dec 2007 20:01:49 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/resources/UiPluginResourceBundle.java 18 Jan 2008 02:51:52 -0000 >@@ -69,6 +69,36 @@ > public static String DatapoolImportWizard_editOrSelectDatapool; > public static String DatapoolImportWizard_selectCSV; > public static String DatapoolImportWizard_selectDatapool; >+ public static String DatapoolExportWizard_encrypted; >+ public static String DatapoolExportWizard_unencrypted; >+ public static String DatapoolExportWizard_wrongpass; >+ public static String DatapoolExportWizard_rightpass; >+ public static String DatapoolExportWizard_password; >+ public static String DatapoolDialog_CHANGEKEY; >+ public static String DatapoolDialog_ENCRYPTED; >+ public static String DatapoolDialog_ASSIGNKEYDIALOGTITLE; >+ public static String DatapoolDialog_CHANGEKEYDIALOGTITLE; >+ public static String DatapoolDialog_OLDKEY; >+ public static String DatapoolDialog_NEWKEY; >+ public static String DatapoolDialog_CONFIRMNEWKEY; >+ public static String DatapoolDialog_ORIGINKEYERRORMES; >+ public static String DatapoolDialog_NEWKEYNULLMES; >+ public static String DatapoolDialog_NEWKEYNOTCONFIRMMES; >+ public static String DatapoolDialog_WRONGLOGONKEYMES; >+ public static String DatapoolDialog_ERRORDIALOGTITLE; >+ public static String DatapoolDialog_KEY; >+ public static String DatapoolDialog_LOGONDIALOGTITLE; >+ public static String DatapoolDialog_ENCRYPTEDID; >+ public static String DatapoolDialog_ENCRYPTEDDISPLAYVALUE; >+ public static String DatapoolDialog_ERRORFOREDITENCRYPTEDVALUE; >+ public static String DatapoolDialog_INPUTKEYDIALGOTITLE; >+ public static String DatapoolDialog_TRUE; >+ public static String DatapoolDialog_OK; >+ public static String DatapoolDialog_PASSWORDSHINT; >+ public static String DatapoolDialog_SPLITMARK; >+ public static String DatapoolDialog_TRYAGAIN; >+ public static String DatapoolDialog_NOTALLMATCH; >+ public static String DatapoolDialog_INPUTPASSHINT; > public static String ToggleViewAction_resource_label; > public static String ToggleViewAction_resource_description; > public static String ToggleViewAction_resource_tooltip; >Index: src/org/eclipse/hyades/test/ui/internal/resources/messages.properties >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/resources/messages.properties,v >retrieving revision 1.7 >diff -u -r1.7 messages.properties >--- src/org/eclipse/hyades/test/ui/internal/resources/messages.properties 5 Dec 2007 20:01:49 -0000 1.7 >+++ src/org/eclipse/hyades/test/ui/internal/resources/messages.properties 18 Jan 2008 02:51:59 -0000 >@@ -64,7 +64,37 @@ > DatapoolImportWizard_editOrSelectDatapool=Please edit the datapool or select a different one and import again. > DatapoolImportWizard_selectCSV=&Select the CSV file to import data from: > DatapoolImportWizard_selectDatapool= Select a datapool to import data into: >- >+DatapoolExportWizard_encrypted= is encrypted. Please supply the password. >+DatapoolExportWizard_unencrypted= is not encrypted. Press Finish to complete. >+DatapoolExportWizard_wrongpass=Wrong password. Try again or cancel. >+DatapoolExportWizard_rightpass=You passed. Check Finish to complete. >+DatapoolExportWizard_password=Password for >+ >+DatapoolDialog_CHANGEKEY=Change Password >+DatapoolDialog_ENCRYPTED=Encrypted >+DatapoolDialog_ASSIGNKEYDIALOGTITLE=Assign Password >+DatapoolDialog_CHANGEKEYDIALOGTITLE=Change Password >+DatapoolDialog_OLDKEY=Origin Password >+DatapoolDialog_NEWKEY=New Password >+DatapoolDialog_CONFIRMNEWKEY=Confirm New Password >+DatapoolDialog_ORIGINKEYERRORMES=The origin Password is wrong >+DatapoolDialog_NEWKEYNULLMES=The new Password should not be null >+DatapoolDialog_NEWKEYNOTCONFIRMMES=The confirm Password is not the same as the new Password >+DatapoolDialog_WRONGLOGONKEYMES=The Password input is incorrect >+DatapoolDialog_ERRORDIALOGTITLE=Error >+DatapoolDialog_KEY=Key >+DatapoolDialog_LOGONDIALOGTITLE=Log on >+DatapoolDialog_ENCRYPTEDID=isencrypted >+DatapoolDialog_ENCRYPTEDDISPLAYVALUE=****** >+DatapoolDialog_ERRORFOREDITENCRYPTEDVALUE=The cell has been encrypted , please decrypted it before editing >+DatapoolDialog_INPUTKEYDIALGOTITLE=Input Password >+DatapoolDialog_TRUE=true >+DatapoolDialog_OK=OK >+DatapoolDialog_PASSWORDSHINT=password for the following are not correct!:\n\n >+DatapoolDialog_SPLITMARK=:: >+DatapoolDialog_TRYAGAIN=\n\nPlease try again or Cancel >+DatapoolDialog_NOTALLMATCH=Passwords not all matched! >+DatapoolDialog_INPUTPASSHINT=Please enter the passwords for each encrypted datapool: > ToggleViewAction_resource_label=Resource test navigator > ToggleViewAction_resource_description=Show the resource test navigator > ToggleViewAction_resource_tooltip=Show the resource test navigator >Index: src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java,v >retrieving revision 1.44 >diff -u -r1.44 DatapoolTable.java >--- src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java 24 May 2007 12:06:55 -0000 1.44 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/control/DatapoolTable.java 18 Jan 2008 02:51:44 -0000 >@@ -25,14 +25,22 @@ > import org.eclipse.hyades.edit.datapool.IDatapoolRecord; > import org.eclipse.hyades.edit.datapool.IDatapoolSuggestedType; > import org.eclipse.hyades.edit.datapool.IDatapoolVariable; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.datapool.DPLVariable; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; >+import org.eclipse.hyades.models.common.util.EncryptionManager; > import org.eclipse.hyades.test.ui.UiPlugin; >+import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolChangeKeyDialog; > import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolColumnDialog; >+import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolConstant; > import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolDeleteColumnDialog; >+import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolInputKeyDialog; > import org.eclipse.hyades.test.ui.datapool.internal.dialog.DatapoolRowDialog; > import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IDatapoolPart; > import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValidateValueClass; > import org.eclipse.hyades.test.ui.datapool.internal.interfaces.IValueClassFactory; > import org.eclipse.hyades.test.ui.datapool.internal.util.DatapoolUtil; >+import org.eclipse.hyades.test.ui.datapool.internal.util.EncryptedValueObject; > import org.eclipse.hyades.test.ui.datapool.internal.util.TypeChecker; > import org.eclipse.hyades.test.ui.datapool.internal.util.ValueClassMap; > import org.eclipse.hyades.test.ui.datapool.internal.util.ValueObject; >@@ -135,6 +143,9 @@ > private boolean showRecords = true; > private boolean isF2Mode = false; > private int previousMultiRowSelectionIndex = -1; // only used for deselecting when multi-selection in place. >+ private String cellkey; >+ private boolean passwordExist = false; >+ private String password = null; > > private String vendorID = null; > >@@ -1379,19 +1390,66 @@ > if(rawValue == null) > { > String typeName = suggestedType.getSuggestedClassName(); >- if(typeName == null || typeName.length() == 0) >- { >+ if (typeName == null || typeName.length() == 0) { > rawValue = new String(); >- } >- else >- { >+ } else { > rawValue = createEmptyCellObject(typeName); > } > } >- >- theValueObject = new ValueObject(rawValue); >- cellEditor = (CellEditor)theValueObject.getPropertyDisplay(tableCursor); >- } >+ if(DatapoolEncryptManager.isVaribelEncrypted(variable)) >+ { >+ boolean errorKey = true; >+ boolean isCancelChange = false; >+ String key = null; >+ if(passwordExist){ >+ key = password; >+ }else{ >+ DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( >+ Display.getCurrent().getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE); >+ // String key = getKeyInDatapool(datapool); >+ >+ while (errorKey) { >+ int openValue = logOnDialog.open(); >+ if (openValue == IDialogConstants.OK_ID) { >+ key = logOnDialog.getKey(); >+ cellkey = key; >+ if (DatapoolEncryptManager.isKeyCorrect(datapool, key)) { >+ errorKey = false; >+ password = key; >+ passwordExist = true; >+ } else {//the input key is incorrect >+ showErrMes(Display.getCurrent() >+ .getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); >+ } >+ } else if (openValue == IDialogConstants.CANCEL_ID) {// click cancel button >+ isCancelChange = true; >+ errorKey = false; >+ >+ } >+ } >+ >+ if(isCancelChange) >+ { >+ return; >+ } >+ } >+ rawValue = EncryptionManager.decrypt(rawValue.toString(), key); >+ theValueObject = new EncryptedValueObject(rawValue); >+ cellEditor = (CellEditor) theValueObject >+ .getEncryptedDisplay(tableCursor); >+ }else{ >+ theValueObject = new ValueObject(rawValue); >+ cellEditor = (CellEditor) theValueObject >+ .getPropertyDisplay(tableCursor); >+ } >+// cellEditor = new TextCellEditor(tableCursor,SWT.PASSWORD); >+// cellEditor.setValue(rawValue.toString()); >+// int oldStyle = cellEditor.getStyle(); >+// cellEditor.setStyle(SWT.PASSWORD|oldStyle); >+// oldStyle = cellEditor.getStyle(); >+ } > > if(cellEditor != null && cellEditor.getControl() != null) > { >@@ -1491,8 +1549,14 @@ > } > } > >- if(update) >- { >+ if (update) { >+ if(DatapoolEncryptManager.isVaribelEncrypted(cell.getCellVariable())) >+ { >+ String value = String.valueOf(updatedValue); >+ String encryptValue = DatapoolEncryptManager.encrypt(value, cellkey); >+ updatedValue = (Object)encryptValue; >+ >+ } > cell.setCellValue(updatedValue); > selectedTableItem.setText(selectedColumnIndex, newDescription); > tableCursor.setSelection(table.getSelectionIndex(), selectedColumnIndex); >@@ -1501,6 +1565,7 @@ > } > > if(dispose) >+ refreshRows(); > clearCellEditor(); > } > } >@@ -1838,15 +1903,88 @@ > > IDatapool datapool = getDatapool(); > DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display.getCurrent().getActiveShell(), datapool, null, previousVariable, UiPluginResourceBundle.DATA_COL_DLG_TITLE_INS); >- if ( dialog.open() == IDialogConstants.OK_ID) >- { >+ if (dialog.open() == IDialogConstants.OK_ID) { >+ if(dialog.isEncrypted()){ >+ String key = null; >+ if(isKeyExist()) >+ { >+ boolean errorKey = true; >+ if(passwordExist && !dialog.isKeyChanged()){ >+ key = password; >+ }else{ >+ DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( >+ Display.getCurrent().getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE); >+ while (errorKey) { >+ int openValue = logOnDialog.open(); >+ if (openValue == IDialogConstants.OK_ID) { >+ key = logOnDialog.getKey(); >+ if (DatapoolEncryptManager.isKeyCorrect(datapool,key)) { >+ errorKey = false; >+ password = key; >+ passwordExist = true; >+ } else { >+ showErrMes(Display.getCurrent() >+ .getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); >+ } >+ } else if (openValue == IDialogConstants.CANCEL_ID) { >+ errorKey = false; >+ } >+ } >+ } >+ } >+ else >+ { >+ Shell shell = Display.getCurrent().getActiveShell(); >+ DatapoolChangeKeyDialog assignKeyDialog = new DatapoolChangeKeyDialog( >+ shell, datapool, >+ UiPluginResourceBundle.DatapoolDialog_ASSIGNKEYDIALOGTITLE); >+ boolean errorKey = true; >+ while (errorKey) { >+ if (assignKeyDialog.open() == IDialogConstants.OK_ID) { >+ key = assignKeyDialog.getNewKey(); >+ int ret = assignKeyDialog.isKeyAssignSuccess(); >+ switch (ret) { >+ case DatapoolConstant.NEWKEYNULL: >+ showErrMes(shell, >+ UiPluginResourceBundle.DatapoolDialog_NEWKEYNULLMES); >+ break; >+ case DatapoolConstant.NEWKEYNOTCONFIRM: >+ showErrMes( >+ shell, >+ UiPluginResourceBundle.DatapoolDialog_NEWKEYNOTCONFIRMMES); >+ break; >+ case DatapoolConstant.CHANGEKEYSUCCESS: >+ try{ >+ DatapoolEncryptManager.ChangeKey(EncryptionManager.EncoderByMd5(key), >+ datapool); >+// >+ errorKey = false; >+ password = key; >+ passwordExist = true; >+ }catch(Exception e){} >+ break; >+ default:// error >+ } >+ } else { >+ errorKey = false; >+ } >+ } >+ } >+ } >+ > setWaitCursor(); > IDatapoolVariable variable = datapool.constructVariable(); > variable.setName(dialog.getName()); > IDatapoolSuggestedType suggestedType = (IDatapoolSuggestedType)variable.getSuggestedType(); > setVariableType(suggestedType, dialog.getType()); > variable.setSuggestedType(suggestedType); >- int insertionIndex = findColumnIndex(dialog.getInsertionVariableName()); >+ >+ ((DPLVariable)variable).setEncrypted(dialog.isEncrypted()); >+ >+ int insertionIndex = findColumnIndex(dialog >+ .getInsertionVariableName()); > if(insertionIndex == -1) > insertionIndex = 0; > >@@ -1858,6 +1996,7 @@ > if (tableCursor != null && !tableCursor.isDisposed() && !(row < 0 || row >= table.getItemCount() || insertionIndex < 0 || insertionIndex > maxColumnIndex)) { > tableCursor.setSelection(row, insertionIndex + 1); > } >+ refreshRows(); > } > } > >@@ -1922,6 +2061,7 @@ > * Function that actually does the editing of the variable/column. > */ > private void editColumnAux(TableColumn tableColumn) { >+ boolean isVariableEncrypted = false; > try { > if (showVariables == false) return; > >@@ -1932,8 +2072,110 @@ > IDatapoolVariable previousVariable = null; > if (previousTableColumn != null) previousVariable = (IDatapoolVariable) previousTableColumn.getData(TAG_VARIABLE); > IDatapoolVariable variable = (IDatapoolVariable) tableColumn.getData(TAG_VARIABLE); >- DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display.getCurrent().getActiveShell(), datapool, variable, previousVariable, UiPluginResourceBundle.DATA_COL_DLG_TITLE_EDIT); //$NON-NLS-1$ >- if (dialog.open() == IDialogConstants.OK_ID) { >+ DatapoolColumnDialog dialog = new DatapoolColumnDialog(Display >+ .getCurrent().getActiveShell(), datapool, variable, >+ previousVariable, >+ UiPluginResourceBundle.DATA_COL_DLG_TITLE_EDIT); //$NON-NLS-1$ >+ isVariableEncrypted = DatapoolEncryptManager.isVaribelEncrypted(variable); >+ String key = null; >+ if (dialog.open() == IDialogConstants.OK_ID) { >+ if (isNeedKeyVerify(dialog,isVariableEncrypted)) {//need to confrim key or assign a new key >+ boolean isCancelChange = false; >+ if(isKeyExist())//key exists means it needs to confirm key >+ { >+ //if(dialog.isKeyChanged()) >+ //{ >+ //key = dialog.getKey(); >+ //} >+ boolean errorKey = true; >+ >+ if(passwordExist && !dialog.isKeyChanged()){ >+ key = password; >+ }else{ >+ >+ DatapoolInputKeyDialog logOnDialog = new DatapoolInputKeyDialog( >+ Display.getCurrent().getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE); >+ while (errorKey) { >+ int openValue = logOnDialog.open(); >+ if (openValue == IDialogConstants.OK_ID) { >+ key = logOnDialog.getKey(); >+ if (DatapoolEncryptManager.isKeyCorrect(datapool,key)) { >+ errorKey = false; >+ password = key; >+ passwordExist = true; >+ } else {//the input key is incorrect >+ showErrMes(Display.getCurrent() >+ .getActiveShell(), >+ UiPluginResourceBundle.DatapoolDialog_WRONGLOGONKEYMES); >+ } >+ } else if (openValue == IDialogConstants.CANCEL_ID) {// click cancel button >+ isCancelChange = true; >+ errorKey = false; >+ } >+ } >+ } >+ } >+ else//it should assing a new key >+ { >+ Shell shell = Display.getCurrent().getActiveShell(); >+ DatapoolChangeKeyDialog assignKeyDialog = new DatapoolChangeKeyDialog( >+ shell, datapool, >+ UiPluginResourceBundle.DatapoolDialog_ASSIGNKEYDIALOGTITLE); >+ boolean errorKey = true; >+ >+ while (errorKey) { >+ >+ if (assignKeyDialog.open() == IDialogConstants.OK_ID) { >+ key = assignKeyDialog.getNewKey(); >+ int ret = assignKeyDialog.isKeyAssignSuccess(); >+ switch (ret) { >+ case DatapoolConstant.NEWKEYNULL: >+ showErrMes(shell, >+ UiPluginResourceBundle.DatapoolDialog_NEWKEYNULLMES); >+ break; >+ case DatapoolConstant.NEWKEYNOTCONFIRM: >+ showErrMes( >+ shell, >+ UiPluginResourceBundle.DatapoolDialog_NEWKEYNOTCONFIRMMES); >+ break; >+ case DatapoolConstant.CHANGEKEYSUCCESS: >+ try{ >+ DatapoolEncryptManager.ChangeKey(EncryptionManager.EncoderByMd5(key), >+ datapool); >+// encryptedCellInVarible(variable,newKey); >+ errorKey = false; >+ >+ //TODO: added >+ password = key; >+ passwordExist = true; >+ }catch(Exception e){} >+ break; >+ default:// error >+ } >+ >+ } else { >+ isCancelChange = true; >+ errorKey = false; >+ } >+ } >+ } >+ if(!isCancelChange)//input the correct key >+ { >+ if (dialog.isEncrypted()) { >+ if (!isVariableEncrypted) {//encrypted a varible which didn't encrypted >+ DatapoolEncryptManager.encryptedCellInVarible(variable,key,datapool); >+ if(variable instanceof DPLVariable) >+ ((DPLVariable)variable).setEncrypted(true); >+ } >+ >+ } else { >+ if (isVariableEncrypted) {//deencrypted a encrypted variable >+ DatapoolEncryptManager.deencryptedCellInVarible(variable,key,datapool); >+ if(variable instanceof DPLVariable) >+ ((DPLVariable)variable).setEncrypted(false); >+ } >+ } > setWaitCursor(); > String name = dialog.getName(); > String insertionVariableID = dialog.getInsertionVariableID(); >@@ -1945,8 +2187,43 @@ > variable.setName(dialog.getName()); > setVariableType(suggestedType, dialog.getType()); > variable.setSuggestedType(suggestedType); >+ int insertionIndex = findColumnIndex(dialog >+ .getInsertionVariableName()); >+ if (insertionIndex == columnIndex - 1) { >+ refresh(); >+ return; >+ } >+ if (insertionIndex == -1) >+ datapool.moveVariable(columnIndex - 1, 0); >+ else if (insertionIndex > columnIndex) >+ datapool.moveVariable(columnIndex - 1, >+ insertionIndex - 1); >+ else >+ datapool.moveVariable(columnIndex - 1, insertionIndex); > >- int insertionIndex = findColumnIndex(dialog.getInsertionVariableName()); >+ refreshRows();//needs to refresh row >+ tableCursor.setSelection(0, 0); >+ } >+ >+ } else { >+ setWaitCursor(); >+ >+ String name = dialog.getName(); >+ String insertionVariableID = dialog >+ .getInsertionVariableID(); >+ >+ IDatapoolSuggestedType suggestedType = (IDatapoolSuggestedType) variable >+ .getSuggestedType(); >+ if (name.equals(variable.getName()) >+ && insertionVariableID.equals(variable.getId())) { >+ return; >+ } >+ variable.setName(dialog.getName()); >+ setVariableType(suggestedType, dialog.getType()); >+ variable.setSuggestedType(suggestedType); >+ >+ int insertionIndex = findColumnIndex(dialog >+ .getInsertionVariableName()); > if (insertionIndex == columnIndex - 1) { > return; > } >@@ -1956,8 +2233,9 @@ > datapool.moveVariable(columnIndex - 1, insertionIndex - 1); > else > datapool.moveVariable(columnIndex - 1, insertionIndex); >+ tableCursor.setSelection(0, 0); > } >- } finally { >+ }} finally { > unsetWaitCursor(); > } > } >@@ -2890,7 +3168,12 @@ > IDatapoolVariable cellVariable = (IDatapoolVariable)cell.getCellVariable(); > int index = findColumnIndex(cellVariable.getName()); > String cellValue = cell.getStringValue(); >- ValueObject valueObject = new ValueObject(cell.getCellValue()); >+ if(DatapoolEncryptManager.isVaribelEncrypted(cell.getCellVariable())) >+ { >+ cellValue = UiPluginResourceBundle.DatapoolDialog_ENCRYPTEDDISPLAYVALUE; >+ } >+// ValueObject valueObject = new ValueObject(cell.getCellValue()); >+ ValueObject valueObject = new ValueObject(cellValue); > if(valueObject != null) > cellValue = valueObject.getDescription(); > rowContents[index] = cellValue; >@@ -3013,4 +3296,19 @@ > setMenuMode(datapoolMenuManager); > } > >+ public void setPassword(String password){ >+ this.password = password; >+ } >+ private void showErrMes(Shell shell, String mes) { >+ MessageDialog.openError(shell, UiPluginResourceBundle.DatapoolDialog_ERRORDIALOGTITLE, mes); >+ } >+ >+ private boolean isNeedKeyVerify(DatapoolColumnDialog dialog,boolean isVariableEncrypted) >+ { >+ return dialog.isEncrypted() || isVariableEncrypted; >+ } >+ private boolean isKeyExist() >+ { >+ return (datapool instanceof DPLDatapool)?(((DPLDatapool)datapool).getChallenge()!=null):false; >+ } > } >Index: src/org/eclipse/hyades/test/ui/internal/editor/DatapoolEditorPart.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/src/org/eclipse/hyades/test/ui/internal/editor/DatapoolEditorPart.java,v >retrieving revision 1.5 >diff -u -r1.5 DatapoolEditorPart.java >--- src/org/eclipse/hyades/test/ui/internal/editor/DatapoolEditorPart.java 27 May 2005 04:31:09 -0000 1.5 >+++ src/org/eclipse/hyades/test/ui/internal/editor/DatapoolEditorPart.java 18 Jan 2008 02:51:47 -0000 >@@ -12,7 +12,10 @@ > package org.eclipse.hyades.test.ui.internal.editor; > > import org.eclipse.emf.ecore.EObject; >+import org.eclipse.hyades.edit.datapool.IDatapool; > import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.datapool.impl.DPLVariableImpl; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; > import org.eclipse.hyades.models.common.util.ICommonConstants; > import org.eclipse.hyades.test.ui.TestUIExtension; > import org.eclipse.hyades.test.ui.internal.editor.extension.DatapoolEditorExtension; >@@ -86,5 +89,23 @@ > return true; > } > >- >+ public void dispose(){ >+ if(this.getEditorExtension() instanceof DatapoolEditorExtension){ >+ IDatapool dp = ((DatapoolEditorExtension)this.getEditorExtension()).getDatapool(); >+ boolean isAnyColumnEncrypted = false; >+ int variableCount = dp.getVariableCount(); >+ for(int i=0;i<variableCount;i++){ >+ if(DatapoolEncryptManager.isVaribelEncrypted(((DPLVariableImpl)dp.getVariable(i)))){ >+ isAnyColumnEncrypted = true; >+ break; >+ } >+ } >+ if(!isAnyColumnEncrypted && (dp instanceof DPLDatapool)){ >+ ((DPLDatapool)dp).setChallenge(null); >+ ((DatapoolEditorExtension)this.getEditorExtension()).save(); >+ } >+ } >+ super.dispose(); >+ >+ } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.ui/plugin.xml,v >retrieving revision 1.79 >diff -u -r1.79 plugin.xml >--- plugin.xml 14 Jan 2008 12:02:05 -0000 1.79 >+++ plugin.xml 18 Jan 2008 02:51:34 -0000 >@@ -900,6 +900,14 @@ > testType="org.eclipse.hyades.test.http.junit.testSuite"> > </verdictProvider> > </extension> >+ <extension >+ point="org.eclipse.hyades.test.core.launchDatapoolCheckPass"> >+ <launchDatapoolCheckPass >+ UIClass="org.eclipse.hyades.test.ui.dialog.DatapoolCheck"> >+ <supportedTestType> >+ </supportedTestType> >+ </launchDatapoolCheckPass> >+ </extension> > > > </plugin> >Index: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolConstant.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolConstant.java >diff -N src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolConstant.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolConstant.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolConstant.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.ui.datapool.internal.dialog; >+ >+/** >+* It's used to provide constant message for datapool related dialog . >+* >+* @author Huang Xin Ying >+*/ >+public class DatapoolConstant { >+ public static final int CHANGEKEYSUCCESS = 0; >+ public static final int ORIGINTKEYERROR = 1; >+ public static final int NEWKEYNULL = 2; >+ public static final int NEWKEYNOTCONFIRM = 3; >+} >Index: src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedStringValueClass.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedStringValueClass.java >diff -N src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedStringValueClass.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedStringValueClass.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,40 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: EncryptedStringValueClass.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.ui.datapool.internal.util; >+ >+import org.eclipse.jface.viewers.TextCellEditor; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+* @author Huang Xin Ying >+*/ >+public class EncryptedStringValueClass extends StringValueClass{ >+ public Object getPropertyDisplay(Object theObject, Composite parent, boolean editable) >+ { >+ if(editable && theObject != null) >+ { >+ TextCellEditor cellEditor = new TextCellEditor(parent,SWT.PASSWORD); >+ >+ cellEditor.setValue(theObject.toString()); >+ return cellEditor; >+ } >+ else >+ { >+ Label label = new Label(parent, SWT.NONE); >+ label.setText(getPropertyDescription(theObject)); >+ return label; >+ } >+ } >+ >+} >Index: src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedValueObject.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedValueObject.java >diff -N src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedValueObject.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/util/EncryptedValueObject.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,28 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: EncryptedValueObject.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+ >+package org.eclipse.hyades.test.ui.datapool.internal.util; >+ >+/** >+* @author Huang Xin Ying >+*/ >+public class EncryptedValueObject extends ValueObject{ >+ >+ public EncryptedValueObject(Object theObject) { >+ super(theObject); >+ valueClass = new EncryptedStringValueClass(); >+ >+ // TODO Auto-generated constructor stub >+ } >+ >+ >+} >Index: src/org/eclipse/hyades/test/ui/dialog/DatapoolCheck.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/dialog/DatapoolCheck.java >diff -N src/org/eclipse/hyades/test/ui/dialog/DatapoolCheck.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/dialog/DatapoolCheck.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,325 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolCheck.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.ui.dialog; >+ >+import java.util.ArrayList; >+import java.util.Collections; >+import java.util.HashMap; >+import java.util.List; >+import java.util.Map; >+import org.eclipse.hyades.models.common.datapool.DPLDatapool; >+import org.eclipse.hyades.models.common.util.EncryptionManager; >+import org.eclipse.hyades.test.core.launch.extensions.IPassInfoCollector; >+import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.jface.dialogs.Dialog; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.MouseAdapter; >+import org.eclipse.swt.events.MouseEvent; >+import org.eclipse.swt.layout.FormAttachment; >+import org.eclipse.swt.layout.FormData; >+import org.eclipse.swt.layout.FormLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+ * >+ * It's the implementation of launchDatapoolCheckPass extension point , provide >+ * dialog to prompt user input password for encrypted datapool during launching a test >+ * on workbench side . >+ * >+ * @author Huang Xin Ying >+ */ >+public class DatapoolCheck implements IPassInfoCollector { >+ >+ public DatapoolCheck() { >+ } >+ >+ public void execute(DPLDatapool[] dp, Map pass, List isContinue) { >+ DialogRun dr = new DialogRun(); >+ dr.setDp(dp); >+ dr.setContinue(isContinue); >+ dr.setPass(pass); >+ Display.getDefault().syncExec(dr); >+ } >+ >+ private class DialogRun implements Runnable { >+ private DPLDatapool[] dp; >+ private Map pass; >+ private List isContinue; >+ >+ public void setDp(DPLDatapool[] dp) { >+ this.dp = dp; >+ } >+ >+ public void setPass(Map pass) { >+ this.pass = pass; >+ } >+ >+ public void setContinue(List isContinue) { >+ this.isContinue = isContinue; >+ } >+ >+ public void run() { >+ String testId = null; >+ if(isContinue != null && isContinue.size() == 1){ >+ testId = (String)isContinue.get(0); >+ isContinue.clear(); >+ } >+ DatapoolCheckDialog db = new DatapoolCheckDialog(null, >+ dp, >+ UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE, >+ pass, >+ testId); >+ db.setBlockOnOpen(true); >+ if (db.open() == IDialogConstants.OK_ID) { >+ isContinue.add(UiPluginResourceBundle.DatapoolDialog_TRUE); >+ } >+ } >+ } >+ >+ >+ private class DatapoolCheckDialog extends Dialog { >+ private Button okButton; >+ >+ private Button checkButton; >+ >+ private DPLDatapool[] dp; >+ private String title; >+ private int dpNameLength = 0; >+ private int oriHeight = 0; >+ private Label[] name; >+ private Text[] pass; >+ private Button[] status; >+ private List unCorrectList = new ArrayList(); >+ private Map passed; >+ private String testId; >+ >+ /** >+ * @param parentShell >+ */ >+ public DatapoolCheckDialog(Shell parentShell) { >+ super(parentShell); >+ } >+ >+ public DatapoolCheckDialog(Shell parentShell, DPLDatapool[] dp, >+ String title, Map passed,String testId) { >+ super(parentShell); >+ this.dp = dp; >+ this.title = title; >+ this.passed = passed; >+ this.testId = testId; >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) >+ */ >+ protected void createButtonsForButtonBar(Composite parent) { >+ // create OK and Cancel buttons by default >+ okButton = createButton(parent, IDialogConstants.OK_ID, >+ IDialogConstants.OK_LABEL, true); >+ checkButton = createButton(parent, IDialogConstants.YES_ID, >+ IDialogConstants.YES_LABEL, false); >+ checkButton.setText(UiPluginResourceBundle.DatapoolDialog_OK); >+ checkButton.addMouseListener(new MouseAdapter() { >+ public void mouseDown(MouseEvent e) { >+ // check all the passwords >+ for (int i = 0; i < dp.length; i++) { >+ try { >+ if (status[i].getSelection()) { >+ continue; >+ } else if (dp[i].getChallenge().equals( >+ EncryptionManager.EncoderByMd5(pass[i].getText()))) { >+ >+ if(passed.get(testId) == null){ >+ passed.put(testId, new HashMap()); >+ } >+ HashMap thm = (HashMap)passed.get(testId); >+ thm.put(dp[i].getName(), pass[i].getText()); >+ >+ pass[i].setEnabled(false); >+ status[i].setSelection(true); >+ if (unCorrectList != null >+ && unCorrectList.contains(dp[i])) { >+ unCorrectList.remove(dp[i]); >+ } >+ } else { >+ pass[i].setText(""); >+ if (!unCorrectList.contains(dp[i])) >+ unCorrectList.add(dp[i]); >+ } >+ } catch (Exception er) { >+ er.printStackTrace(); >+ } >+ } >+ // if all status is true, then set ok button can be pressed >+ if (unCorrectList.size() == 0) { >+ okPressed(); >+ return; >+ } >+ >+ StringBuffer toShow = new StringBuffer(); >+ toShow >+ .append(UiPluginResourceBundle.DatapoolDialog_PASSWORDSHINT); >+ for (int i = 0; i < unCorrectList.size(); i++) { >+ toShow.append(((DPLDatapool) unCorrectList.get(i)) >+ .getName().split(UiPluginResourceBundle.DatapoolDialog_SPLITMARK)[0]); >+ if (i < unCorrectList.size() - 1) { >+ toShow.append(",\n"); >+ } >+ } >+ toShow.append(UiPluginResourceBundle.DatapoolDialog_TRYAGAIN); >+ >+ MessageDialog dialog = new MessageDialog(null, >+ UiPluginResourceBundle.DatapoolDialog_NOTALLMATCH, // the dialog title >+ null, toShow.toString(), // text to be displayed >+ MessageDialog.WARNING, // dialog type >+ new String[] { UiPluginResourceBundle.DatapoolDialog_OK }, // button labels >+ 0); >+ dialog.open(); >+ } >+ }); >+ >+ createButton(parent, IDialogConstants.CANCEL_ID, >+ IDialogConstants.CANCEL_LABEL, false); >+ okButton.setVisible(false); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#getButton(int) >+ */ >+ protected Button getButton(int id) { >+ if (id == IDialogConstants.OK_ID) >+ return okButton; >+ return super.getButton(id); >+ } >+ >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.jface.dialogs.Dialog#getOKButton() >+ */ >+ protected Button getOKButton() { >+ return okButton; >+ } >+ >+ /* modified the content */ >+ protected Control createDialogArea(Composite parent) { >+ getShell().setText(title); >+ Composite superComposite = (Composite) super >+ .createDialogArea(parent); >+ >+ superComposite.setLayout(new FormLayout()); >+ >+ FormData formData; >+ >+ Label hint = new Label(superComposite, SWT.NULL); >+ hint.setText(UiPluginResourceBundle.DatapoolDialog_INPUTPASSHINT); >+ formData = new FormData(); >+ formData.left = new FormAttachment(superComposite, 5); >+ formData.top = new FormAttachment(superComposite, 5); >+ hint.setLayoutData(formData); >+ >+ if (dp != null && dp.length > 0) { >+ >+ name = new Label[dp.length]; >+ pass = new Text[dp.length]; >+ status = new Button[dp.length]; >+ >+ name[0] = new Label(superComposite, SWT.BORDER); >+ formData = new FormData(); >+ formData.left = new FormAttachment(superComposite, 5); >+ formData.top = new FormAttachment(hint, 10); >+ name[0].setLayoutData(formData); >+ name[0].setText(getdpNameLength()); >+ name[0].pack(); >+ dpNameLength = name[0].getSize().x; >+ oriHeight = name[0].getSize().y; >+ formData.width = dpNameLength; >+ formData.height = oriHeight; >+ name[0].setLayoutData(formData); >+ name[0].setText(dp[0].getName().split(UiPluginResourceBundle.DatapoolDialog_SPLITMARK)[0] + ":"); >+ >+ pass[0] = new Text(superComposite, SWT.PASSWORD | SWT.BORDER); >+ formData = new FormData(); >+ formData.left = new FormAttachment(name[0], 5); >+ formData.top = new FormAttachment(hint, 10); >+ formData.width = 50; >+ formData.height = oriHeight; >+ pass[0].setLayoutData(formData); >+ >+ status[0] = new Button(superComposite, SWT.CHECK); >+ formData = new FormData(); >+ formData.left = new FormAttachment(pass[0], 10); >+ formData.top = new FormAttachment(hint, 10); >+ formData.height = oriHeight; >+ status[0].setLayoutData(formData); >+ status[0].setSelection(false); >+ status[0].setEnabled(false); >+ status[0].setVisible(false); >+ >+ for (int i = 1; i < dp.length; i++) { >+ name[i] = new Label(superComposite, SWT.BORDER); >+ formData = new FormData(); >+ formData.left = new FormAttachment(superComposite, 5); >+ formData.top = new FormAttachment(name[i - 1], 10); >+ formData.width = dpNameLength; >+ formData.height = oriHeight; >+ name[i].setLayoutData(formData); >+ name[i].setText(dp[i].getName().split(UiPluginResourceBundle.DatapoolDialog_SPLITMARK)[0] + ":"); >+ >+ pass[i] = new Text(superComposite, SWT.PASSWORD >+ | SWT.BORDER); >+ formData = new FormData(); >+ formData.left = new FormAttachment(name[i], 5); >+ formData.top = new FormAttachment(name[i - 1], 5); >+ formData.width = 50; >+ formData.height = oriHeight; >+ pass[i].setLayoutData(formData); >+ >+ status[i] = new Button(superComposite, SWT.CHECK); >+ formData = new FormData(); >+ formData.left = new FormAttachment(pass[i], 10); >+ formData.top = new FormAttachment(name[i - 1], 5); >+ formData.height = oriHeight; >+ status[i].setLayoutData(formData); >+ status[i].setSelection(false); >+ status[i].setEnabled(false); >+ status[i].setVisible(false); >+ } >+ } >+ >+ superComposite.pack(); >+ return superComposite; >+ } >+ >+ private String getdpNameLength() { >+ List temp = new ArrayList(); >+ for (int i = 0; i < dp.length; i++) { >+ temp.add(dp[i].getName().length()); >+ } >+ int index = temp.indexOf(Collections.max(temp)); >+ return dp[index].getName(); >+ } >+ } >+ >+} >Index: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolInputKeyDialog.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolInputKeyDialog.java >diff -N src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolInputKeyDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolInputKeyDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,92 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolInputKeyDialog.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.ui.datapool.internal.dialog; >+ >+import org.eclipse.hyades.test.ui.datapool.internal.util.GridDataUtil; >+import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.KeyEvent; >+import org.eclipse.swt.events.KeyListener; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+* It's used to provide dialog for key input function . >+* >+* @author Huang Xin Ying >+*/ >+public class DatapoolInputKeyDialog extends DatapoolBaseDialog implements >+ KeyListener { >+ >+ private String title; >+ >+ private Text logOnField = null; >+ private Color logOnFieldForeground = null; >+ >+ private String key = ""; >+ >+ public DatapoolInputKeyDialog(Shell parentShell, String title) { >+ super(parentShell); >+ this.title = title; >+ // TODO Auto-generated constructor stub >+ } >+ >+ public void keyPressed(KeyEvent e) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void keyReleased(KeyEvent e) { >+ // TODO Auto-generated method stub >+ if (logOnField != null) { >+ key = logOnField.getText(); >+ } >+ >+ } >+ >+ protected Control createDialogArea(Composite parent) { >+ getShell().setText(title); >+ Composite superComposite = (Composite) super.createDialogArea(parent); >+ GridData gridData = GridDataUtil.createFill(); >+ gridData.minimumWidth = 250; >+ superComposite.setLayoutData(gridData); >+ >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.numColumns = 2; >+ superComposite.setLayout(gridLayout); >+ >+ Label logOnLabe = new Label(superComposite, SWT.NONE); >+ logOnLabe.setText(UiPluginResourceBundle.DatapoolDialog_INPUTKEYDIALGOTITLE); >+ logOnField = new Text(superComposite, SWT.SINGLE | SWT.BORDER >+ | SWT.PASSWORD); >+ gridData = new GridData(GridData.FILL_HORIZONTAL); >+ logOnField.setLayoutData(gridData); >+ logOnField.addKeyListener(this); >+ logOnFieldForeground = logOnField.getForeground(); >+ if (key != null) { >+ logOnField.setText(key); >+ } >+ superComposite.pack(); >+ return superComposite; >+ } >+ >+ public String getKey() { >+ return key; >+ } >+ >+} >Index: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolChangeKeyDialog.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolChangeKeyDialog.java >diff -N src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolChangeKeyDialog.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/ui/datapool/internal/dialog/DatapoolChangeKeyDialog.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,163 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolChangeKeyDialog.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.ui.datapool.internal.dialog; >+ >+import org.eclipse.hyades.edit.datapool.IDatapool; >+import org.eclipse.hyades.models.common.datapool.util.DatapoolEncryptManager; >+import org.eclipse.hyades.test.ui.datapool.internal.util.GridDataUtil; >+import org.eclipse.hyades.test.ui.internal.resources.UiPluginResourceBundle; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.KeyEvent; >+import org.eclipse.swt.events.KeyListener; >+import org.eclipse.swt.graphics.Color; >+import org.eclipse.swt.layout.GridData; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Combo; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Label; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Text; >+ >+/** >+* It's used to provide dialog for key change function . >+* >+* @author Huang Xin Ying >+*/ >+public class DatapoolChangeKeyDialog extends DatapoolBaseDialog implements >+ KeyListener { >+ >+ private IDatapool datapool = null; >+ private String title = null; >+ private Text oldKeyField = null; >+ private Text newKeyField = null; >+ private Text confirmKeyField = null; >+ private Color oldKeyFieldForeground = null; >+ private Color newKeyFieldForeground = null; >+ private Color confirmKeyFieldForeground = null; >+ private Combo insertionVariables = null; >+ private Label nameErrorLabel; >+ private Label typeErrorLabel; >+ >+ private String oldKey = null; >+ private String newKey = null; >+ private String confirmKey = null; >+ private String insertionVariableID = null; >+ private String insertionVariableName = null; >+ private int defaultNameCounter = 1; >+ >+ public DatapoolChangeKeyDialog(Shell parentShell, IDatapool datapool, >+ String title) { >+ super(parentShell); >+ this.title = title; >+ this.datapool = datapool; >+ // TODO Auto-generated constructor stub >+ } >+ >+ public void keyPressed(KeyEvent e) { >+ // TODO Auto-generated method stub >+ >+ } >+ >+ public void keyReleased(KeyEvent e) { >+ // TODO Auto-generated method stub >+ if (oldKeyField != null) { >+ oldKey = oldKeyField.getText(); >+ } >+ if (newKeyField != null) { >+ newKey = newKeyField.getText(); >+ } >+ if (confirmKeyField != null) { >+ confirmKey = confirmKeyField.getText(); >+ } >+ >+ } >+ >+ protected Control createDialogArea(Composite parent) { >+ getShell().setText(title); >+ Composite superComposite = (Composite) super.createDialogArea(parent); >+ GridData gridData = GridDataUtil.createFill(); >+ gridData.minimumWidth = 250; >+ superComposite.setLayoutData(gridData); >+ >+ GridLayout gridLayout = new GridLayout(); >+ gridLayout.numColumns = 2; >+ superComposite.setLayout(gridLayout); >+ if (title.equals(UiPluginResourceBundle.DatapoolDialog_CHANGEKEYDIALOGTITLE)) { >+ Label oldKeyLabel = new Label(superComposite, SWT.NONE); >+ oldKeyLabel.setText(UiPluginResourceBundle.DatapoolDialog_OLDKEY); >+ oldKeyField = new Text(superComposite, SWT.SINGLE | SWT.BORDER >+ | SWT.PASSWORD); >+ gridData = new GridData(GridData.FILL_HORIZONTAL); >+ oldKeyField.setLayoutData(gridData); >+ oldKeyField.addKeyListener(this); >+ oldKeyFieldForeground = oldKeyField.getForeground(); >+ } >+ Label newKeyLabel = new Label(superComposite, SWT.NONE); >+ newKeyLabel.setText(UiPluginResourceBundle.DatapoolDialog_NEWKEY); >+ newKeyField = new Text(superComposite, SWT.SINGLE | SWT.BORDER >+ | SWT.PASSWORD); >+ gridData = new GridData(GridData.FILL_HORIZONTAL); >+ newKeyField.setLayoutData(gridData); >+ newKeyField.addKeyListener(this); >+ newKeyFieldForeground = newKeyField.getForeground(); >+ >+ Label confirmKeyLabel = new Label(superComposite, SWT.NONE); >+ confirmKeyLabel.setText(UiPluginResourceBundle.DatapoolDialog_CONFIRMNEWKEY); >+ confirmKeyField = new Text(superComposite, SWT.SINGLE | SWT.BORDER >+ | SWT.PASSWORD); >+ gridData = new GridData(GridData.FILL_HORIZONTAL); >+ confirmKeyField.setLayoutData(gridData); >+ confirmKeyField.addKeyListener(this); >+ confirmKeyFieldForeground = confirmKeyField.getForeground(); >+ >+ superComposite.pack(); >+ return superComposite; >+ } >+ >+ public String getOldKey() { >+ return oldKey; >+ } >+ >+ public String getNewKey() { >+ return newKey; >+ } >+ >+ public String getConfirmKey() { >+ return confirmKey; >+ } >+ >+ public int isKeyChangeSuccess(IDatapool datapool) { >+ int retValue = DatapoolConstant.CHANGEKEYSUCCESS; >+ if (!DatapoolEncryptManager.isKeyCorrect(datapool, oldKey)) { >+ retValue = DatapoolConstant.ORIGINTKEYERROR; >+ } else if (newKey == null || newKey.equals("")) { >+ retValue = DatapoolConstant.NEWKEYNULL; >+ } else if (!newKey.equals(confirmKey)) { >+ retValue = DatapoolConstant.NEWKEYNOTCONFIRM; >+ } >+ return retValue; >+ >+ } >+ >+ public int isKeyAssignSuccess() { >+ int retValue = DatapoolConstant.CHANGEKEYSUCCESS; >+ if (newKey == null || newKey.equals("")) { >+ retValue = DatapoolConstant.NEWKEYNULL; >+ } else if (!newKey.equals(confirmKey)) { >+ retValue = DatapoolConstant.NEWKEYNOTCONFIRM; >+ } >+ return retValue; >+ >+ } >+ >+} >#P org.eclipse.hyades.test.tools.core >Index: src-common-runner/org/eclipse/hyades/test/common/runner/HyadesRunner.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.tools.core/src-common-runner/org/eclipse/hyades/test/common/runner/HyadesRunner.java,v >retrieving revision 1.13 >diff -u -r1.13 HyadesRunner.java >--- src-common-runner/org/eclipse/hyades/test/common/runner/HyadesRunner.java 26 Apr 2007 12:53:02 -0000 1.13 >+++ src-common-runner/org/eclipse/hyades/test/common/runner/HyadesRunner.java 18 Jan 2008 02:52:19 -0000 >@@ -22,12 +22,15 @@ > import org.eclipse.hyades.internal.execution.remote.AgentControllerUnavailableException; > import org.eclipse.hyades.internal.execution.remote.CustomCommandHandler; > import org.eclipse.hyades.internal.execution.remote.RemoteComponentSkeleton; >+import org.eclipse.hyades.models.common.datapool.util.DPLPasswordCollection; > import org.eclipse.hyades.models.common.facades.behavioral.impl.FacadeResourceFactoryImpl; > import org.eclipse.hyades.models.common.testprofile.impl.Common_TestprofilePackageImpl; > import org.eclipse.hyades.test.common.agent.ComptestAgent; > import org.eclipse.hyades.test.common.agent.PrimaryTestAgent; > import org.eclipse.hyades.test.common.agent.ServiceCommandHandler; >+import org.eclipse.hyades.test.common.agent.UnknownTestServiceException; > import org.eclipse.hyades.test.common.event.ExecutionEvent; >+import org.eclipse.hyades.test.common.testservices.resources.DatapoolPasswordProvider; > > /** > * @author jsutton >@@ -234,6 +237,12 @@ > } > } > } >+ //set password to Models >+ try { >+ DPLPasswordCollection.getInstance(). >+ setDatapoolPassword(DatapoolPasswordProvider.getDatapoolPassword(testID)); >+ } catch (UnknownTestServiceException e) { >+ } > > } > >@@ -246,6 +255,8 @@ > }; > > public void dispose() { >+ //clear the passwords in Models >+ DPLPasswordCollection.getInstance().clear(); > if (agent != null && agent.isRegistered()) { > Runtime.getRuntime().removeShutdownHook(disposeOnExitHook); > agent.deregister(); >Index: src-common-runner/org/eclipse/hyades/test/common/testservices/resources/DatapoolPasswordProvider.java >=================================================================== >RCS file: src-common-runner/org/eclipse/hyades/test/common/testservices/resources/DatapoolPasswordProvider.java >diff -N src-common-runner/org/eclipse/hyades/test/common/testservices/resources/DatapoolPasswordProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src-common-runner/org/eclipse/hyades/test/common/testservices/resources/DatapoolPasswordProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,76 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are 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 >+ * $Id: DatapoolPasswordProvider.java,v 1.0 2008/01/16 14:42:35 Xin Ying Exp $ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.common.testservices.resources; >+ >+import java.util.HashMap; >+ >+import org.eclipse.hyades.test.common.agent.ServiceInvoker; >+import org.eclipse.hyades.test.common.agent.UnconfiguredComptestAgentException; >+import org.eclipse.hyades.test.common.agent.UnknownTestServiceException; >+import org.eclipse.osgi.util.NLS; >+ >+/** >+* >+* It's the client of DatapoolPasswordsService ,used to get list of datapool and it's encryption >+* password from workbench side. >+* >+* @author Huang Xin Ying >+* >+*/ >+public class DatapoolPasswordProvider{ >+ >+ protected static final String DATAPOOL_PASSWORD_PROVIDER = "org.eclipse.hyades.test.core.DatapoolPasswordProvider"; >+ >+ /** >+ * @param testId >+ * @return >+ */ >+ public static HashMap getDatapoolPassword(String testId) throws UnknownTestServiceException{ >+ String result = null; >+ Object[] args = {testId}; >+ String buffer = NLS.bind("method=getDatapoolList,args:testId={0}", args); >+ try{ >+ >+ result = ServiceInvoker.invokeService(getProviderName(), buffer); >+ >+ }catch(UnconfiguredComptestAgentException e) { >+ throw new UnknownTestServiceException(e); >+ } >+ >+ return parseResult(result); >+ } >+ >+ /** >+ * @param result >+ * @return >+ */ >+ private static HashMap parseResult(String result){ >+ if(result == null) >+ return null; >+ >+ HashMap pr = new HashMap(); >+ if(result.contains(";")){ >+ String[] pairs = result.split(";"); >+ for(int i=0;i<pairs.length;i++){ >+ if(pairs[i].contains("=")){ >+ pr.put(pairs[i].split("=")[0], pairs[i].split("=")[1]); >+ } >+ } >+ } >+ >+ return pr; >+ } >+ >+ public static String getProviderName(){ >+ return DATAPOOL_PASSWORD_PROVIDER; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 202695
:
81975
|
87233
|
89835
|
90609
|
90847
|
91486
|
91605
|
92023
|
92024
|
92025
|
92132
|
92353
|
92399
|
92402
|
92550
|
92881
|
92885