JBoss Identity SVN: r1023 - migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-11-18 15:39:14 -0500 (Wed, 18 Nov 2009)
New Revision: 1023
Modified:
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
Log:
Minor change: updated methods comments
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 20:32:59 UTC (rev 1022)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 20:39:14 UTC (rev 1023)
@@ -111,7 +111,8 @@
/*
* (non-Javadoc)
*
- * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#cancelToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
+ * cancelToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void cancelToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -131,7 +132,8 @@
/*
* (non-Javadoc)
*
- * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#issueToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
+ * issueToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void issueToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -208,7 +210,8 @@
/*
* (non-Javadoc)
*
- * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#renewToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
+ * renewToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void renewToken(WSTrustRequestContext context) throws WSTrustException
{
@@ -273,7 +276,8 @@
/*
* (non-Javadoc)
*
- * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#validateToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
+ * @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#
+ * validateToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
public void validateToken(WSTrustRequestContext context) throws WSTrustException
{
16 years, 6 months
JBoss Identity SVN: r1022 - in migration/picketlink/federation/trunk/picketlink-fed-core/src: main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-11-18 15:32:59 -0500 (Wed, 18 Nov 2009)
New Revision: 1022
Modified:
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java
Log:
JBID-213: implemented cancel logic in the request handler and SAML20TokenProvider
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -47,6 +47,7 @@
import org.picketlink.identity.federation.ws.trust.ObjectFactory;
import org.picketlink.identity.federation.ws.trust.RequestedProofTokenType;
import org.picketlink.identity.federation.ws.trust.RequestedSecurityTokenType;
+import org.picketlink.identity.federation.ws.trust.RequestedTokenCancelledType;
import org.picketlink.identity.federation.ws.trust.StatusType;
import org.picketlink.identity.federation.ws.trust.UseKeyType;
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
@@ -290,9 +291,9 @@
// first validate the provided token signature to make sure it has been issued by this STS and hasn't been tempered.
if (trace)
log.trace("Validating token for renew request " + request.getContext());
- if (request.getRenewTarget() == null)
+ if (request.getRenewTargetElement() == null)
throw new WSTrustException("Unable to renew token: renew target is null");
-
+
Node securityToken = request.getRenewTargetElement().getFirstChild();
if (this.configuration.signIssuedToken() && this.configuration.getSTSKeyPair() != null)
{
@@ -305,7 +306,7 @@
if (!XMLSignatureUtil.validate(tokenDocument, keyPair.getPublic()))
throw new WSTrustException("Validation failure during renewal: digital signature is invalid");
}
- catch (Exception e)
+ catch (Exception e)
{
throw new WSTrustException("Validation failure during renewal: unable to verify digital signature", e);
}
@@ -316,7 +317,7 @@
log.trace("Security Token digital signature has NOT been verified. Either the STS has been configured"
+ "not to sign tokens or the STS key pair has not been properly specified.");
}
-
+
// set default values where needed.
if (request.getLifetime() == null && this.configuration.getIssuedTokenTimeout() != 0)
{
@@ -334,7 +335,7 @@
throw new WSTrustException("No SecurityTokenProvider configured for " + securityToken.getNamespaceURI() + ":"
+ securityToken.getLocalName());
provider.renewToken(context);
-
+
// create the WS-Trust response with the renewed token.
RequestedSecurityTokenType requestedSecurityToken = new RequestedSecurityTokenType();
requestedSecurityToken.setAny(context.getSecurityToken().getTokenValue());
@@ -366,7 +367,7 @@
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
- if (request.getValidateTarget() == null)
+ if (request.getValidateTargetElement() == null)
throw new WSTrustException("Unable to validate token: validate target is null");
if (request.getTokenType() == null)
@@ -449,12 +450,31 @@
public RequestSecurityTokenResponse cancel(RequestSecurityToken request, Principal callerPrincipal)
throws WSTrustException
{
+ // check if request contains all required elements.
Document rstDocument = request.getRSTDocument();
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
+ if (request.getCancelTargetElement() == null)
+ throw new WSTrustException("Illegal cancel request: cancel target is null");
- // TODO: implement cancel logic.
- throw new UnsupportedOperationException();
+ // obtain the token provider that will handle the request.
+ Node securityToken = request.getCancelTargetElement().getFirstChild();
+ SecurityTokenProvider provider = this.configuration.getProviderForTokenElementNS(securityToken.getLocalName(),
+ securityToken.getNamespaceURI());
+ if (provider == null)
+ throw new WSTrustException("No SecurityTokenProvider configured for " + securityToken.getNamespaceURI() + ":"
+ + securityToken.getLocalName());
+
+ // create a request context and dispatch to the provider.
+ WSTrustRequestContext context = new WSTrustRequestContext(request, callerPrincipal);
+ provider.cancelToken(context);
+
+ // if no exception has been raised, the token has been successfully canceled.
+ RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
+ if (request.getContext() != null)
+ response.setContext(request.getContext());
+ response.setRequestedTokenCancelled(new RequestedTokenCancelledType());
+ return response;
}
public Document postProcess(Document rstrDocument, RequestSecurityToken request) throws WSTrustException
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -21,13 +21,20 @@
*/
package org.picketlink.identity.federation.core.wstrust.plugins.saml;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
@@ -55,7 +62,6 @@
import org.picketlink.identity.federation.ws.policy.AppliesTo;
import org.picketlink.identity.federation.ws.trust.RequestedReferenceType;
import org.picketlink.identity.federation.ws.trust.StatusType;
-import org.picketlink.identity.federation.ws.trust.ValidateTargetType;
import org.picketlink.identity.federation.ws.wss.secext.KeyIdentifierType;
import org.w3c.dom.Element;
@@ -71,7 +77,14 @@
private static Logger logger = Logger.getLogger(SAML20TokenProvider.class);
- @SuppressWarnings("unused")
+ private static final String CANCELED_IDS_FILE = "CanceledIdsFile";
+
+ // this set contains the ids of the assertions that have been canceled.
+ private Set<String> cancelledIds;
+
+ // file used to store the ids of the canceled assertions.
+ private File canceledIdsFile;
+
private Map<String, String> properties;
/*
@@ -82,6 +95,17 @@
public void initialize(Map<String, String> properties)
{
this.properties = properties;
+ this.cancelledIds = new HashSet<String>();
+
+ // set up the canceled ids cache if the file that contains the canceled assertions has been specified.
+ String file = this.properties.get(CANCELED_IDS_FILE);
+ if (file == null && logger.isDebugEnabled())
+ logger.debug("File to store canceled ids has not been specified: ids will not be persisted!");
+ else
+ {
+ this.canceledIdsFile = new File(file);
+ this.loadCanceledIds();
+ }
}
/*
@@ -91,7 +115,17 @@
*/
public void cancelToken(WSTrustRequestContext context) throws WSTrustException
{
- // TODO: implement cancel logic.
+ // get the assertion that must be canceled.
+ Element token = (Element) context.getRequestSecurityToken().getCancelTargetElement();
+ if (token == null)
+ throw new WSTrustException("Invalid cancel request: missing required CancelTarget");
+ Element assertionElement = (Element) token.getFirstChild();
+ if (!this.isAssertion(assertionElement))
+ throw new WSTrustException("CancelTarget doesn't not contain a SAMLV2.0 assertion");
+
+ // get the assertion ID and add it to the canceled assertions set.
+ String assertionId = assertionElement.getAttribute("ID");
+ this.storeCanceledId(assertionId);
}
/*
@@ -103,7 +137,72 @@
{
// generate an id for the new assertion.
String assertionID = IDGenerator.create("ID_");
- issueToken(context, assertionID);
+
+ // lifetime and audience restrictions.
+ Lifetime lifetime = context.getRequestSecurityToken().getLifetime();
+ AudienceRestrictionType restriction = null;
+ AppliesTo appliesTo = context.getRequestSecurityToken().getAppliesTo();
+ if (appliesTo != null)
+ restriction = SAMLAssertionFactory.createAudienceRestriction(WSTrustUtil.parseAppliesTo(appliesTo));
+ ConditionsType conditions = SAMLAssertionFactory.createConditions(lifetime.getCreated(), lifetime.getExpires(),
+ restriction);
+
+ String confirmationMethod = null;
+ KeyInfoConfirmationDataType keyInfoDataType = null;
+ // if there is a proof-of-possession token in the context, we have the holder of key confirmation method.
+ if (context.getProofTokenInfo() != null)
+ {
+ confirmationMethod = SAMLUtil.SAML2_HOLDER_OF_KEY_URI;
+ keyInfoDataType = SAMLAssertionFactory.createKeyInfoConfirmation(context.getProofTokenInfo());
+ }
+ else
+ confirmationMethod = SAMLUtil.SAML2_BEARER_URI;
+ // TODO: implement the SENDER_VOUCHES scenario.
+
+ SubjectConfirmationType subjectConfirmation = SAMLAssertionFactory.createSubjectConfirmation(null,
+ confirmationMethod, keyInfoDataType);
+
+ // create a subject using the caller principal.
+ Principal principal = context.getCallerPrincipal();
+ String subjectName = principal == null ? "ANONYMOUS" : principal.getName();
+ NameIDType nameID = SAMLAssertionFactory.createNameID(null, "urn:jboss:identity-federation", subjectName);
+ SubjectType subject = SAMLAssertionFactory.createSubject(nameID, subjectConfirmation);
+
+ // create the attribute statements if necessary.
+ List<StatementAbstractType> statements = null;
+ Map<String, Object> claimedAttributes = context.getClaimedAttributes();
+ if (claimedAttributes != null)
+ {
+ statements = new ArrayList<StatementAbstractType>();
+ statements.add(StatementUtil.createAttributeStatement(claimedAttributes));
+ }
+
+ // create the SAML assertion.
+ NameIDType issuerID = SAMLAssertionFactory.createNameID(null, null, context.getTokenIssuer());
+ AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID, issuerID, lifetime.getCreated(),
+ conditions, subject, statements);
+
+ // convert the constructed assertion to element.
+ Element assertionElement = null;
+ try
+ {
+ assertionElement = SAMLUtil.toElement(assertion);
+ }
+ catch (Exception e)
+ {
+ throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
+ }
+
+ SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
+ assertionElement, assertionID);
+ context.setSecurityToken(token);
+
+ // set the SAML assertion attached reference.
+ KeyIdentifierType keyIdentifier = WSTrustUtil.createKeyIdentifier(SAMLUtil.SAML2_VALUE_TYPE, "#" + assertionID);
+ Map<QName, String> attributes = new HashMap<QName, String>();
+ attributes.put(new QName(WSTrustConstants.WSSE11_NS, "TokenType"), SAMLUtil.SAML2_TOKEN_TYPE);
+ RequestedReferenceType attachedReference = WSTrustUtil.createRequestedReference(keyIdentifier, attributes);
+ context.setAttachedReference(attachedReference);
}
/*
@@ -132,6 +231,10 @@
throw new WSTrustException("Error unmarshalling assertion", je);
}
+ // canceled assertions cannot be renewed.
+ if (this.cancelledIds.contains(oldAssertion.getID()))
+ throw new WSTrustException("Assertion with id " + oldAssertion.getID() + " is canceled and cannot be renewed");
+
// adjust the lifetime for the renewed assertion.
ConditionsType conditions = oldAssertion.getConditions();
conditions.setNotBefore(context.getRequestSecurityToken().getLifetime().getCreated());
@@ -155,8 +258,8 @@
{
throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
}
- SecurityToken securityToken = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
- assertionElement, assertionID);
+ SecurityToken securityToken = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType()
+ .toString(), assertionElement, assertionID);
context.setSecurityToken(securityToken);
// set the SAML assertion attached reference.
@@ -172,50 +275,45 @@
*
* @see org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider#validateToken(org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext)
*/
- @SuppressWarnings("unchecked")
public void validateToken(WSTrustRequestContext context) throws WSTrustException
{
if (logger.isTraceEnabled())
logger.trace("SAML V2.0 token validation started");
// get the SAML assertion that must be validated.
- ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
- if (validateTarget == null)
+ Element token = context.getRequestSecurityToken().getValidateTargetElement();
+ if (token == null)
throw new WSTrustException("Bad validate request: missing required ValidateTarget");
String code = WSTrustConstants.STATUS_CODE_VALID;
String reason = "SAMLV2.0 Assertion successfuly validated";
AssertionType assertion = null;
-
- Object assertionObj = validateTarget.getAny();
- if (assertionObj instanceof JAXBElement)
+ Element assertionElement = (Element) token.getFirstChild();
+ if (!this.isAssertion(assertionElement))
{
- JAXBElement<AssertionType> assertionType = (JAXBElement<AssertionType>) validateTarget.getAny();
- assertion = assertionType.getValue();
+ code = WSTrustConstants.STATUS_CODE_INVALID;
+ reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
}
- else if (assertionObj instanceof Element)
+ else
{
- Element assertionElement = (Element) assertionObj;
-
- if (!this.isAssertion(assertionElement))
+ try
{
- code = WSTrustConstants.STATUS_CODE_INVALID;
- reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
+ assertion = SAMLUtil.fromElement(assertionElement);
}
- else
+ catch (JAXBException e)
{
- try
- {
- assertion = SAMLUtil.fromElement((Element) assertionObj);
- }
- catch (JAXBException e)
- {
- throw new WSTrustException("Unmarshalling error:", e);
- }
+ throw new WSTrustException("Unmarshalling error:", e);
}
}
+ // check if the assertion has been canceled before.
+ if (this.cancelledIds.contains(assertion.getID()))
+ {
+ code = WSTrustConstants.STATUS_CODE_INVALID;
+ reason = "Validation failure: assertion with id " + assertion.getID() + " is canceled";
+ }
+
// check the assertion lifetime.
try
{
@@ -253,77 +351,64 @@
}
/**
- * Issue a SAML assertion token with the provided ID
- * @param context
- * @param assertionID
- * @throws WSTrustException
+ * <p>
+ * This method loads the ids of the canceled assertions from the file that has been configured for this provider.
+ * All retrieved ids are set in the local cache of canceled ids.
+ * </p>
*/
- private void issueToken(WSTrustRequestContext context, String assertionID) throws WSTrustException
+ private void loadCanceledIds()
{
- // lifetime and audience restrictions.
- Lifetime lifetime = context.getRequestSecurityToken().getLifetime();
- AudienceRestrictionType restriction = null;
- AppliesTo appliesTo = context.getRequestSecurityToken().getAppliesTo();
- if (appliesTo != null)
- restriction = SAMLAssertionFactory.createAudienceRestriction(WSTrustUtil.parseAppliesTo(appliesTo));
- ConditionsType conditions = SAMLAssertionFactory.createConditions(lifetime.getCreated(), lifetime.getExpires(),
- restriction);
-
- String confirmationMethod = null;
- KeyInfoConfirmationDataType keyInfoDataType = null;
- // if there is a proof-of-possession token in the context, we have the holder of key confirmation method.
- if (context.getProofTokenInfo() != null)
+ try
{
- confirmationMethod = SAMLUtil.SAML2_HOLDER_OF_KEY_URI;
- keyInfoDataType = SAMLAssertionFactory.createKeyInfoConfirmation(context.getProofTokenInfo());
+ if (!this.canceledIdsFile.exists())
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("File " + this.canceledIdsFile.getCanonicalPath() + " doesn't exist and will be created");
+ this.canceledIdsFile.createNewFile();
+ }
+ // read the file contents and populate the local cache.
+ BufferedReader reader = new BufferedReader(new FileReader(this.canceledIdsFile));
+ String id = reader.readLine();
+ while(id != null)
+ {
+ this.cancelledIds.add(id);
+ id = reader.readLine();
+ }
+ reader.close();
}
- else
- confirmationMethod = SAMLUtil.SAML2_BEARER_URI;
- // TODO: implement the SENDER_VOUCHES scenario.
-
- SubjectConfirmationType subjectConfirmation = SAMLAssertionFactory.createSubjectConfirmation(null,
- confirmationMethod, keyInfoDataType);
-
- // create a subject using the caller principal.
- Principal principal = context.getCallerPrincipal();
- String subjectName = principal == null ? "ANONYMOUS" : principal.getName();
- NameIDType nameID = SAMLAssertionFactory.createNameID(null, "urn:jboss:identity-federation", subjectName);
- SubjectType subject = SAMLAssertionFactory.createSubject(nameID, subjectConfirmation);
-
- // create the attribute statements if necessary.
- List<StatementAbstractType> statements = null;
- Map<String, Object> claimedAttributes = context.getClaimedAttributes();
- if (claimedAttributes != null)
+ catch (IOException ioe)
{
- statements = new ArrayList<StatementAbstractType>();
- statements.add(StatementUtil.createAttributeStatement(claimedAttributes));
+ if (logger.isDebugEnabled())
+ logger.debug("Error opening canceled ids file: " + ioe.getMessage());
+ ioe.printStackTrace();
}
-
- // create the SAML assertion.
- NameIDType issuerID = SAMLAssertionFactory.createNameID(null, null, context.getTokenIssuer());
- AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID, issuerID, lifetime.getCreated(),
- conditions, subject, statements);
-
- // convert the constructed assertion to element.
- Element assertionElement = null;
- try
+ }
+
+ /**
+ * <p>
+ * Stores the specified id in the cache of canceled ids. If a canceled ids file has been configured for this
+ * provider, the id will also be written to the end of the file.
+ * </p>
+ *
+ * @param id a {@code String} representing the canceled id that must be stored.
+ */
+ public synchronized void storeCanceledId(String id)
+ {
+ if (this.canceledIdsFile != null)
{
- assertionElement = SAMLUtil.toElement(assertion);
+ try
+ {
+ // write a new line with the canceled id at the end of the file.
+ BufferedWriter writer = new BufferedWriter(new FileWriter(this.canceledIdsFile, true));
+ writer.write(id + "\n");
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
- catch (Exception e)
- {
- throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
- }
-
- SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
- assertionElement, assertionID);
- context.setSecurityToken(token);
-
- // set the SAML assertion attached reference.
- KeyIdentifierType keyIdentifier = WSTrustUtil.createKeyIdentifier(SAMLUtil.SAML2_VALUE_TYPE, "#" + assertionID);
- Map<QName, String> attributes = new HashMap<QName, String>();
- attributes.put(new QName(WSTrustConstants.WSSE11_NS, "TokenType"), SAMLUtil.SAML2_TOKEN_TYPE);
- RequestedReferenceType attachedReference = WSTrustUtil.createRequestedReference(keyIdentifier, attributes);
- context.setAttachedReference(attachedReference);
+ // add the canceled id to the local cache.
+ this.cancelledIds.add(id);
}
}
\ No newline at end of file
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -136,7 +136,7 @@
private URI canonicalizationAlgorithm;
private URI keyWrapAlgorithm;
-
+
private ProofEncryptionType proofEncryption;
private UseKeyType useKey;
@@ -270,7 +270,7 @@
}
}
}
-
+
/**
* Creates an instance of {@code RequestSecurityTokenType} and {@code Document}
* @param delegate
@@ -279,7 +279,7 @@
public RequestSecurityToken(RequestSecurityTokenType delegate, Document rstDocument)
{
this(delegate);
- this.rstDocument = rstDocument;
+ this.rstDocument = rstDocument;
}
/**
@@ -730,7 +730,7 @@
{
return this.keyWrapAlgorithm;
}
-
+
/**
* <p>
* Sets the key wrap algorithm in the request.
@@ -742,7 +742,7 @@
{
this.keyWrapAlgorithm = keyWrapAlgorithm;
}
-
+
/**
* <p>
* Obtains the {@code ProofEncryption} section of the request. The {@code ProofEncryption} indicates that the
@@ -1079,7 +1079,7 @@
{
return this.validateTarget;
}
-
+
/**
* Return the element in the document that represents
* the validate type
@@ -1087,14 +1087,14 @@
*/
public Element getValidateTargetElement()
{
- if(rstDocument == null)
+ if (rstDocument == null)
throw new IllegalStateException("RST Document is null");
-
+
String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
String localPart = "ValidateTarget";
-
- NodeList nodeList = rstDocument.getElementsByTagNameNS(ns,localPart);
- if(nodeList != null && nodeList.getLength() > 0)
+
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localPart);
+ if (nodeList != null && nodeList.getLength() > 0)
return (Element) nodeList.item(0);
else
return null;
@@ -1110,21 +1110,43 @@
*/
public Element getRenewTargetElement()
{
- if(this.rstDocument == null)
+ if (this.rstDocument == null)
throw new IllegalStateException("RST Document is null");
String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
String localName = "RenewTarget";
- NodeList nodeList = rstDocument.getElementsByTagNameNS(ns,localName);
- if(nodeList != null && nodeList.getLength() > 0)
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localName);
+ if (nodeList != null && nodeList.getLength() > 0)
return (Element) nodeList.item(0);
else
return null;
}
-
+
/**
* <p>
- * Sets the {@code ValidateTarged} section of the request. This elements identifies the token that is to be
+ * Returns the element in the document that represents the cancel target type.
+ * </p>
+ *
+ * @return the {@code Element} that represents the renew target type, or {@code null} if no renew target is found in
+ * the document.
+ */
+ public Element getCancelTargetElement()
+ {
+ if (this.rstDocument == null)
+ throw new IllegalStateException("RST Document is null");
+ String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
+ String localName = "CancelTarget";
+
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localName);
+ if (nodeList != null && nodeList.getLength() > 0)
+ return (Element) nodeList.item(0);
+ else
+ return null;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code ValidateTarget} section of the request. This elements identifies the token that is to be
* validated.
* </p>
*
@@ -1173,7 +1195,7 @@
{
return this.delegate;
}
-
+
/**
* Get the {@code Document} document representing the request
* @return
@@ -1182,7 +1204,7 @@
{
return this.rstDocument;
}
-
+
public void setRSTDocument(Document rstDocument)
{
this.rstDocument = rstDocument;
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -49,6 +49,7 @@
import org.picketlink.identity.federation.ws.trust.RequestedProofTokenType;
import org.picketlink.identity.federation.ws.trust.RequestedReferenceType;
import org.picketlink.identity.federation.ws.trust.RequestedSecurityTokenType;
+import org.picketlink.identity.federation.ws.trust.RequestedTokenCancelledType;
import org.picketlink.identity.federation.ws.trust.StatusType;
import org.picketlink.identity.federation.ws.trust.UseKeyType;
@@ -125,6 +126,8 @@
private RequestedProofTokenType requestedProofToken;
+ private RequestedTokenCancelledType requestedTokenCancelled;
+
private EntropyType entropy;
private Lifetime lifetime;
@@ -231,6 +234,8 @@
this.requestedUnattachedReference = (RequestedReferenceType) element.getValue();
else if (localName.equalsIgnoreCase("RequestedProofToken"))
this.requestedProofToken = (RequestedProofTokenType) element.getValue();
+ else if (localName.equalsIgnoreCase("RequestedTokenCancelled"))
+ this.requestedTokenCancelled = (RequestedTokenCancelledType) element.getValue();
else if (localName.equalsIgnoreCase("Entropy"))
this.entropy = (EntropyType) element.getValue();
else if (localName.equalsIgnoreCase("Lifetime"))
@@ -472,6 +477,35 @@
/**
* <p>
+ * Obtains the {@code RequestedTokenCancelled} section of the response, if it has been set. The presence of this
+ * element indicates that the security token specified in the cancel request has been successfully canceled by
+ * the STS.
+ * </p>
+ *
+ * @return a reference to the {@code RequestedTokenCancelledType}, or {@code null} if the response doesn't have
+ * a {@code RequestedTokenCancelled} section.
+ */
+ public RequestedTokenCancelledType getRequestedTokenCancelled()
+ {
+ return this.requestedTokenCancelled;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code RequestedTokenCancelled} section of the response. This element is used to inform the client that
+ * the token specified in a cancel request has been successfully canceled by the STS.
+ * </p>
+ *
+ * @param requestedTokenCancelled a reference to the {@code RequestedTokenCancelledType}.
+ */
+ public void setRequestedTokenCancelled(RequestedTokenCancelledType requestedTokenCancelled)
+ {
+ this.requestedTokenCancelled = requestedTokenCancelled;
+ this.delegate.getAny().add(this.factory.createRequestedTokenCancelled(requestedTokenCancelled));
+ }
+
+ /**
+ * <p>
* Obtains the entropy that has been used in creating the key.
* </p>
*
@@ -1145,7 +1179,7 @@
{
return this.delegate.getAny();
}
-
+
/**
* <p>
* Obtains a reference to the {@code RequestSecurityTokenResponseType} delegate.
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/PicketLinkSTSUnitTestCase.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -37,7 +37,7 @@
import junit.framework.TestCase;
-import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
+import org.picketlink.identity.federation.core.exceptions.ConfigurationException;
import org.picketlink.identity.federation.core.wstrust.PicketLinkSTS;
import org.picketlink.identity.federation.core.wstrust.STSConfiguration;
import org.picketlink.identity.federation.core.wstrust.SecurityTokenProvider;
@@ -66,6 +66,7 @@
import org.picketlink.identity.federation.ws.addressing.ObjectFactory;
import org.picketlink.identity.federation.ws.policy.AppliesTo;
import org.picketlink.identity.federation.ws.trust.BinarySecretType;
+import org.picketlink.identity.federation.ws.trust.CancelTargetType;
import org.picketlink.identity.federation.ws.trust.EntropyType;
import org.picketlink.identity.federation.ws.trust.RenewTargetType;
import org.picketlink.identity.federation.ws.trust.RequestedProofTokenType;
@@ -111,12 +112,12 @@
/**
* <p>
* This test verifies that the STS service can read and load all configuration parameters correctly. The
- * configuration file (jboss-sts.xml) looks like the following:
+ * configuration file (picketlink-sts.xml) looks like the following:
*
* <pre>
* <JBossSTS xmlns="urn:jboss:identity-federation:config:1.0"
* STSName="Test STS" TokenTimeout="7200" EncryptToken="true">
- * <KeyProvider ClassName="org.picketlink.identity.federation.bindings.tomcat.KeyStoreKeyManager">
+ * <KeyProvider ClassName="org.jboss.identity.federation.bindings.tomcat.KeyStoreKeyManager">
* <Auth Key="KeyStoreURL" Value="keystore/sts_keystore.jks"/>
* <Auth Key="KeyStorePass" Value="testpass"/>
* <Auth Key="SigningKeyAlias" Value="sts"/>
@@ -124,11 +125,11 @@
* <ValidatingAlias Key="http://services.testcorp.org/provider1" Value="service1"/>
* <ValidatingAlias Key="http://services.testcorp.org/provider2" Value="service2"/>
* </KeyProvider>
- * <RequestHandler>org.picketlink.identity.federation.core.wstrust.StandardRequestHandler</RequestHandler>
+ * <RequestHandler>org.jboss.identity.federation.core.wstrust.StandardRequestHandler</RequestHandler>
* <TokenProviders>
- * <TokenProvider ProviderClass="org.picketlink.test.identity.federation.bindings.trust.SpecialTokenProvider"
+ * <TokenProvider ProviderClass="org.jboss.test.identity.federation.bindings.trust.SpecialTokenProvider"
* TokenType="http://www.tokens.org/SpecialToken"/>
- * <TokenProvider ProviderClass="org.picketlink.identity.federation.core.wstrust.SAML20TokenProvider"
+ * <TokenProvider ProviderClass="org.jboss.identity.federation.core.wstrust.SAML20TokenProvider"
* TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profi...
* </TokenProviders>
* <ServiceProviders>
@@ -209,7 +210,7 @@
/**
* <p>
- * This tests sends a security token request to JBossSTS custom {@code SpecialTokenProvider}. The returned response
+ * This tests sends a security token request to PicketLinkSTS custom {@code SpecialTokenProvider}. The returned response
* is verified to make sure the expected tokens have been returned by the service. The token that is generated in
* this test looks as follows:
*
@@ -245,7 +246,7 @@
/**
* <p>
- * This tests sends a SAMLV2.0 security token request to JBossSTS. This request should be handled by the standard
+ * This tests sends a SAMLV2.0 security token request to PicketLinkSTS. This request should be handled by the standard
* {@code SAML20TokenProvider} and should result in a SAMLV2.0 assertion that looks like the following:
*
* <pre>
@@ -606,6 +607,94 @@
/**
* <p>
+ * This test case first generates a SAMLV2.0 assertion and then sends a WS-Trust cancel message to the STS to cancel
+ * the assertion. A canceled assertion cannot be renewed or considered valid anymore.
+ * </p>
+ *
+ * @throws Exception
+ * if an error occurs while running the test.
+ */
+ public void testInvokeSAML20Cancel() throws Exception
+ {
+ // create a simple token request.
+ RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST,
+ SAMLUtil.SAML2_TOKEN_TYPE, null);
+
+ // use the factory to marshall the request.
+ WSTrustJAXBFactory factory = WSTrustJAXBFactory.getInstance();
+ Source requestMessage = factory.marshallRequestSecurityToken(request);
+
+ // invoke the token service.
+ Source responseMessage = this.tokenService.invoke(requestMessage);
+ BaseRequestSecurityTokenResponse baseResponse = factory.parseRequestSecurityTokenResponse(responseMessage);
+
+ // validate the response and get the SAML assertion from the request.
+ this.validateSAMLAssertionResponse(baseResponse, "testcontext", SAMLUtil.SAML2_BEARER_URI);
+ RequestSecurityTokenResponseCollection collection = (RequestSecurityTokenResponseCollection) baseResponse;
+ Element assertion = (Element) collection.getRequestSecurityTokenResponses().get(0).getRequestedSecurityToken()
+ .getAny();
+
+ // now construct a WS-Trust cancel request with the generated assertion.
+ request = this.createRequest("cancelcontext", WSTrustConstants.CANCEL_REQUEST, null, null);
+ CancelTargetType cancelTarget = new CancelTargetType();
+ cancelTarget.setAny(assertion);
+ request.setCancelTarget(cancelTarget);
+
+ // invoke the token service.
+ responseMessage = this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ baseResponse = factory.parseRequestSecurityTokenResponse(responseMessage);
+
+ // validate the response contents.
+ assertNotNull("Unexpected null response", baseResponse);
+ assertTrue("Unexpected response type", baseResponse instanceof RequestSecurityTokenResponseCollection);
+ collection = (RequestSecurityTokenResponseCollection) baseResponse;
+ assertEquals("Unexpected number of responses", 1, collection.getRequestSecurityTokenResponses().size());
+ RequestSecurityTokenResponse response = collection.getRequestSecurityTokenResponses().get(0);
+ assertEquals("Unexpected response context", "cancelcontext", response.getContext());
+ assertNotNull("Cancel response should contain a RequestedTokenCancelled element", response
+ .getRequestedTokenCancelled());
+
+ // try to validate the canceled assertion.
+ request = this.createRequest("validatecontext", WSTrustConstants.VALIDATE_REQUEST, null, null);
+ ValidateTargetType validateTarget = new ValidateTargetType();
+ validateTarget.setAny(assertion);
+ request.setValidateTarget(validateTarget);
+
+ // the response should contain a status indicating that the token is not valid.
+ responseMessage = this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ collection = (RequestSecurityTokenResponseCollection) factory.parseRequestSecurityTokenResponse(responseMessage);
+ assertEquals("Unexpected number of responses", 1, collection.getRequestSecurityTokenResponses().size());
+ response = collection.getRequestSecurityTokenResponses().get(0);
+ assertEquals("Unexpected response context", "validatecontext", response.getContext());
+ assertEquals("Unexpected token type", WSTrustConstants.STATUS_TYPE, response.getTokenType().toString());
+ StatusType status = response.getStatus();
+ assertNotNull("Unexpected null status", status);
+ assertEquals("Unexpected status code", WSTrustConstants.STATUS_CODE_INVALID, status.getCode());
+ assertEquals("Unexpected status reason", "Validation failure: assertion with id " + assertion.getAttribute("ID")
+ + " is canceled", status.getReason());
+
+ // now try to renew the canceled assertion.
+ request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, null, null);
+ RenewTargetType renewTarget = new RenewTargetType();
+ renewTarget.setAny(assertion);
+ request.setRenewTarget(renewTarget);
+
+ // we should receive an exception when renewing the token.
+ try
+ {
+ this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ fail("Renewing a canceled token should result in an exception being thrown");
+ }
+ catch (WebServiceException we)
+ {
+ assertTrue("Unexpected cause type", we.getCause() instanceof WSTrustException);
+ assertEquals("Unexpected exception message", "Assertion with id " + assertion.getAttribute("ID")
+ + " is canceled and cannot be renewed", we.getCause().getMessage());
+ }
+ }
+
+ /**
+ * <p>
* This test tries to request a token of an unknown type, checking if an exception is correctly thrown by the
* security token service.
* </p>
@@ -834,7 +923,7 @@
/**
* <p>
- * Helper class that exposes the JBossSTS methods as public for the tests to work.
+ * Helper class that exposes the PicketLinkSTS methods as public for the tests to work.
* </p>
*
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
@@ -856,7 +945,7 @@
/**
* <p>
- * Helper class that mocks a {@code WebServiceContext}. It is used in the JBoss STS test cases.
+ * Helper class that mocks a {@code WebServiceContext}. It is used in the PicketLink STS test cases.
* </p>
*
* @author <a href="mailto:sguilhen@redhat.com">Stefan Guilhen</a>
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -28,17 +28,20 @@
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.GregorianCalendar;
+import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
import junit.framework.TestCase;
import org.picketlink.identity.federation.core.wstrust.StandardSecurityToken;
import org.picketlink.identity.federation.core.wstrust.WSTrustConstants;
+import org.picketlink.identity.federation.core.wstrust.WSTrustJAXBFactory;
import org.picketlink.identity.federation.core.wstrust.WSTrustRequestContext;
import org.picketlink.identity.federation.core.wstrust.WSTrustUtil;
import org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider;
@@ -59,6 +62,7 @@
import org.picketlink.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.picketlink.identity.xmlsec.w3.xmldsig.X509DataType;
import org.picketlink.identity.xmlsec.w3.xmlenc.EncryptedKeyType;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
@@ -71,6 +75,16 @@
public class SAML20TokenProviderUnitTestCase extends TestCase
{
+ private SAML20TokenProvider provider;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ this.provider = new SAML20TokenProvider();
+ provider.initialize(new HashMap<String, String>());
+ }
+
/**
* <p>
* Tests the issuance of a SAMLV2.0 Assertion.
@@ -87,10 +101,10 @@
request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
- context.setTokenIssuer("JBossSTS");
+ context.setTokenIssuer("PicketLinkSTS");
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
JAXBContext jaxbContext = JAXBContext.newInstance("org.picketlink.identity.federation.saml.v2.assertion");
@@ -103,7 +117,7 @@
AssertionType assertion = (AssertionType) parsedElement.getValue();
StandardSecurityToken securityToken = (StandardSecurityToken) context.getSecurityToken();
assertEquals("Unexpected token id", securityToken.getTokenID(), assertion.getID());
- assertEquals("Unexpected token issuer", "JBossSTS", assertion.getIssuer().getValue());
+ assertEquals("Unexpected token issuer", "PicketLinkSTS", assertion.getIssuer().getValue());
// check the contents of the assertion conditions.
ConditionsType conditions = assertion.getConditions();
@@ -167,17 +181,17 @@
request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
- context.setTokenIssuer("JBossSTS");
-
+ context.setTokenIssuer("PicketLinkSTS");
+
// let's set a symmetric key proof-of-possession token in the context.
byte[] secret = WSTrustUtil.createRandomSecret(32);
PublicKey serviceKey = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service2").getPublicKey();
context.setProofTokenInfo(WSTrustUtil.createKeyInfo(secret, serviceKey, null));
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
-
+
// check if the assertion has a subject confirmation that contains the encrypted symmetric key.
AssertionType assertion = SAMLUtil.fromElement((Element) context.getSecurityToken().getTokenValue());
SubjectType subject = assertion.getSubject();
@@ -200,13 +214,13 @@
assertEquals("Unexpected key info content size", 1, keyInfo.getContent().size());
JAXBElement<?> encKeyElement = (JAXBElement<?>) keyInfo.getContent().get(0);
assertEquals("Unexpected key info content type", EncryptedKeyType.class, encKeyElement.getDeclaredType());
-
+
// Now let's set an asymmetric proof of possession token in the context.
Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
context.setProofTokenInfo(WSTrustUtil.createKeyInfo(certificate));
-
+
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
// check if the assertion has a subject confirmation that contains the encoded certificate.
@@ -232,14 +246,14 @@
JAXBElement<?> x509DataElement = (JAXBElement<?>) keyInfo.getContent().get(0);
assertEquals("Unexpected key info content type", X509DataType.class, x509DataElement.getDeclaredType());
X509DataType x509Data = (X509DataType) x509DataElement.getValue();
- assertEquals("Unexpected X509 data content size", 1, x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().
- size());
+ assertEquals("Unexpected X509 data content size", 1, x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName()
+ .size());
JAXBElement<?> x509CertElement = (JAXBElement<?>) x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().get(0);
assertEquals("Unexpected X509 data content type", byte[].class, x509CertElement.getDeclaredType());
byte[] encodedCert = (byte[]) x509CertElement.getValue();
assertTrue("Invalid encoded certificate found", Arrays.equals(certificate.getEncoded(), encodedCert));
}
-
+
/**
* <p>
* Tests the validation of a SAMLV2.0 Assertion.
@@ -252,17 +266,16 @@
// issue a SAMLV2.0 assertion.
WSTrustRequestContext context = this.createIssuingContext(WSTrustUtil.createDefaultLifetime(3600000));
- SAML20TokenProvider provider = new SAML20TokenProvider();
- provider.issueToken(context);
+ this.provider.issueToken(context);
// get the issued SAMLV2.0 assertion.
Element assertion = (Element) context.getSecurityToken().getTokenValue();
// now create a WS-Trust validate context.
context = this.createValidatingContext(assertion);
-
+
// validate the SAMLV2.0 assertion.
- provider.validateToken(context);
+ this.provider.validateToken(context);
StatusType status = context.getStatus();
assertNotNull("Unexpected null status type", status);
assertEquals("Unexpected status code", WSTrustConstants.STATUS_CODE_VALID, status.getCode());
@@ -275,10 +288,10 @@
GregorianCalendar expires = new GregorianCalendar();
expires.setTimeInMillis(currentTimeMillis - 1800000);
context = this.createIssuingContext(new Lifetime(created, expires));
-
+
provider.issueToken(context);
assertion = (Element) context.getSecurityToken().getTokenValue();
-
+
// try to validate the expired token.
context = this.createValidatingContext(assertion);
provider.validateToken(context);
@@ -309,8 +322,8 @@
request.setTokenType(URI.create(SAMLUtil.SAML2_TOKEN_TYPE));
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
- context.setTokenIssuer("JBossSTS");
-
+ context.setTokenIssuer("PicketLinkSTS");
+
return context;
}
@@ -331,12 +344,14 @@
ValidateTargetType validateTarget = new ValidateTargetType();
validateTarget.setAny(assertion);
request.setValidateTarget(validateTarget);
+ // we need to set the request document in the request object for the test.
+ DOMSource requestSource = (DOMSource) WSTrustJAXBFactory.getInstance().marshallRequestSecurityToken(request);
+ request.setRSTDocument((Document) requestSource.getNode());
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
-
return context;
}
-
+
/**
* <p>
* Obtains the {@code Certificate} stored under the specified alias in the specified keystore.
@@ -353,7 +368,7 @@
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(keyStoreFile);
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(stream, passwd.toCharArray());
-
+
Certificate certificate = keyStore.getCertificate(certificateAlias);
return certificate;
}
Modified: migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java 2009-11-18 19:40:30 UTC (rev 1021)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/test/java/org/picketlink/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java 2009-11-18 20:32:59 UTC (rev 1022)
@@ -23,6 +23,8 @@
import java.security.PrivilegedActionException;
+import java.util.HashMap;
+
import junit.framework.TestCase;
import org.picketlink.identity.federation.core.wstrust.PicketLinkSTSConfiguration;
@@ -83,12 +85,13 @@
public void testCreateTokenProvider() throws Exception
{
WSTrustServiceFactory factory = WSTrustServiceFactory.getInstance();
- SecurityTokenProvider provider = factory
- .createTokenProvider("org.picketlink.test.identity.federation.core.wstrust.SpecialTokenProvider", null);
+ SecurityTokenProvider provider = factory.createTokenProvider(
+ "org.picketlink.test.identity.federation.core.wstrust.SpecialTokenProvider", null);
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
- provider = factory
- .createTokenProvider("org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider", null);
+ provider = factory.createTokenProvider(
+ "org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider",
+ new HashMap<String, String>());
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof SAML20TokenProvider);
16 years, 6 months
JBoss Identity SVN: r1021 - in migration/picketlink/federation/trunk: picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF and 11 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-18 14:40:30 -0500 (Wed, 18 Nov 2009)
New Revision: 1021
Added:
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml
Removed:
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
Log:
migrate
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,9 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager=""
- RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-
-</JBossIDP>
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,9 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager=""
+ RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/employee/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/sales/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/sales/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,8 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-
-</JBossIDP>
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,8 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/employee/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,9 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager=""
- RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-
-</JBossIDP>
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/idp/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,9 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager=""
+ RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/employee/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/employee/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/sales/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings/src/test/resources/saml2/redirect/sp/sales/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/sales/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,9 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager=""
- RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-
-</JBossIDP>
Copied: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/idp/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,9 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager=""
+ RoleGenerator="org.picketlink.identity.federation.core.impl.EmptyRoleGenerator">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Deleted: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/employee/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/employee/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/sales/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/logout/sp/sales/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/sales/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,8 +0,0 @@
-<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<Trust>
- <Domains>localhost,jboss.com,jboss.org</Domains>
-</Trust>
-
-</JBossIDP>
Copied: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/idp/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,8 @@
+<JBossIDP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<Trust>
+ <Domains>localhost,jboss.com,jboss.org</Domains>
+</Trust>
+
+</JBossIDP>
Deleted: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:33:38 UTC (rev 1020)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -1,6 +0,0 @@
-<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
- AttributeManager="">
-<IdentityURL>http://localhost:8080/idp/</IdentityURL>
-<ServiceURL>http://localhost:8080/employee/</ServiceURL>
-
-</JBossSP>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/jboss-idfed.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-web/src/test/resources/saml2/post/sp/employee/WEB-INF/picketlink-idfed.xml 2009-11-18 19:40:30 UTC (rev 1021)
@@ -0,0 +1,6 @@
+<JBossSP xmlns="urn:jboss:identity-federation:config:1.0"
+ AttributeManager="">
+<IdentityURL>http://localhost:8080/idp/</IdentityURL>
+<ServiceURL>http://localhost:8080/employee/</ServiceURL>
+
+</JBossSP>
\ No newline at end of file
16 years, 6 months
JBoss Identity SVN: r1020 - migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-18 14:33:38 -0500 (Wed, 18 Nov 2009)
New Revision: 1020
Added:
migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/picketlink-sts.xml
Removed:
migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/jboss-sts.xml
Log:
migrate
Deleted: migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/jboss-sts.xml
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/jboss-sts.xml 2009-11-18 19:28:18 UTC (rev 1019)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/jboss-sts.xml 2009-11-18 19:33:38 UTC (rev 1020)
@@ -1,31 +0,0 @@
-<JBossSTS xmlns="urn:jboss:identity-federation:config:1.0"
- STSName="Test STS" TokenTimeout="7200" EncryptToken="false">
- <KeyProvider ClassName="org.picketlink.identity.federation.core.impl.KeyStoreKeyManager">
- <Auth Key="KeyStoreURL" Value="keystore/sts_keystore.jks"/>
- <Auth Key="KeyStorePass" Value="testpass"/>
- <Auth Key="SigningKeyAlias" Value="sts"/>
- <Auth Key="SigningKeyPass" Value="keypass"/>
- <ValidatingAlias Key="http://services.testcorp.org/provider1" Value="service1"/>
- <ValidatingAlias Key="http://services.testcorp.org/provider2" Value="service2"/>
- </KeyProvider>
- <RequestHandler>org.picketlink.identity.federation.core.wstrust.StandardRequestHandler</RequestHandler>
- <TokenProviders>
- <TokenProvider ProviderClass="org.picketlink.test.identity.federation.core.wstrust.SpecialTokenProvider"
- TokenType="http://www.tokens.org/SpecialToken"
- TokenElement="SpecialToken"
- TokenElementNS="http://www.tokens.org">
- <Property Key="Property1" Value="Value1"/>
- <Property Key="Property2" Value="Value2"/>
- </TokenProvider>
- <TokenProvider ProviderClass="org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider"
- TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
- TokenElement="Assertion"
- TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion"/>
- </TokenProviders>
- <ServiceProviders>
- <ServiceProvider Endpoint="http://services.testcorp.org/provider1" TokenType="http://www.tokens.org/SpecialToken"
- TruststoreAlias="service1"/>
- <ServiceProvider Endpoint="http://services.testcorp.org/provider2" TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
- TruststoreAlias="service2"/>
- </ServiceProviders>
-</JBossSTS>
\ No newline at end of file
Copied: migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/picketlink-sts.xml (from rev 1019, migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/jboss-sts.xml)
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/picketlink-sts.xml (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/test/resources/picketlink-sts.xml 2009-11-18 19:33:38 UTC (rev 1020)
@@ -0,0 +1,31 @@
+<JBossSTS xmlns="urn:jboss:identity-federation:config:1.0"
+ STSName="Test STS" TokenTimeout="7200" EncryptToken="false">
+ <KeyProvider ClassName="org.picketlink.identity.federation.core.impl.KeyStoreKeyManager">
+ <Auth Key="KeyStoreURL" Value="keystore/sts_keystore.jks"/>
+ <Auth Key="KeyStorePass" Value="testpass"/>
+ <Auth Key="SigningKeyAlias" Value="sts"/>
+ <Auth Key="SigningKeyPass" Value="keypass"/>
+ <ValidatingAlias Key="http://services.testcorp.org/provider1" Value="service1"/>
+ <ValidatingAlias Key="http://services.testcorp.org/provider2" Value="service2"/>
+ </KeyProvider>
+ <RequestHandler>org.picketlink.identity.federation.core.wstrust.StandardRequestHandler</RequestHandler>
+ <TokenProviders>
+ <TokenProvider ProviderClass="org.picketlink.test.identity.federation.core.wstrust.SpecialTokenProvider"
+ TokenType="http://www.tokens.org/SpecialToken"
+ TokenElement="SpecialToken"
+ TokenElementNS="http://www.tokens.org">
+ <Property Key="Property1" Value="Value1"/>
+ <Property Key="Property2" Value="Value2"/>
+ </TokenProvider>
+ <TokenProvider ProviderClass="org.picketlink.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider"
+ TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
+ TokenElement="Assertion"
+ TokenElementNS="urn:oasis:names:tc:SAML:2.0:assertion"/>
+ </TokenProviders>
+ <ServiceProviders>
+ <ServiceProvider Endpoint="http://services.testcorp.org/provider1" TokenType="http://www.tokens.org/SpecialToken"
+ TruststoreAlias="service1"/>
+ <ServiceProvider Endpoint="http://services.testcorp.org/provider2" TokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0"
+ TruststoreAlias="service2"/>
+ </ServiceProviders>
+</JBossSTS>
\ No newline at end of file
16 years, 6 months
JBoss Identity SVN: r1019 - in migration/picketlink/federation/trunk: picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-18 14:28:18 -0500 (Wed, 18 Nov 2009)
New Revision: 1019
Added:
migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkGroup.java
migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkPrincipal.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/PicketLinkFederationConstants.java
Removed:
migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/JBossIdentityFederationConstants.java
Log:
migrate
Deleted: migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java 2009-11-18 19:24:06 UTC (rev 1018)
+++ migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityGroup.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.identity.federation.bindings.jboss.subject;
-
-import java.security.Principal;
-import java.security.acl.Group;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * A Principal Group used to register roles in JBoss
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public class JBossIdentityGroup extends JBossIdentityPrincipal implements Group
-{
- private static final long serialVersionUID = 1L;
-
- private Set<Principal> roles = new HashSet<Principal>();
-
- public JBossIdentityGroup(String name)
- {
- super(name);
- }
-
- public boolean addMember(Principal user)
- {
- return roles.add(user);
- }
-
- public boolean isMember(Principal member)
- {
- return roles.contains(member);
- }
-
- public Enumeration<? extends Principal> members()
- {
- Set<Principal> readOnly = Collections.unmodifiableSet(roles);
- return Collections.enumeration(readOnly);
- }
-
- public boolean removeMember(Principal user)
- {
- return roles.remove(user);
- }
-}
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-18 19:24:06 UTC (rev 1018)
+++ migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/JBossIdentityPrincipal.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.identity.federation.bindings.jboss.subject;
-
-import java.io.Serializable;
-import java.security.Principal;
-
-/**
- * Simple Principal
- * @author Anil.Saldhana(a)redhat.com
- * @since Jan 16, 2009
- */
-public class JBossIdentityPrincipal implements Principal,Serializable
-{
- private static final long serialVersionUID = 1L;
-
- protected String name;
-
- public JBossIdentityPrincipal(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- JBossIdentityPrincipal other = (JBossIdentityPrincipal) obj;
- if (name == null)
- {
- if (other.name != null)
- return false;
- }
- else if (!name.equals(other.name))
- return false;
- return true;
- }
-}
\ No newline at end of file
Added: migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkGroup.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkGroup.java (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkGroup.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.bindings.jboss.subject;
+
+import java.security.Principal;
+import java.security.acl.Group;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A Principal Group used to register roles in JBoss
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 16, 2009
+ */
+public class PicketLinkGroup extends PicketLinkPrincipal implements Group
+{
+ private static final long serialVersionUID = 1L;
+
+ private Set<Principal> roles = new HashSet<Principal>();
+
+ public PicketLinkGroup(String name)
+ {
+ super(name);
+ }
+
+ public boolean addMember(Principal user)
+ {
+ return roles.add(user);
+ }
+
+ public boolean isMember(Principal member)
+ {
+ return roles.contains(member);
+ }
+
+ public Enumeration<? extends Principal> members()
+ {
+ Set<Principal> readOnly = Collections.unmodifiableSet(roles);
+ return Collections.enumeration(readOnly);
+ }
+
+ public boolean removeMember(Principal user)
+ {
+ return roles.remove(user);
+ }
+}
\ No newline at end of file
Added: migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkPrincipal.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkPrincipal.java (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-bindings-jboss/src/main/java/org/picketlink/identity/federation/bindings/jboss/subject/PicketLinkPrincipal.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.bindings.jboss.subject;
+
+import java.io.Serializable;
+import java.security.Principal;
+
+/**
+ * Simple Principal
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jan 16, 2009
+ */
+public class PicketLinkPrincipal implements Principal,Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ protected String name;
+
+ public PicketLinkPrincipal(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ PicketLinkPrincipal other = (PicketLinkPrincipal) obj;
+ if (name == null)
+ {
+ if (other.name != null)
+ return false;
+ }
+ else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+}
\ No newline at end of file
Deleted: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/JBossIdentityFederationConstants.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/JBossIdentityFederationConstants.java 2009-11-18 19:24:06 UTC (rev 1018)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/JBossIdentityFederationConstants.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.identity.federation.core.constants;
-
-/**
- * Constants useful to the JBoss
- * Identity Federation project
- * @author Anil.Saldhana(a)redhat.com
- * @since Feb 23, 2009
- */
-public interface JBossIdentityFederationConstants
-{
- /**
- * Flag to indicate whether JAXB Schema Validation is turned on
- */
- String JAXB_SCHEMA_VALIDATION = "org.jboss.identity.jaxb.schema.validation";
-}
\ No newline at end of file
Added: migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/PicketLinkFederationConstants.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/PicketLinkFederationConstants.java (rev 0)
+++ migration/picketlink/federation/trunk/picketlink-fed-core/src/main/java/org/picketlink/identity/federation/core/constants/PicketLinkFederationConstants.java 2009-11-18 19:28:18 UTC (rev 1019)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.picketlink.identity.federation.core.constants;
+
+/**
+ * Constants useful to the JBoss
+ * Identity Federation project
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Feb 23, 2009
+ */
+public interface PicketLinkFederationConstants
+{
+ /**
+ * Flag to indicate whether JAXB Schema Validation is turned on
+ */
+ String JAXB_SCHEMA_VALIDATION = "org.picketlink.jaxb.schema.validation";
+
+ String SCHEMA_IDFED = "schema/config/picketlink-fed.xsd";
+ String SCHEMA_IDFED_HANDLER = "schema/config/picketlink-fed-handler.xsd";
+}
\ No newline at end of file
16 years, 6 months
JBoss Identity SVN: r1018 - in identity-federation/trunk/jboss-identity-fed-core/src: main/java/org/jboss/identity/federation/core/wstrust/plugins/saml and 2 other directories.
by jboss-identity-commits@lists.jboss.org
Author: sguilhen(a)redhat.com
Date: 2009-11-18 14:24:06 -0500 (Wed, 18 Nov 2009)
New Revision: 1018
Modified:
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java
Log:
JBID-213: implemented cancel logic in the request handler and SAML20TokenProvider
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/StandardRequestHandler.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -47,6 +47,7 @@
import org.jboss.identity.federation.ws.trust.ObjectFactory;
import org.jboss.identity.federation.ws.trust.RequestedProofTokenType;
import org.jboss.identity.federation.ws.trust.RequestedSecurityTokenType;
+import org.jboss.identity.federation.ws.trust.RequestedTokenCancelledType;
import org.jboss.identity.federation.ws.trust.StatusType;
import org.jboss.identity.federation.ws.trust.UseKeyType;
import org.jboss.identity.xmlsec.w3.xmldsig.KeyInfoType;
@@ -290,9 +291,9 @@
// first validate the provided token signature to make sure it has been issued by this STS and hasn't been tempered.
if (trace)
log.trace("Validating token for renew request " + request.getContext());
- if (request.getRenewTarget() == null)
+ if (request.getRenewTargetElement() == null)
throw new WSTrustException("Unable to renew token: renew target is null");
-
+
Node securityToken = request.getRenewTargetElement().getFirstChild();
if (this.configuration.signIssuedToken() && this.configuration.getSTSKeyPair() != null)
{
@@ -305,7 +306,7 @@
if (!XMLSignatureUtil.validate(tokenDocument, keyPair.getPublic()))
throw new WSTrustException("Validation failure during renewal: digital signature is invalid");
}
- catch (Exception e)
+ catch (Exception e)
{
throw new WSTrustException("Validation failure during renewal: unable to verify digital signature", e);
}
@@ -316,7 +317,7 @@
log.trace("Security Token digital signature has NOT been verified. Either the STS has been configured"
+ "not to sign tokens or the STS key pair has not been properly specified.");
}
-
+
// set default values where needed.
if (request.getLifetime() == null && this.configuration.getIssuedTokenTimeout() != 0)
{
@@ -334,7 +335,7 @@
throw new WSTrustException("No SecurityTokenProvider configured for " + securityToken.getNamespaceURI() + ":"
+ securityToken.getLocalName());
provider.renewToken(context);
-
+
// create the WS-Trust response with the renewed token.
RequestedSecurityTokenType requestedSecurityToken = new RequestedSecurityTokenType();
requestedSecurityToken.setAny(context.getSecurityToken().getTokenValue());
@@ -366,7 +367,7 @@
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
- if (request.getValidateTarget() == null)
+ if (request.getValidateTargetElement() == null)
throw new WSTrustException("Unable to validate token: validate target is null");
if (request.getTokenType() == null)
@@ -449,12 +450,31 @@
public RequestSecurityTokenResponse cancel(RequestSecurityToken request, Principal callerPrincipal)
throws WSTrustException
{
+ // check if request contains all required elements.
Document rstDocument = request.getRSTDocument();
if (rstDocument == null)
throw new IllegalArgumentException("Request does not contain the DOM Document");
+ if (request.getCancelTargetElement() == null)
+ throw new WSTrustException("Illegal cancel request: cancel target is null");
- // TODO: implement cancel logic.
- throw new UnsupportedOperationException();
+ // obtain the token provider that will handle the request.
+ Node securityToken = request.getCancelTargetElement().getFirstChild();
+ SecurityTokenProvider provider = this.configuration.getProviderForTokenElementNS(securityToken.getLocalName(),
+ securityToken.getNamespaceURI());
+ if (provider == null)
+ throw new WSTrustException("No SecurityTokenProvider configured for " + securityToken.getNamespaceURI() + ":"
+ + securityToken.getLocalName());
+
+ // create a request context and dispatch to the provider.
+ WSTrustRequestContext context = new WSTrustRequestContext(request, callerPrincipal);
+ provider.cancelToken(context);
+
+ // if no exception has been raised, the token has been successfully canceled.
+ RequestSecurityTokenResponse response = new RequestSecurityTokenResponse();
+ if (request.getContext() != null)
+ response.setContext(request.getContext());
+ response.setRequestedTokenCancelled(new RequestedTokenCancelledType());
+ return response;
}
public Document postProcess(Document rstrDocument, RequestSecurityToken request) throws WSTrustException
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/plugins/saml/SAML20TokenProvider.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -21,13 +21,20 @@
*/
package org.jboss.identity.federation.core.wstrust.plugins.saml;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
import java.security.Principal;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
-import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.namespace.QName;
@@ -55,7 +62,6 @@
import org.jboss.identity.federation.ws.policy.AppliesTo;
import org.jboss.identity.federation.ws.trust.RequestedReferenceType;
import org.jboss.identity.federation.ws.trust.StatusType;
-import org.jboss.identity.federation.ws.trust.ValidateTargetType;
import org.jboss.identity.federation.ws.wss.secext.KeyIdentifierType;
import org.w3c.dom.Element;
@@ -71,7 +77,14 @@
private static Logger logger = Logger.getLogger(SAML20TokenProvider.class);
- @SuppressWarnings("unused")
+ private static final String CANCELED_IDS_FILE = "CanceledIdsFile";
+
+ // this set contains the ids of the assertions that have been canceled.
+ private Set<String> cancelledIds;
+
+ // file used to store the ids of the canceled assertions.
+ private File canceledIdsFile;
+
private Map<String, String> properties;
/*
@@ -82,6 +95,17 @@
public void initialize(Map<String, String> properties)
{
this.properties = properties;
+ this.cancelledIds = new HashSet<String>();
+
+ // set up the canceled ids cache if the file that contains the canceled assertions has been specified.
+ String file = this.properties.get(CANCELED_IDS_FILE);
+ if (file == null && logger.isDebugEnabled())
+ logger.debug("File to store canceled ids has not been specified: ids will not be persisted!");
+ else
+ {
+ this.canceledIdsFile = new File(file);
+ this.loadCanceledIds();
+ }
}
/*
@@ -91,7 +115,17 @@
*/
public void cancelToken(WSTrustRequestContext context) throws WSTrustException
{
- // TODO: implement cancel logic.
+ // get the assertion that must be canceled.
+ Element token = (Element) context.getRequestSecurityToken().getCancelTargetElement();
+ if (token == null)
+ throw new WSTrustException("Invalid cancel request: missing required CancelTarget");
+ Element assertionElement = (Element) token.getFirstChild();
+ if (!this.isAssertion(assertionElement))
+ throw new WSTrustException("CancelTarget doesn't not contain a SAMLV2.0 assertion");
+
+ // get the assertion ID and add it to the canceled assertions set.
+ String assertionId = assertionElement.getAttribute("ID");
+ this.storeCanceledId(assertionId);
}
/*
@@ -103,7 +137,72 @@
{
// generate an id for the new assertion.
String assertionID = IDGenerator.create("ID_");
- issueToken(context, assertionID);
+
+ // lifetime and audience restrictions.
+ Lifetime lifetime = context.getRequestSecurityToken().getLifetime();
+ AudienceRestrictionType restriction = null;
+ AppliesTo appliesTo = context.getRequestSecurityToken().getAppliesTo();
+ if (appliesTo != null)
+ restriction = SAMLAssertionFactory.createAudienceRestriction(WSTrustUtil.parseAppliesTo(appliesTo));
+ ConditionsType conditions = SAMLAssertionFactory.createConditions(lifetime.getCreated(), lifetime.getExpires(),
+ restriction);
+
+ String confirmationMethod = null;
+ KeyInfoConfirmationDataType keyInfoDataType = null;
+ // if there is a proof-of-possession token in the context, we have the holder of key confirmation method.
+ if (context.getProofTokenInfo() != null)
+ {
+ confirmationMethod = SAMLUtil.SAML2_HOLDER_OF_KEY_URI;
+ keyInfoDataType = SAMLAssertionFactory.createKeyInfoConfirmation(context.getProofTokenInfo());
+ }
+ else
+ confirmationMethod = SAMLUtil.SAML2_BEARER_URI;
+ // TODO: implement the SENDER_VOUCHES scenario.
+
+ SubjectConfirmationType subjectConfirmation = SAMLAssertionFactory.createSubjectConfirmation(null,
+ confirmationMethod, keyInfoDataType);
+
+ // create a subject using the caller principal.
+ Principal principal = context.getCallerPrincipal();
+ String subjectName = principal == null ? "ANONYMOUS" : principal.getName();
+ NameIDType nameID = SAMLAssertionFactory.createNameID(null, "urn:jboss:identity-federation", subjectName);
+ SubjectType subject = SAMLAssertionFactory.createSubject(nameID, subjectConfirmation);
+
+ // create the attribute statements if necessary.
+ List<StatementAbstractType> statements = null;
+ Map<String, Object> claimedAttributes = context.getClaimedAttributes();
+ if (claimedAttributes != null)
+ {
+ statements = new ArrayList<StatementAbstractType>();
+ statements.add(StatementUtil.createAttributeStatement(claimedAttributes));
+ }
+
+ // create the SAML assertion.
+ NameIDType issuerID = SAMLAssertionFactory.createNameID(null, null, context.getTokenIssuer());
+ AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID, issuerID, lifetime.getCreated(),
+ conditions, subject, statements);
+
+ // convert the constructed assertion to element.
+ Element assertionElement = null;
+ try
+ {
+ assertionElement = SAMLUtil.toElement(assertion);
+ }
+ catch (Exception e)
+ {
+ throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
+ }
+
+ SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
+ assertionElement, assertionID);
+ context.setSecurityToken(token);
+
+ // set the SAML assertion attached reference.
+ KeyIdentifierType keyIdentifier = WSTrustUtil.createKeyIdentifier(SAMLUtil.SAML2_VALUE_TYPE, "#" + assertionID);
+ Map<QName, String> attributes = new HashMap<QName, String>();
+ attributes.put(new QName(WSTrustConstants.WSSE11_NS, "TokenType"), SAMLUtil.SAML2_TOKEN_TYPE);
+ RequestedReferenceType attachedReference = WSTrustUtil.createRequestedReference(keyIdentifier, attributes);
+ context.setAttachedReference(attachedReference);
}
/*
@@ -132,6 +231,10 @@
throw new WSTrustException("Error unmarshalling assertion", je);
}
+ // canceled assertions cannot be renewed.
+ if (this.cancelledIds.contains(oldAssertion.getID()))
+ throw new WSTrustException("Assertion with id " + oldAssertion.getID() + " is canceled and cannot be renewed");
+
// adjust the lifetime for the renewed assertion.
ConditionsType conditions = oldAssertion.getConditions();
conditions.setNotBefore(context.getRequestSecurityToken().getLifetime().getCreated());
@@ -155,8 +258,8 @@
{
throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
}
- SecurityToken securityToken = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
- assertionElement, assertionID);
+ SecurityToken securityToken = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType()
+ .toString(), assertionElement, assertionID);
context.setSecurityToken(securityToken);
// set the SAML assertion attached reference.
@@ -172,50 +275,45 @@
*
* @see org.jboss.identity.federation.core.wstrust.SecurityTokenProvider#validateToken(org.jboss.identity.federation.core.wstrust.WSTrustRequestContext)
*/
- @SuppressWarnings("unchecked")
public void validateToken(WSTrustRequestContext context) throws WSTrustException
{
if (logger.isTraceEnabled())
logger.trace("SAML V2.0 token validation started");
// get the SAML assertion that must be validated.
- ValidateTargetType validateTarget = context.getRequestSecurityToken().getValidateTarget();
- if (validateTarget == null)
+ Element token = context.getRequestSecurityToken().getValidateTargetElement();
+ if (token == null)
throw new WSTrustException("Bad validate request: missing required ValidateTarget");
String code = WSTrustConstants.STATUS_CODE_VALID;
String reason = "SAMLV2.0 Assertion successfuly validated";
AssertionType assertion = null;
-
- Object assertionObj = validateTarget.getAny();
- if (assertionObj instanceof JAXBElement)
+ Element assertionElement = (Element) token.getFirstChild();
+ if (!this.isAssertion(assertionElement))
{
- JAXBElement<AssertionType> assertionType = (JAXBElement<AssertionType>) validateTarget.getAny();
- assertion = assertionType.getValue();
+ code = WSTrustConstants.STATUS_CODE_INVALID;
+ reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
}
- else if (assertionObj instanceof Element)
+ else
{
- Element assertionElement = (Element) assertionObj;
-
- if (!this.isAssertion(assertionElement))
+ try
{
- code = WSTrustConstants.STATUS_CODE_INVALID;
- reason = "Validation failure: supplied token is not a SAMLV2.0 Assertion";
+ assertion = SAMLUtil.fromElement(assertionElement);
}
- else
+ catch (JAXBException e)
{
- try
- {
- assertion = SAMLUtil.fromElement((Element) assertionObj);
- }
- catch (JAXBException e)
- {
- throw new WSTrustException("Unmarshalling error:", e);
- }
+ throw new WSTrustException("Unmarshalling error:", e);
}
}
+ // check if the assertion has been canceled before.
+ if (this.cancelledIds.contains(assertion.getID()))
+ {
+ code = WSTrustConstants.STATUS_CODE_INVALID;
+ reason = "Validation failure: assertion with id " + assertion.getID() + " is canceled";
+ }
+
// check the assertion lifetime.
try
{
@@ -253,77 +351,64 @@
}
/**
- * Issue a SAML assertion token with the provided ID
- * @param context
- * @param assertionID
- * @throws WSTrustException
+ * <p>
+ * This method loads the ids of the canceled assertions from the file that has been configured for this provider.
+ * All retrieved ids are set in the local cache of canceled ids.
+ * </p>
*/
- private void issueToken(WSTrustRequestContext context, String assertionID) throws WSTrustException
+ private void loadCanceledIds()
{
- // lifetime and audience restrictions.
- Lifetime lifetime = context.getRequestSecurityToken().getLifetime();
- AudienceRestrictionType restriction = null;
- AppliesTo appliesTo = context.getRequestSecurityToken().getAppliesTo();
- if (appliesTo != null)
- restriction = SAMLAssertionFactory.createAudienceRestriction(WSTrustUtil.parseAppliesTo(appliesTo));
- ConditionsType conditions = SAMLAssertionFactory.createConditions(lifetime.getCreated(), lifetime.getExpires(),
- restriction);
-
- String confirmationMethod = null;
- KeyInfoConfirmationDataType keyInfoDataType = null;
- // if there is a proof-of-possession token in the context, we have the holder of key confirmation method.
- if (context.getProofTokenInfo() != null)
+ try
{
- confirmationMethod = SAMLUtil.SAML2_HOLDER_OF_KEY_URI;
- keyInfoDataType = SAMLAssertionFactory.createKeyInfoConfirmation(context.getProofTokenInfo());
+ if (!this.canceledIdsFile.exists())
+ {
+ if (logger.isDebugEnabled())
+ logger.debug("File " + this.canceledIdsFile.getCanonicalPath() + " doesn't exist and will be created");
+ this.canceledIdsFile.createNewFile();
+ }
+ // read the file contents and populate the local cache.
+ BufferedReader reader = new BufferedReader(new FileReader(this.canceledIdsFile));
+ String id = reader.readLine();
+ while(id != null)
+ {
+ this.cancelledIds.add(id);
+ id = reader.readLine();
+ }
+ reader.close();
}
- else
- confirmationMethod = SAMLUtil.SAML2_BEARER_URI;
- // TODO: implement the SENDER_VOUCHES scenario.
-
- SubjectConfirmationType subjectConfirmation = SAMLAssertionFactory.createSubjectConfirmation(null,
- confirmationMethod, keyInfoDataType);
-
- // create a subject using the caller principal.
- Principal principal = context.getCallerPrincipal();
- String subjectName = principal == null ? "ANONYMOUS" : principal.getName();
- NameIDType nameID = SAMLAssertionFactory.createNameID(null, "urn:jboss:identity-federation", subjectName);
- SubjectType subject = SAMLAssertionFactory.createSubject(nameID, subjectConfirmation);
-
- // create the attribute statements if necessary.
- List<StatementAbstractType> statements = null;
- Map<String, Object> claimedAttributes = context.getClaimedAttributes();
- if (claimedAttributes != null)
+ catch (IOException ioe)
{
- statements = new ArrayList<StatementAbstractType>();
- statements.add(StatementUtil.createAttributeStatement(claimedAttributes));
+ if (logger.isDebugEnabled())
+ logger.debug("Error opening canceled ids file: " + ioe.getMessage());
+ ioe.printStackTrace();
}
-
- // create the SAML assertion.
- NameIDType issuerID = SAMLAssertionFactory.createNameID(null, null, context.getTokenIssuer());
- AssertionType assertion = SAMLAssertionFactory.createAssertion(assertionID, issuerID, lifetime.getCreated(),
- conditions, subject, statements);
-
- // convert the constructed assertion to element.
- Element assertionElement = null;
- try
+ }
+
+ /**
+ * <p>
+ * Stores the specified id in the cache of canceled ids. If a canceled ids file has been configured for this
+ * provider, the id will also be written to the end of the file.
+ * </p>
+ *
+ * @param id a {@code String} representing the canceled id that must be stored.
+ */
+ public synchronized void storeCanceledId(String id)
+ {
+ if (this.canceledIdsFile != null)
{
- assertionElement = SAMLUtil.toElement(assertion);
+ try
+ {
+ // write a new line with the canceled id at the end of the file.
+ BufferedWriter writer = new BufferedWriter(new FileWriter(this.canceledIdsFile, true));
+ writer.write(id + "\n");
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ e.printStackTrace();
+ }
}
- catch (Exception e)
- {
- throw new WSTrustException("Failed to marshall SAMLV2 assertion", e);
- }
-
- SecurityToken token = new StandardSecurityToken(context.getRequestSecurityToken().getTokenType().toString(),
- assertionElement, assertionID);
- context.setSecurityToken(token);
-
- // set the SAML assertion attached reference.
- KeyIdentifierType keyIdentifier = WSTrustUtil.createKeyIdentifier(SAMLUtil.SAML2_VALUE_TYPE, "#" + assertionID);
- Map<QName, String> attributes = new HashMap<QName, String>();
- attributes.put(new QName(WSTrustConstants.WSSE11_NS, "TokenType"), SAMLUtil.SAML2_TOKEN_TYPE);
- RequestedReferenceType attachedReference = WSTrustUtil.createRequestedReference(keyIdentifier, attributes);
- context.setAttachedReference(attachedReference);
+ // add the canceled id to the local cache.
+ this.cancelledIds.add(id);
}
}
\ No newline at end of file
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityToken.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -136,7 +136,7 @@
private URI canonicalizationAlgorithm;
private URI keyWrapAlgorithm;
-
+
private ProofEncryptionType proofEncryption;
private UseKeyType useKey;
@@ -270,7 +270,7 @@
}
}
}
-
+
/**
* Creates an instance of {@code RequestSecurityTokenType} and {@code Document}
* @param delegate
@@ -279,7 +279,7 @@
public RequestSecurityToken(RequestSecurityTokenType delegate, Document rstDocument)
{
this(delegate);
- this.rstDocument = rstDocument;
+ this.rstDocument = rstDocument;
}
/**
@@ -730,7 +730,7 @@
{
return this.keyWrapAlgorithm;
}
-
+
/**
* <p>
* Sets the key wrap algorithm in the request.
@@ -742,7 +742,7 @@
{
this.keyWrapAlgorithm = keyWrapAlgorithm;
}
-
+
/**
* <p>
* Obtains the {@code ProofEncryption} section of the request. The {@code ProofEncryption} indicates that the
@@ -1079,7 +1079,7 @@
{
return this.validateTarget;
}
-
+
/**
* Return the element in the document that represents
* the validate type
@@ -1087,14 +1087,14 @@
*/
public Element getValidateTargetElement()
{
- if(rstDocument == null)
+ if (rstDocument == null)
throw new IllegalStateException("RST Document is null");
-
+
String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
String localPart = "ValidateTarget";
-
- NodeList nodeList = rstDocument.getElementsByTagNameNS(ns,localPart);
- if(nodeList != null && nodeList.getLength() > 0)
+
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localPart);
+ if (nodeList != null && nodeList.getLength() > 0)
return (Element) nodeList.item(0);
else
return null;
@@ -1110,21 +1110,43 @@
*/
public Element getRenewTargetElement()
{
- if(this.rstDocument == null)
+ if (this.rstDocument == null)
throw new IllegalStateException("RST Document is null");
String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
String localName = "RenewTarget";
- NodeList nodeList = rstDocument.getElementsByTagNameNS(ns,localName);
- if(nodeList != null && nodeList.getLength() > 0)
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localName);
+ if (nodeList != null && nodeList.getLength() > 0)
return (Element) nodeList.item(0);
else
return null;
}
-
+
/**
* <p>
- * Sets the {@code ValidateTarged} section of the request. This elements identifies the token that is to be
+ * Returns the element in the document that represents the cancel target type.
+ * </p>
+ *
+ * @return the {@code Element} that represents the renew target type, or {@code null} if no renew target is found in
+ * the document.
+ */
+ public Element getCancelTargetElement()
+ {
+ if (this.rstDocument == null)
+ throw new IllegalStateException("RST Document is null");
+ String ns = "http://docs.oasis-open.org/ws-sx/ws-trust/200512/";
+ String localName = "CancelTarget";
+
+ NodeList nodeList = rstDocument.getElementsByTagNameNS(ns, localName);
+ if (nodeList != null && nodeList.getLength() > 0)
+ return (Element) nodeList.item(0);
+ else
+ return null;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code ValidateTarget} section of the request. This elements identifies the token that is to be
* validated.
* </p>
*
@@ -1173,7 +1195,7 @@
{
return this.delegate;
}
-
+
/**
* Get the {@code Document} document representing the request
* @return
@@ -1182,7 +1204,7 @@
{
return this.rstDocument;
}
-
+
public void setRSTDocument(Document rstDocument)
{
this.rstDocument = rstDocument;
Modified: identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/main/java/org/jboss/identity/federation/core/wstrust/wrappers/RequestSecurityTokenResponse.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -49,6 +49,7 @@
import org.jboss.identity.federation.ws.trust.RequestedProofTokenType;
import org.jboss.identity.federation.ws.trust.RequestedReferenceType;
import org.jboss.identity.federation.ws.trust.RequestedSecurityTokenType;
+import org.jboss.identity.federation.ws.trust.RequestedTokenCancelledType;
import org.jboss.identity.federation.ws.trust.StatusType;
import org.jboss.identity.federation.ws.trust.UseKeyType;
@@ -125,6 +126,8 @@
private RequestedProofTokenType requestedProofToken;
+ private RequestedTokenCancelledType requestedTokenCancelled;
+
private EntropyType entropy;
private Lifetime lifetime;
@@ -231,6 +234,8 @@
this.requestedUnattachedReference = (RequestedReferenceType) element.getValue();
else if (localName.equalsIgnoreCase("RequestedProofToken"))
this.requestedProofToken = (RequestedProofTokenType) element.getValue();
+ else if (localName.equalsIgnoreCase("RequestedTokenCancelled"))
+ this.requestedTokenCancelled = (RequestedTokenCancelledType) element.getValue();
else if (localName.equalsIgnoreCase("Entropy"))
this.entropy = (EntropyType) element.getValue();
else if (localName.equalsIgnoreCase("Lifetime"))
@@ -472,6 +477,35 @@
/**
* <p>
+ * Obtains the {@code RequestedTokenCancelled} section of the response, if it has been set. The presence of this
+ * element indicates that the security token specified in the cancel request has been successfully canceled by
+ * the STS.
+ * </p>
+ *
+ * @return a reference to the {@code RequestedTokenCancelledType}, or {@code null} if the response doesn't have
+ * a {@code RequestedTokenCancelled} section.
+ */
+ public RequestedTokenCancelledType getRequestedTokenCancelled()
+ {
+ return this.requestedTokenCancelled;
+ }
+
+ /**
+ * <p>
+ * Sets the {@code RequestedTokenCancelled} section of the response. This element is used to inform the client that
+ * the token specified in a cancel request has been successfully canceled by the STS.
+ * </p>
+ *
+ * @param requestedTokenCancelled a reference to the {@code RequestedTokenCancelledType}.
+ */
+ public void setRequestedTokenCancelled(RequestedTokenCancelledType requestedTokenCancelled)
+ {
+ this.requestedTokenCancelled = requestedTokenCancelled;
+ this.delegate.getAny().add(this.factory.createRequestedTokenCancelled(requestedTokenCancelled));
+ }
+
+ /**
+ * <p>
* Obtains the entropy that has been used in creating the key.
* </p>
*
@@ -1145,7 +1179,7 @@
{
return this.delegate.getAny();
}
-
+
/**
* <p>
* Obtains a reference to the {@code RequestSecurityTokenResponseType} delegate.
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/JBossSTSUnitTestCase.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -66,6 +66,7 @@
import org.jboss.identity.federation.ws.addressing.ObjectFactory;
import org.jboss.identity.federation.ws.policy.AppliesTo;
import org.jboss.identity.federation.ws.trust.BinarySecretType;
+import org.jboss.identity.federation.ws.trust.CancelTargetType;
import org.jboss.identity.federation.ws.trust.EntropyType;
import org.jboss.identity.federation.ws.trust.RenewTargetType;
import org.jboss.identity.federation.ws.trust.RequestedProofTokenType;
@@ -606,6 +607,94 @@
/**
* <p>
+ * This test case first generates a SAMLV2.0 assertion and then sends a WS-Trust cancel message to the STS to cancel
+ * the assertion. A canceled assertion cannot be renewed or considered valid anymore.
+ * </p>
+ *
+ * @throws Exception
+ * if an error occurs while running the test.
+ */
+ public void testInvokeSAML20Cancel() throws Exception
+ {
+ // create a simple token request.
+ RequestSecurityToken request = this.createRequest("testcontext", WSTrustConstants.ISSUE_REQUEST,
+ SAMLUtil.SAML2_TOKEN_TYPE, null);
+
+ // use the factory to marshall the request.
+ WSTrustJAXBFactory factory = WSTrustJAXBFactory.getInstance();
+ Source requestMessage = factory.marshallRequestSecurityToken(request);
+
+ // invoke the token service.
+ Source responseMessage = this.tokenService.invoke(requestMessage);
+ BaseRequestSecurityTokenResponse baseResponse = factory.parseRequestSecurityTokenResponse(responseMessage);
+
+ // validate the response and get the SAML assertion from the request.
+ this.validateSAMLAssertionResponse(baseResponse, "testcontext", SAMLUtil.SAML2_BEARER_URI);
+ RequestSecurityTokenResponseCollection collection = (RequestSecurityTokenResponseCollection) baseResponse;
+ Element assertion = (Element) collection.getRequestSecurityTokenResponses().get(0).getRequestedSecurityToken()
+ .getAny();
+
+ // now construct a WS-Trust cancel request with the generated assertion.
+ request = this.createRequest("cancelcontext", WSTrustConstants.CANCEL_REQUEST, null, null);
+ CancelTargetType cancelTarget = new CancelTargetType();
+ cancelTarget.setAny(assertion);
+ request.setCancelTarget(cancelTarget);
+
+ // invoke the token service.
+ responseMessage = this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ baseResponse = factory.parseRequestSecurityTokenResponse(responseMessage);
+
+ // validate the response contents.
+ assertNotNull("Unexpected null response", baseResponse);
+ assertTrue("Unexpected response type", baseResponse instanceof RequestSecurityTokenResponseCollection);
+ collection = (RequestSecurityTokenResponseCollection) baseResponse;
+ assertEquals("Unexpected number of responses", 1, collection.getRequestSecurityTokenResponses().size());
+ RequestSecurityTokenResponse response = collection.getRequestSecurityTokenResponses().get(0);
+ assertEquals("Unexpected response context", "cancelcontext", response.getContext());
+ assertNotNull("Cancel response should contain a RequestedTokenCancelled element", response
+ .getRequestedTokenCancelled());
+
+ // try to validate the canceled assertion.
+ request = this.createRequest("validatecontext", WSTrustConstants.VALIDATE_REQUEST, null, null);
+ ValidateTargetType validateTarget = new ValidateTargetType();
+ validateTarget.setAny(assertion);
+ request.setValidateTarget(validateTarget);
+
+ // the response should contain a status indicating that the token is not valid.
+ responseMessage = this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ collection = (RequestSecurityTokenResponseCollection) factory.parseRequestSecurityTokenResponse(responseMessage);
+ assertEquals("Unexpected number of responses", 1, collection.getRequestSecurityTokenResponses().size());
+ response = collection.getRequestSecurityTokenResponses().get(0);
+ assertEquals("Unexpected response context", "validatecontext", response.getContext());
+ assertEquals("Unexpected token type", WSTrustConstants.STATUS_TYPE, response.getTokenType().toString());
+ StatusType status = response.getStatus();
+ assertNotNull("Unexpected null status", status);
+ assertEquals("Unexpected status code", WSTrustConstants.STATUS_CODE_INVALID, status.getCode());
+ assertEquals("Unexpected status reason", "Validation failure: assertion with id " + assertion.getAttribute("ID")
+ + " is canceled", status.getReason());
+
+ // now try to renew the canceled assertion.
+ request = this.createRequest("renewcontext", WSTrustConstants.RENEW_REQUEST, null, null);
+ RenewTargetType renewTarget = new RenewTargetType();
+ renewTarget.setAny(assertion);
+ request.setRenewTarget(renewTarget);
+
+ // we should receive an exception when renewing the token.
+ try
+ {
+ this.tokenService.invoke(factory.marshallRequestSecurityToken(request));
+ fail("Renewing a canceled token should result in an exception being thrown");
+ }
+ catch (WebServiceException we)
+ {
+ assertTrue("Unexpected cause type", we.getCause() instanceof WSTrustException);
+ assertEquals("Unexpected exception message", "Assertion with id " + assertion.getAttribute("ID")
+ + " is canceled and cannot be renewed", we.getCause().getMessage());
+ }
+ }
+
+ /**
+ * <p>
* This test tries to request a token of an unknown type, checking if an exception is correctly thrown by the
* security token service.
* </p>
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/SAML20TokenProviderUnitTestCase.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -28,17 +28,20 @@
import java.security.cert.Certificate;
import java.util.Arrays;
import java.util.GregorianCalendar;
+import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import javax.xml.namespace.QName;
+import javax.xml.transform.dom.DOMSource;
import junit.framework.TestCase;
import org.jboss.identity.federation.core.wstrust.StandardSecurityToken;
import org.jboss.identity.federation.core.wstrust.WSTrustConstants;
+import org.jboss.identity.federation.core.wstrust.WSTrustJAXBFactory;
import org.jboss.identity.federation.core.wstrust.WSTrustRequestContext;
import org.jboss.identity.federation.core.wstrust.WSTrustUtil;
import org.jboss.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider;
@@ -59,6 +62,7 @@
import org.jboss.identity.xmlsec.w3.xmldsig.KeyInfoType;
import org.jboss.identity.xmlsec.w3.xmldsig.X509DataType;
import org.jboss.identity.xmlsec.w3.xmlenc.EncryptedKeyType;
+import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
@@ -71,6 +75,16 @@
public class SAML20TokenProviderUnitTestCase extends TestCase
{
+ private SAML20TokenProvider provider;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ this.provider = new SAML20TokenProvider();
+ provider.initialize(new HashMap<String, String>());
+ }
+
/**
* <p>
* Tests the issuance of a SAMLV2.0 Assertion.
@@ -90,7 +104,7 @@
context.setTokenIssuer("JBossSTS");
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
JAXBContext jaxbContext = JAXBContext.newInstance("org.jboss.identity.federation.saml.v2.assertion");
@@ -168,16 +182,16 @@
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
context.setTokenIssuer("JBossSTS");
-
+
// let's set a symmetric key proof-of-possession token in the context.
byte[] secret = WSTrustUtil.createRandomSecret(32);
PublicKey serviceKey = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service2").getPublicKey();
context.setProofTokenInfo(WSTrustUtil.createKeyInfo(secret, serviceKey, null));
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
-
+
// check if the assertion has a subject confirmation that contains the encrypted symmetric key.
AssertionType assertion = SAMLUtil.fromElement((Element) context.getSecurityToken().getTokenValue());
SubjectType subject = assertion.getSubject();
@@ -200,13 +214,13 @@
assertEquals("Unexpected key info content size", 1, keyInfo.getContent().size());
JAXBElement<?> encKeyElement = (JAXBElement<?>) keyInfo.getContent().get(0);
assertEquals("Unexpected key info content type", EncryptedKeyType.class, encKeyElement.getDeclaredType());
-
+
// Now let's set an asymmetric proof of possession token in the context.
Certificate certificate = this.getCertificate("keystore/sts_keystore.jks", "testpass", "service1");
context.setProofTokenInfo(WSTrustUtil.createKeyInfo(certificate));
-
+
// call the SAML token provider and check the generated token.
- new SAML20TokenProvider().issueToken(context);
+ this.provider.issueToken(context);
assertNotNull("Unexpected null security token", context.getSecurityToken());
// check if the assertion has a subject confirmation that contains the encoded certificate.
@@ -232,14 +246,14 @@
JAXBElement<?> x509DataElement = (JAXBElement<?>) keyInfo.getContent().get(0);
assertEquals("Unexpected key info content type", X509DataType.class, x509DataElement.getDeclaredType());
X509DataType x509Data = (X509DataType) x509DataElement.getValue();
- assertEquals("Unexpected X509 data content size", 1, x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().
- size());
+ assertEquals("Unexpected X509 data content size", 1, x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName()
+ .size());
JAXBElement<?> x509CertElement = (JAXBElement<?>) x509Data.getX509IssuerSerialOrX509SKIOrX509SubjectName().get(0);
assertEquals("Unexpected X509 data content type", byte[].class, x509CertElement.getDeclaredType());
byte[] encodedCert = (byte[]) x509CertElement.getValue();
assertTrue("Invalid encoded certificate found", Arrays.equals(certificate.getEncoded(), encodedCert));
}
-
+
/**
* <p>
* Tests the validation of a SAMLV2.0 Assertion.
@@ -252,17 +266,16 @@
// issue a SAMLV2.0 assertion.
WSTrustRequestContext context = this.createIssuingContext(WSTrustUtil.createDefaultLifetime(3600000));
- SAML20TokenProvider provider = new SAML20TokenProvider();
- provider.issueToken(context);
+ this.provider.issueToken(context);
// get the issued SAMLV2.0 assertion.
Element assertion = (Element) context.getSecurityToken().getTokenValue();
// now create a WS-Trust validate context.
context = this.createValidatingContext(assertion);
-
+
// validate the SAMLV2.0 assertion.
- provider.validateToken(context);
+ this.provider.validateToken(context);
StatusType status = context.getStatus();
assertNotNull("Unexpected null status type", status);
assertEquals("Unexpected status code", WSTrustConstants.STATUS_CODE_VALID, status.getCode());
@@ -275,10 +288,10 @@
GregorianCalendar expires = new GregorianCalendar();
expires.setTimeInMillis(currentTimeMillis - 1800000);
context = this.createIssuingContext(new Lifetime(created, expires));
-
+
provider.issueToken(context);
assertion = (Element) context.getSecurityToken().getTokenValue();
-
+
// try to validate the expired token.
context = this.createValidatingContext(assertion);
provider.validateToken(context);
@@ -310,7 +323,7 @@
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
context.setTokenIssuer("JBossSTS");
-
+
return context;
}
@@ -331,12 +344,14 @@
ValidateTargetType validateTarget = new ValidateTargetType();
validateTarget.setAny(assertion);
request.setValidateTarget(validateTarget);
+ // we need to set the request document in the request object for the test.
+ DOMSource requestSource = (DOMSource) WSTrustJAXBFactory.getInstance().marshallRequestSecurityToken(request);
+ request.setRSTDocument((Document) requestSource.getNode());
WSTrustRequestContext context = new WSTrustRequestContext(request, new TestPrincipal("sguilhen"));
-
return context;
}
-
+
/**
* <p>
* Obtains the {@code Certificate} stored under the specified alias in the specified keystore.
@@ -353,7 +368,7 @@
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(keyStoreFile);
KeyStore keyStore = KeyStore.getInstance("JKS");
keyStore.load(stream, passwd.toCharArray());
-
+
Certificate certificate = keyStore.getCertificate(certificateAlias);
return certificate;
}
Modified: identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java
===================================================================
--- identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java 2009-11-18 18:29:50 UTC (rev 1017)
+++ identity-federation/trunk/jboss-identity-fed-core/src/test/java/org/jboss/test/identity/federation/core/wstrust/WSTrustServiceFactoryUnitTestCase.java 2009-11-18 19:24:06 UTC (rev 1018)
@@ -22,6 +22,7 @@
package org.jboss.test.identity.federation.core.wstrust;
import java.security.PrivilegedActionException;
+import java.util.HashMap;
import junit.framework.TestCase;
@@ -83,12 +84,13 @@
public void testCreateTokenProvider() throws Exception
{
WSTrustServiceFactory factory = WSTrustServiceFactory.getInstance();
- SecurityTokenProvider provider = factory
- .createTokenProvider("org.jboss.test.identity.federation.core.wstrust.SpecialTokenProvider", null);
+ SecurityTokenProvider provider = factory.createTokenProvider(
+ "org.jboss.test.identity.federation.core.wstrust.SpecialTokenProvider", null);
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof SpecialTokenProvider);
- provider = factory
- .createTokenProvider("org.jboss.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider", null);
+ provider = factory.createTokenProvider(
+ "org.jboss.identity.federation.core.wstrust.plugins.saml.SAML20TokenProvider",
+ new HashMap<String, String>());
assertNotNull("Unexpected null token provider", provider);
assertTrue("Unexpected token provider type", provider instanceof SAML20TokenProvider);
16 years, 6 months
JBoss Identity SVN: r1016 - in migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org: picketlink/identity/seam/federation and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2009-11-18 11:02:56 -0500 (Wed, 18 Nov 2009)
New Revision: 1016
Added:
migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/
Removed:
migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/jboss/
Modified:
migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java
Log:
migrate
Copied: migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink (from rev 998, migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/jboss)
Modified: migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java
===================================================================
--- migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/jboss/identity/seam/federation/Authenticator.java 2009-11-18 06:09:30 UTC (rev 998)
+++ migration/picketlink/federation/trunk/picketlink-webapps/seam-sp/src/main/java/org/picketlink/identity/seam/federation/Authenticator.java 2009-11-18 16:02:56 UTC (rev 1016)
@@ -19,11 +19,11 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.identity.seam.federation;
+package org.picketlink.seam.federation;
import java.util.List;
-import org.jboss.identity.seam.federation.SamlIdentity;
+import org.picketlink.seam.federation.SamlIdentity;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
16 years, 6 months
JBoss Identity SVN: r1015 - in migration/idm/trunk: assembly and 26 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-18 10:42:22 -0500 (Wed, 18 Nov 2009)
New Revision: 1015
Modified:
migration/idm/trunk/assembly/pom.xml
migration/idm/trunk/example/auth-simple/pom.xml
migration/idm/trunk/example/auth/pom.xml
migration/idm/trunk/example/auth/src/main/resources/jboss.idm.cfg.xml
migration/idm/trunk/example/simple/pom.xml
migration/idm/trunk/example/simple/src/test/resources/example-db-config.xml
migration/idm/trunk/example/simple/src/test/resources/example-db-inject-sf-config.xml
migration/idm/trunk/example/simple/src/test/resources/example-ldap-config.xml
migration/idm/trunk/example/simple/src/test/resources/example-mixed-config.xml
migration/idm/trunk/integration/deployer/pom.xml
migration/idm/trunk/integration/deployer/src/main/resources/jboss.idm.cfg.xml
migration/idm/trunk/integration/deployer/src/test/resources/jbpm.identity/jbpm.idm.cfg.xml
migration/idm/trunk/integration/jboss5/pom.xml
migration/idm/trunk/integration/pom.xml
migration/idm/trunk/parent/pom.xml
migration/idm/trunk/picketlink-idm-api/pom.xml
migration/idm/trunk/picketlink-idm-auth/pom.xml
migration/idm/trunk/picketlink-idm-cache/pom.xml
migration/idm/trunk/picketlink-idm-common/pom.xml
migration/idm/trunk/picketlink-idm-core/pom.xml
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/AttributesType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoresType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/JbossIdentityType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/ObjectFactory.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/OptionsType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmsType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RelationshipsType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoriesType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoryType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/StoresType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/package-info.java
migration/idm/trunk/picketlink-idm-core/src/test/resources/example-db-config.xml
migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xml
migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xsd
migration/idm/trunk/picketlink-idm-core/src/test/resources/store-test-config.xml
migration/idm/trunk/picketlink-idm-core/src/test/resources/test-config.xml
migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/en/ReferenceGuide.xml
migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
migration/idm/trunk/picketlink-idm-docs/pom.xml
migration/idm/trunk/picketlink-idm-hibernate/pom.xml
migration/idm/trunk/picketlink-idm-ldap/pom.xml
migration/idm/trunk/picketlink-idm-spi/pom.xml
migration/idm/trunk/picketlink-idm-testsuite/pom.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/identity-config.xsd
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/store-test-config.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml
migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml
migration/idm/trunk/pom.xml
Log:
version and xml schema upgrade
Modified: migration/idm/trunk/assembly/pom.xml
===================================================================
--- migration/idm/trunk/assembly/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/assembly/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -4,14 +4,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm</groupId>
<artifactId>jbossidm</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>PicketLink IDM Assembly </name>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: migration/idm/trunk/example/auth/pom.xml
===================================================================
--- migration/idm/trunk/example/auth/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/auth/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<artifactId>example-auth</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication</name>
Modified: migration/idm/trunk/example/auth/src/main/resources/jboss.idm.cfg.xml
===================================================================
--- migration/idm/trunk/example/auth/src/main/resources/jboss.idm.cfg.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/auth/src/main/resources/jboss.idm.cfg.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentity</id>
Modified: migration/idm/trunk/example/auth-simple/pom.xml
===================================================================
--- migration/idm/trunk/example/auth-simple/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/auth-simple/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<artifactId>example-auth-simple</artifactId>
<packaging>jar</packaging>
<name>Example - JEE authentication (using deployer)</name>
Modified: migration/idm/trunk/example/simple/pom.xml
===================================================================
--- migration/idm/trunk/example/simple/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/simple/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.picketlink.idm.example</groupId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<artifactId>example-simple</artifactId>
<packaging>jar</packaging>
<name>Example - Simple PicketLink IDM Maven2 project</name>
Modified: migration/idm/trunk/example/simple/src/test/resources/example-db-config.xml
===================================================================
--- migration/idm/trunk/example/simple/src/test/resources/example-db-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/simple/src/test/resources/example-db-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentityExample/SampleRealm</id>
Modified: migration/idm/trunk/example/simple/src/test/resources/example-db-inject-sf-config.xml
===================================================================
--- migration/idm/trunk/example/simple/src/test/resources/example-db-inject-sf-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/simple/src/test/resources/example-db-inject-sf-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentityExample/SampleRealm</id>
Modified: migration/idm/trunk/example/simple/src/test/resources/example-ldap-config.xml
===================================================================
--- migration/idm/trunk/example/simple/src/test/resources/example-ldap-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/simple/src/test/resources/example-ldap-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentityExample/SampleRealm</id>
Modified: migration/idm/trunk/example/simple/src/test/resources/example-mixed-config.xml
===================================================================
--- migration/idm/trunk/example/simple/src/test/resources/example-mixed-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/example/simple/src/test/resources/example-mixed-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentityExample/SampleRealm</id>
Modified: migration/idm/trunk/integration/deployer/pom.xml
===================================================================
--- migration/idm/trunk/integration/deployer/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/integration/deployer/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -8,12 +8,12 @@
<groupId>org.picketlink.idm.integration</groupId>
<artifactId>picketlink-idm-jboss5-deployer</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-integration</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
</parent>
<properties>
Modified: migration/idm/trunk/integration/deployer/src/main/resources/jboss.idm.cfg.xml
===================================================================
--- migration/idm/trunk/integration/deployer/src/main/resources/jboss.idm.cfg.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/integration/deployer/src/main/resources/jboss.idm.cfg.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentity</id>
Modified: migration/idm/trunk/integration/deployer/src/test/resources/jbpm.identity/jbpm.idm.cfg.xml
===================================================================
--- migration/idm/trunk/integration/deployer/src/test/resources/jbpm.identity/jbpm.idm.cfg.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/integration/deployer/src/test/resources/jbpm.identity/jbpm.idm.cfg.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://jbpmIdentity</id>
Modified: migration/idm/trunk/integration/jboss5/pom.xml
===================================================================
--- migration/idm/trunk/integration/jboss5/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/integration/jboss5/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -8,12 +8,12 @@
<groupId>org.picketlink.idm.integration</groupId>
<artifactId>picketlink-idm-jboss5</artifactId>
<packaging>jar</packaging>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-integration</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
</parent>
<dependencies>
Modified: migration/idm/trunk/integration/pom.xml
===================================================================
--- migration/idm/trunk/integration/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/integration/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -13,7 +13,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
Modified: migration/idm/trunk/parent/pom.xml
===================================================================
--- migration/idm/trunk/parent/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/parent/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -8,7 +8,7 @@
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<name>PicketLink IDM- Parent</name>
<url>http://labs.jboss.org/portal/jbosssecurity/</url>
<description>PicketLink is a cross-cutting project that handles identity needs for the JEMS projects</description>
Modified: migration/idm/trunk/picketlink-idm-api/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-api/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-api/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-auth/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-auth/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-auth/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-cache/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-cache/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-cache/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-common/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-common/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-common/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-core/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-core/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/AttributesType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/AttributesType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/AttributesType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_beta}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityObjectTypeType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -32,7 +32,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_beta}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -54,7 +54,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_beta}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -65,7 +65,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_beta}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -231,7 +231,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_beta}attributeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="attribute" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}attributeType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -350,7 +350,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_beta}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -409,7 +409,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_beta}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,8 +25,8 @@
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="identity-object-types" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-object-typesType"/>
- * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_beta}optionsType"/>
+ * <element name="identity-object-types" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-object-typesType"/>
+ * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionsType"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreMappingsType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -26,7 +26,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="identity-store-mapping" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-store-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="identity-store-mapping" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-store-mappingType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoreType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -28,15 +28,15 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="external-config" type="{urn:jboss:identity:idm:config:v1_0_beta}external-configType"/>
- * <element name="supported-relationship-types" type="{urn:jboss:identity:idm:config:v1_0_beta}supported-relationship-typesType"/>
- * <element name="supported-identity-object-types" type="{urn:jboss:identity:idm:config:v1_0_beta}supported-identity-object-typesType"/>
+ * <element name="external-config" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}external-configType"/>
+ * <element name="supported-relationship-types" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}supported-relationship-typesType"/>
+ * <element name="supported-identity-object-types" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}supported-identity-object-typesType"/>
* <element name="options">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_beta}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
@@ -229,7 +229,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_beta}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoresType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoresType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityStoresType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -26,7 +26,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="identity-store" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-storeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="identity-store" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-storeType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/IdentityTypeMappingsType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -27,7 +27,7 @@
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="identity-mapping" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="group-type-mapping" type="{urn:jboss:identity:idm:config:v1_0_beta}group-type-mappingType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="group-type-mapping" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}group-type-mappingType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/JbossIdentityType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/JbossIdentityType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/JbossIdentityType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -24,9 +24,9 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="realms" type="{urn:jboss:identity:idm:config:v1_0_beta}realmsType"/>
- * <element name="repositories" type="{urn:jboss:identity:idm:config:v1_0_beta}repositoriesType"/>
- * <element name="stores" type="{urn:jboss:identity:idm:config:v1_0_beta}storesType"/>
+ * <element name="realms" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}realmsType"/>
+ * <element name="repositories" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}repositoriesType"/>
+ * <element name="stores" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}storesType"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/ObjectFactory.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/ObjectFactory.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/ObjectFactory.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -31,7 +31,7 @@
@XmlRegistry
public class ObjectFactory {
- private final static QName _JbossIdentity_QNAME = new QName("urn:jboss:identity:idm:config:v1_0_beta", "jboss-identity");
+ private final static QName _JbossIdentity_QNAME = new QName("urn:jboss:identity:idm:config:v1_0_0_cr1", "jboss-identity");
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.picketlink.impl.configuration.jaxb2.generated
@@ -276,7 +276,7 @@
* Create an instance of {@link JAXBElement }{@code <}{@link JbossIdentityType }{@code >}}
*
*/
- @XmlElementDecl(namespace = "urn:jboss:identity:idm:config:v1_0_beta", name = "jboss-identity")
+ @XmlElementDecl(namespace = "urn:jboss:identity:idm:config:v1_0_0_cr1", name = "jboss-identity")
public JAXBElement<JbossIdentityType> createJbossIdentity(JbossIdentityType value) {
return new JAXBElement<JbossIdentityType>(_JbossIdentity_QNAME, JbossIdentityType.class, null, value);
}
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/OptionsType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/OptionsType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/OptionsType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_beta}optionType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="option" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -26,8 +26,8 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="repository-id-ref" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="identity-type-mappings" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-type-mappingsType" minOccurs="0"/>
- * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_beta}optionsType" minOccurs="0"/>
+ * <element name="identity-type-mappings" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-type-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmsType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmsType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RealmsType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="realm" type="{urn:jboss:identity:idm:config:v1_0_beta}realmType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="realm" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}realmType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RelationshipsType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RelationshipsType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RelationshipsType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_beta}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="relationship" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}relationshipType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoriesType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoriesType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoriesType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="repository" type="{urn:jboss:identity:idm:config:v1_0_beta}repositoryType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="repository" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}repositoryType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoryType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoryType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/RepositoryType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -26,11 +26,11 @@
* <sequence>
* <element name="id" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="class" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="external-config" type="{urn:jboss:identity:idm:config:v1_0_beta}external-configType" minOccurs="0"/>
+ * <element name="external-config" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}external-configType" minOccurs="0"/>
* <element name="default-identity-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="default-attribute-store-id" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * <element name="identity-store-mappings" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-store-mappingsType" minOccurs="0"/>
- * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_beta}optionsType" minOccurs="0"/>
+ * <element name="identity-store-mappings" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-store-mappingsType" minOccurs="0"/>
+ * <element name="options" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}optionsType" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/StoresType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/StoresType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/StoresType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -25,7 +25,7 @@
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="attribute-stores" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * <element name="identity-stores" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-storesType"/>
+ * <element name="identity-stores" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-storesType"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/SupportedIdentityObjectTypesType.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -26,7 +26,7 @@
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
- * <element name="identity-object-type" type="{urn:jboss:identity:idm:config:v1_0_beta}identity-object-typeType" maxOccurs="unbounded" minOccurs="0"/>
+ * <element name="identity-object-type" type="{urn:jboss:identity:idm:config:v1_0_0_cr1}identity-object-typeType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
Modified: migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/package-info.java
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/package-info.java 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/main/java/org/picketlink/idm/impl/configuration/jaxb2/generated/package-info.java 2009-11-18 15:42:22 UTC (rev 1015)
@@ -5,5 +5,5 @@
// Generated on: 2008.12.18 at 03:00:04 PM CET
//
-(a)javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity:idm:config:v1_0_beta", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+(a)javax.xml.bind.annotation.XmlSchema(namespace = "urn:jboss:identity:idm:config:v1_0_0_cr1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.picketlink.idm.impl.configuration.jaxb2.generated;
Modified: migration/idm/trunk/picketlink-idm-core/src/test/resources/example-db-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/test/resources/example-db-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/test/resources/example-db-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://Example/DB</id>
Modified: migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id></id>
Modified: migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xsd
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xsd 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/test/resources/identity-config.xsd 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
- targetNamespace="urn:jboss:identity:idm:config:v1_0_beta" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta">
+ targetNamespace="urn:jboss:identity:idm:config:v1_0_0_cr1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1">
<xs:annotation>
- <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:idm:config:v1_0_beta"xmlns="urn:jboss:identity:idm:config:v1_0_beta"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:idm:config:v1_0_beta"></xs:documentation>
+ <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:idm:config:v1_0_0_cr1"xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:idm:config:v1_0_0_cr1"></xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="identity-object-typesType">
@@ -16,13 +16,13 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType" name="external-config" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
<xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
<xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:optionsType" name="options" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-storeType">
@@ -30,16 +30,16 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType" name="external-config"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:supported-relationship-typesType" name="supported-relationship-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:supported-identity-object-typesType" name="supported-identity-object-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element name="options">
<xs:complexType>
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -55,27 +55,27 @@
<xs:complexType name="identity-store-mappingsType">
<xs:sequence>
<xs:element type="urn:identity-store-mappingType" name="identity-store-mapping" maxOccurs="unbounded"
- minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="storesType">
<xs:sequence>
<xs:element type="xs:string" name="attribute-stores"/>
<xs:element type="urn:identity-storesType" name="identity-stores"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="jboss-identityType">
<xs:sequence>
- <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="supported-identity-object-typesType">
<xs:sequence>
<xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="optionType">
@@ -98,7 +98,7 @@
<xs:complexType name="repositoriesType">
<xs:sequence>
<xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="realmType">
@@ -106,28 +106,28 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="repository-id-ref"/>
<xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:optionsType" name="options" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="relationshipsType">
<xs:sequence>
<xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="realmsType">
<xs:sequence>
<xs:element type="urn:realmType" name="realm" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-type-mappingsType">
<xs:sequence>
<xs:element type="xs:string" name="user-mapping"/>
<xs:element type="urn:group-type-mappingType" name="group-type-mapping" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="supported-relationship-typesType">
@@ -138,21 +138,21 @@
<xs:complexType name="identity-storesType">
<xs:sequence>
<xs:element type="urn:identity-storeType" name="identity-store" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="attributesType">
<xs:sequence>
<xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-store-mappingType">
<xs:sequence>
<xs:element type="xs:string" name="identity-store-id"/>
<xs:element type="urn:identity-object-typesType" name="identity-object-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="relationshipType">
@@ -164,7 +164,7 @@
<xs:complexType name="optionsType">
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-object-typeType">
@@ -174,7 +174,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -189,7 +189,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -197,7 +197,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Modified: migration/idm/trunk/picketlink-idm-core/src/test/resources/store-test-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/test/resources/store-test-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/test/resources/store-test-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://Dymmy</id>
Modified: migration/idm/trunk/picketlink-idm-core/src/test/resources/test-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-core/src/test/resources/test-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-core/src/test/resources/test-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>Sample Ralm</id>
Modified: migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/en/ReferenceGuide.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/en/ReferenceGuide.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/en/ReferenceGuide.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -603,9 +603,9 @@
<programlisting>
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://JBossIdentityExample/SampleRealm</id>
@@ -1686,9 +1686,9 @@
<programlisting>
<![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://FlexibleRealm</id>
Modified: migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-docs/ReferenceGuide/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../../parent</relativePath>
</parent>
Modified: migration/idm/trunk/picketlink-idm-docs/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-docs/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-docs/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
Modified: migration/idm/trunk/picketlink-idm-hibernate/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-hibernate/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-hibernate/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-ldap/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-ldap/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-ldap/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-spi/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-spi/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-spi/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-testsuite/pom.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -2,7 +2,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/identity-config.xsd
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/identity-config.xsd 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/identity-config.xsd 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
- targetNamespace="urn:jboss:identity:idm:config:v1_0_beta" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta">
+ targetNamespace="urn:jboss:identity:idm:config:v1_0_0_cr1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="jboss-identity" type="urn:jboss-identityType" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1">
<xs:annotation>
- <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:idm:config:v1_0_beta"xmlns="urn:jboss:identity:idm:config:v1_0_beta"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:idm:config:v1_0_beta"></xs:documentation>
+ <xs:documentation><xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="urn:jboss:identity:idm:config:v1_0_0_cr1"xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"xmlns:xml="http://www.w3.org/XML/1998/namespace"xmlns:wcc="urn:jboss:identity:idm:config:v1_0_0_cr1"></xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="identity-object-typesType">
@@ -16,13 +16,13 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType" name="external-config" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="xs:string" name="default-identity-store-id" minOccurs="0"/>
<xs:element type="xs:string" name="default-attribute-store-id" minOccurs="0"/>
<xs:element type="urn:identity-store-mappingsType" name="identity-store-mappings" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:optionsType" name="options" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-storeType">
@@ -30,16 +30,16 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="class"/>
<xs:element type="urn:external-configType" name="external-config"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:supported-relationship-typesType" name="supported-relationship-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:supported-identity-object-typesType" name="supported-identity-object-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element name="options">
<xs:complexType>
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -55,27 +55,27 @@
<xs:complexType name="identity-store-mappingsType">
<xs:sequence>
<xs:element type="urn:identity-store-mappingType" name="identity-store-mapping" maxOccurs="unbounded"
- minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ minOccurs="0" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="storesType">
<xs:sequence>
<xs:element type="xs:string" name="attribute-stores"/>
<xs:element type="urn:identity-storesType" name="identity-stores"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="jboss-identityType">
<xs:sequence>
- <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ <xs:element type="urn:realmsType" name="realms" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:repositoriesType" name="repositories" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:storesType" name="stores" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="supported-identity-object-typesType">
<xs:sequence>
<xs:element type="urn:identity-object-typeType" name="identity-object-type" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="optionType">
@@ -98,7 +98,7 @@
<xs:complexType name="repositoriesType">
<xs:sequence>
<xs:element type="urn:repositoryType" name="repository" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="realmType">
@@ -106,28 +106,28 @@
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="repository-id-ref"/>
<xs:element type="urn:identity-type-mappingsType" name="identity-type-mappings" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
<xs:element type="urn:optionsType" name="options" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="relationshipsType">
<xs:sequence>
<xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="realmsType">
<xs:sequence>
<xs:element type="urn:realmType" name="realm" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-type-mappingsType">
<xs:sequence>
<xs:element type="xs:string" name="user-mapping"/>
<xs:element type="urn:group-type-mappingType" name="group-type-mapping" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="supported-relationship-typesType">
@@ -138,21 +138,21 @@
<xs:complexType name="identity-storesType">
<xs:sequence>
<xs:element type="urn:identity-storeType" name="identity-store" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="attributesType">
<xs:sequence>
<xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-store-mappingType">
<xs:sequence>
<xs:element type="xs:string" name="identity-store-id"/>
<xs:element type="urn:identity-object-typesType" name="identity-object-types"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
- <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
+ <xs:element type="urn:optionsType" name="options" xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="relationshipType">
@@ -164,7 +164,7 @@
<xs:complexType name="optionsType">
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="identity-object-typeType">
@@ -174,7 +174,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:relationshipType" name="relationship" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -189,7 +189,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:attributeType" name="attribute" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -197,7 +197,7 @@
<xs:complexType>
<xs:sequence>
<xs:element type="urn:optionType" name="option" maxOccurs="unbounded" minOccurs="0"
- xmlns:urn="urn:jboss:identity:idm:config:v1_0_beta"/>
+ xmlns:urn="urn:jboss:identity:idm:config:v1_0_0_cr1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/minimal-flexible-identity-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://FlexibleRealm</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/store-test-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/store-test-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/store-test-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://Dymmy</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad-local.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-msad.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends12.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-opends20.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-openldapds.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-redhatds.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config-sunds.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/resources/test-identity-config.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_beta"
+<jboss-identity xmlns="urn:jboss:identity:idm:config:v1_0_0_cr1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_beta identity-config.xsd">
+ xsi:schemaLocation="urn:jboss:identity:idm:config:v1_0_0_cr1 identity-config.xsd">
<realms>
<realm>
<id>realm://RedHat/DB</id>
Modified: migration/idm/trunk/pom.xml
===================================================================
--- migration/idm/trunk/pom.xml 2009-11-18 15:29:57 UTC (rev 1014)
+++ migration/idm/trunk/pom.xml 2009-11-18 15:42:22 UTC (rev 1015)
@@ -3,7 +3,7 @@
<parent>
<groupId>org.picketlink.idm</groupId>
<artifactId>picketlink-idm-parent</artifactId>
- <version>1.0.0-Beta4-SNAPSHOT</version>
+ <version>1.0.0-CR1-SNAPSHOT</version>
<relativePath>parent</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
16 years, 6 months
JBoss Identity SVN: r1013 - in migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org: picketlink/idm/impl and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2009-11-18 10:27:05 -0500 (Wed, 18 Nov 2009)
New Revision: 1013
Added:
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
Removed:
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java
migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
Log:
rename
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink (from rev 1005, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity)
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,134 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
-import org.jboss.identity.idm.impl.model.hibernate.HibernateIdentityObjectType;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-
-import java.util.logging.Logger;
-import java.sql.Connection;
-import java.sql.DriverManager;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class HibernateTestSupport
-{
- private static Logger logger = Logger.getLogger(HibernateTestSupport.class.getName());
-
- protected SessionFactory sessionFactory;
-
- private Connection connection;
-
- private final String databaseName;
-
- private final String hibernateConfiguration;
-
- public HibernateTestSupport(String databaseName, String hibernateConfiguration)
- {
- this.databaseName = databaseName;
- this.hibernateConfiguration = hibernateConfiguration;
- }
-
- public SessionFactory getSessionFactory()
- {
- return sessionFactory;
- }
-
-
- public void start() throws Exception {
- try {
- logger.info("Starting in-memory HSQL database for unit tests");
- Class.forName("org.hsqldb.jdbcDriver");
- connection = DriverManager.getConnection("jdbc:hsqldb:mem:" + databaseName, "sa", "");
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- logger.fine("Exception during HSQL database startup.");
- throw ex;
- }
- try
- {
- logger.info("Building JPA EntityManager for unit tests");
- sessionFactory = new Configuration().configure(hibernateConfiguration).buildSessionFactory();
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- logger.fine("Exception during JPA EntityManager instanciation.");
- throw ex;
- }
- }
-
- public void stop() throws Exception {
- logger.info("Shuting down Hibernate JPA layer.");
- if (sessionFactory != null)
- {
- sessionFactory.close();
- }
-
- logger.info("Stopping in-memory HSQL database.");
- try
- {
- connection.createStatement().execute("SHUTDOWN");
- }
- catch (Exception ex) {
- throw ex;
- }
- }
-
- public void populateObjectTypes(String[] typeNames) throws Exception
- {
-
- sessionFactory.getCurrentSession().getTransaction().begin();
-
- for (String typeName : typeNames)
- {
- HibernateIdentityObjectType hibernateType = new HibernateIdentityObjectType(typeName);
- sessionFactory.getCurrentSession().persist(hibernateType);
- }
-
- sessionFactory.getCurrentSession().getTransaction().commit();
-
- }
-
- public void populateRelationshipTypes(String[] typeNames) throws Exception
- {
-
- sessionFactory.getCurrentSession().getTransaction().begin();
-
- for (String typeName : typeNames)
- {
- HibernateIdentityObjectRelationshipType hibernateType = new HibernateIdentityObjectRelationshipType(typeName);
- sessionFactory.getCurrentSession().persist(hibernateType);
- }
-
- sessionFactory.getCurrentSession().getTransaction().commit();
- }
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/HibernateTestSupport.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/HibernateTestSupport.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,134 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl;
+
+import org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.picketlink.idm.impl.model.hibernate.HibernateIdentityObjectType;
+import org.hibernate.SessionFactory;
+import org.hibernate.cfg.Configuration;
+
+import java.util.logging.Logger;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateTestSupport
+{
+ private static Logger logger = Logger.getLogger(HibernateTestSupport.class.getName());
+
+ protected SessionFactory sessionFactory;
+
+ private Connection connection;
+
+ private final String databaseName;
+
+ private final String hibernateConfiguration;
+
+ public HibernateTestSupport(String databaseName, String hibernateConfiguration)
+ {
+ this.databaseName = databaseName;
+ this.hibernateConfiguration = hibernateConfiguration;
+ }
+
+ public SessionFactory getSessionFactory()
+ {
+ return sessionFactory;
+ }
+
+
+ public void start() throws Exception {
+ try {
+ logger.info("Starting in-memory HSQL database for unit tests");
+ Class.forName("org.hsqldb.jdbcDriver");
+ connection = DriverManager.getConnection("jdbc:hsqldb:mem:" + databaseName, "sa", "");
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logger.fine("Exception during HSQL database startup.");
+ throw ex;
+ }
+ try
+ {
+ logger.info("Building JPA EntityManager for unit tests");
+ sessionFactory = new Configuration().configure(hibernateConfiguration).buildSessionFactory();
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ logger.fine("Exception during JPA EntityManager instanciation.");
+ throw ex;
+ }
+ }
+
+ public void stop() throws Exception {
+ logger.info("Shuting down Hibernate JPA layer.");
+ if (sessionFactory != null)
+ {
+ sessionFactory.close();
+ }
+
+ logger.info("Stopping in-memory HSQL database.");
+ try
+ {
+ connection.createStatement().execute("SHUTDOWN");
+ }
+ catch (Exception ex) {
+ throw ex;
+ }
+ }
+
+ public void populateObjectTypes(String[] typeNames) throws Exception
+ {
+
+ sessionFactory.getCurrentSession().getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+ HibernateIdentityObjectType hibernateType = new HibernateIdentityObjectType(typeName);
+ sessionFactory.getCurrentSession().persist(hibernateType);
+ }
+
+ sessionFactory.getCurrentSession().getTransaction().commit();
+
+ }
+
+ public void populateRelationshipTypes(String[] typeNames) throws Exception
+ {
+
+ sessionFactory.getCurrentSession().getTransaction().begin();
+
+ for (String typeName : typeNames)
+ {
+ HibernateIdentityObjectRelationshipType hibernateType = new HibernateIdentityObjectRelationshipType(typeName);
+ sessionFactory.getCurrentSession().persist(hibernateType);
+ }
+
+ sessionFactory.getCurrentSession().getTransaction().commit();
+ }
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,220 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.portal.test.framework.embedded.ConnectionManagerSupport;
-import org.jboss.portal.test.framework.embedded.DataSourceSupport;
-import org.jboss.portal.test.framework.embedded.HibernateSupport;
-import org.jboss.portal.test.framework.embedded.JNDISupport;
-import org.jboss.portal.test.framework.embedded.TransactionManagerSupport;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import junit.framework.TestCase;
-import org.hibernate.SessionFactory;
-
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class IdentityTestPOJO extends TestCase
-{
-
- protected String identityConfig = "test-identity-config.xml";
-
- private String realmName;
-
- private String dataSourceName = "hsqldb";
-
- private String hibernateConfig = "datasources/hibernates.xml";
-
- private String datasources = "datasources/datasources.xml";
-
- private JNDISupport jndiSupport;
-
- protected TransactionManagerSupport transactonManagerSupport;
-
- protected ConnectionManagerSupport connectionManagerSupport;
-
- protected DataSourceSupport dataSourceSupport;
-
- protected HibernateSupport hibernateSupport;
-
-
-
- public void start() throws Exception
- {
- overrideFromProperties();
-
- jndiSupport = new JNDISupport();
- jndiSupport.start();
- transactonManagerSupport = new TransactionManagerSupport();
- transactonManagerSupport.start();
- connectionManagerSupport = new ConnectionManagerSupport();
- connectionManagerSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
- connectionManagerSupport.start();
-
-
-
- DataSourceSupport.Config dataSourceConfig = DataSourceSupport.Config.obtainConfig(datasources, dataSourceName);
-
- HibernateSupport.Config hibernateSupportConfig = HibernateSupport.getConfig(dataSourceName, hibernateConfig);
-
- dataSourceSupport = new DataSourceSupport();
- dataSourceSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
- dataSourceSupport.setConnectionManagerReference(connectionManagerSupport.getConnectionManagerReference());
- dataSourceSupport.setConfig(dataSourceConfig);
- dataSourceSupport.start();
-
-// hibernateSupport = new HibernateAnnotationsSupport();
- hibernateSupport = new HibernateSupport();
- hibernateSupport.setConfig(hibernateSupportConfig);
- hibernateSupport.setJNDIName("java:/jbossidentity/HibernateStoreSessionFactory");
-
- String prefix = "mappings/";
-
- //Sybase support hack
- if (dataSourceName.startsWith("sybase-"))
- {
- prefix = "sybase-mappings/";
- }
-
- List<String> mappings = new LinkedList<String>();
- mappings.add(prefix + "HibernateIdentityObject.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectCredentialBinaryValue.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectAttributeBinaryValue.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectAttribute.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectCredential.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectCredentialType.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectRelationship.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectRelationshipName.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectRelationshipType.hbm.xml");
- mappings.add(prefix + "HibernateIdentityObjectType.hbm.xml");
- mappings.add(prefix + "HibernateRealm.hbm.xml");
-
- hibernateSupport.setMappings(mappings);
-
- hibernateSupport.start();
-
-
- }
-
- public void stop() throws Exception
- {
- hibernateSupport.getSessionFactory().getStatistics().logSummary();
- hibernateSupport.stop();
- dataSourceSupport.stop();
- connectionManagerSupport.stop();
- transactonManagerSupport.stop();
- jndiSupport.stop();
-
-
- }
-
- public void overrideFromProperties() throws Exception
- {
- String dsName = System.getProperties().getProperty("dataSourceName");
-
- if (dsName != null && !dsName.startsWith("$"))
- {
- setDataSourceName(dsName);
- }
-
- }
-
- public SessionFactory getSessionFactory()
- {
- return getHibernateSupport().getSessionFactory();
- }
-
- public void setDataSourceName(String dataSourceName)
- {
- this.dataSourceName = dataSourceName;
- }
-
- public void setHibernateConfig(String hibernateConfig)
- {
- this.hibernateConfig = hibernateConfig;
- }
-
- public void setDatasources(String datasources)
- {
- this.datasources = datasources;
- }
-
- public void setIdentityConfig(String identityConfig)
- {
- this.identityConfig = identityConfig;
- }
-
- public void setRealmName(String realmName)
- {
- this.realmName = realmName;
- }
-
- public String getDataSourceName()
- {
- return dataSourceName;
- }
-
- public String getHibernateConfig()
- {
- return hibernateConfig;
- }
-
- public String getDatasources()
- {
- return datasources;
- }
-
- public String getIdentityConfig()
- {
- return identityConfig;
- }
-
- public String getRealmName()
- {
- return realmName;
- }
-
- public HibernateSupport getHibernateSupport()
- {
- return hibernateSupport;
- }
-
- public void begin()
- {
- getHibernateSupport().openSession();
- }
-
- public void commit()
- {
- assertTrue(getHibernateSupport().commitTransaction());
- }
-
-
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/IdentityTestPOJO.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/IdentityTestPOJO.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,220 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl;
+
+import org.jboss.portal.test.framework.embedded.ConnectionManagerSupport;
+import org.jboss.portal.test.framework.embedded.DataSourceSupport;
+import org.jboss.portal.test.framework.embedded.HibernateSupport;
+import org.jboss.portal.test.framework.embedded.JNDISupport;
+import org.jboss.portal.test.framework.embedded.TransactionManagerSupport;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import junit.framework.TestCase;
+import org.hibernate.SessionFactory;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class IdentityTestPOJO extends TestCase
+{
+
+ protected String identityConfig = "test-identity-config.xml";
+
+ private String realmName;
+
+ private String dataSourceName = "hsqldb";
+
+ private String hibernateConfig = "datasources/hibernates.xml";
+
+ private String datasources = "datasources/datasources.xml";
+
+ private JNDISupport jndiSupport;
+
+ protected TransactionManagerSupport transactonManagerSupport;
+
+ protected ConnectionManagerSupport connectionManagerSupport;
+
+ protected DataSourceSupport dataSourceSupport;
+
+ protected HibernateSupport hibernateSupport;
+
+
+
+ public void start() throws Exception
+ {
+ overrideFromProperties();
+
+ jndiSupport = new JNDISupport();
+ jndiSupport.start();
+ transactonManagerSupport = new TransactionManagerSupport();
+ transactonManagerSupport.start();
+ connectionManagerSupport = new ConnectionManagerSupport();
+ connectionManagerSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
+ connectionManagerSupport.start();
+
+
+
+ DataSourceSupport.Config dataSourceConfig = DataSourceSupport.Config.obtainConfig(datasources, dataSourceName);
+
+ HibernateSupport.Config hibernateSupportConfig = HibernateSupport.getConfig(dataSourceName, hibernateConfig);
+
+ dataSourceSupport = new DataSourceSupport();
+ dataSourceSupport.setTransactionManager(transactonManagerSupport.getTransactionManager());
+ dataSourceSupport.setConnectionManagerReference(connectionManagerSupport.getConnectionManagerReference());
+ dataSourceSupport.setConfig(dataSourceConfig);
+ dataSourceSupport.start();
+
+// hibernateSupport = new HibernateAnnotationsSupport();
+ hibernateSupport = new HibernateSupport();
+ hibernateSupport.setConfig(hibernateSupportConfig);
+ hibernateSupport.setJNDIName("java:/jbossidentity/HibernateStoreSessionFactory");
+
+ String prefix = "mappings/";
+
+ //Sybase support hack
+ if (dataSourceName.startsWith("sybase-"))
+ {
+ prefix = "sybase-mappings/";
+ }
+
+ List<String> mappings = new LinkedList<String>();
+ mappings.add(prefix + "HibernateIdentityObject.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectCredentialBinaryValue.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectAttributeBinaryValue.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectAttribute.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectCredential.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectCredentialType.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectRelationship.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectRelationshipName.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectRelationshipType.hbm.xml");
+ mappings.add(prefix + "HibernateIdentityObjectType.hbm.xml");
+ mappings.add(prefix + "HibernateRealm.hbm.xml");
+
+ hibernateSupport.setMappings(mappings);
+
+ hibernateSupport.start();
+
+
+ }
+
+ public void stop() throws Exception
+ {
+ hibernateSupport.getSessionFactory().getStatistics().logSummary();
+ hibernateSupport.stop();
+ dataSourceSupport.stop();
+ connectionManagerSupport.stop();
+ transactonManagerSupport.stop();
+ jndiSupport.stop();
+
+
+ }
+
+ public void overrideFromProperties() throws Exception
+ {
+ String dsName = System.getProperties().getProperty("dataSourceName");
+
+ if (dsName != null && !dsName.startsWith("$"))
+ {
+ setDataSourceName(dsName);
+ }
+
+ }
+
+ public SessionFactory getSessionFactory()
+ {
+ return getHibernateSupport().getSessionFactory();
+ }
+
+ public void setDataSourceName(String dataSourceName)
+ {
+ this.dataSourceName = dataSourceName;
+ }
+
+ public void setHibernateConfig(String hibernateConfig)
+ {
+ this.hibernateConfig = hibernateConfig;
+ }
+
+ public void setDatasources(String datasources)
+ {
+ this.datasources = datasources;
+ }
+
+ public void setIdentityConfig(String identityConfig)
+ {
+ this.identityConfig = identityConfig;
+ }
+
+ public void setRealmName(String realmName)
+ {
+ this.realmName = realmName;
+ }
+
+ public String getDataSourceName()
+ {
+ return dataSourceName;
+ }
+
+ public String getHibernateConfig()
+ {
+ return hibernateConfig;
+ }
+
+ public String getDatasources()
+ {
+ return datasources;
+ }
+
+ public String getIdentityConfig()
+ {
+ return identityConfig;
+ }
+
+ public String getRealmName()
+ {
+ return realmName;
+ }
+
+ public HibernateSupport getHibernateSupport()
+ {
+ return hibernateSupport;
+ }
+
+ public void begin()
+ {
+ getHibernateSupport().openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(getHibernateSupport().commitTransaction());
+ }
+
+
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,213 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl;
-
-import org.jboss.identity.idm.opends.OpenDSService;
-import org.jboss.portal.test.framework.embedded.DSConfig;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-
-import java.net.URL;
-import java.util.Hashtable;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.directory.DirContext;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.ldap.LdapContext;
-
-import org.opends.server.tools.LDAPModify;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPTestPOJO extends IdentityTestPOJO
-{
-
- private String EMBEDDED_OPEN_DS_DIRECTORY_NAME = "EmbeddedOpenDS";
-
- protected DSConfig directoryConfig;
-
- private String directories = "datasources/directories.xml";
-
- //By default use embedded OpenDS
- private String directoryName = EMBEDDED_OPEN_DS_DIRECTORY_NAME;
-
- public static Hashtable<String,String> env = new Hashtable<String,String>();
-
- OpenDSService openDSService = new OpenDSService(null);
-
- @Override
- public void start() throws Exception
- {
-
- overrideFromProperties();
-
- directoryConfig = DSConfig.obtainConfig(directories, directoryName);
-
- identityConfig = directoryConfig.getConfigFile();
-
- super.start();
-
- env.put(Context.INITIAL_CONTEXT_FACTORY, directoryConfig.getContextFactory());
- //Use description to store URL to be able to prefix with "ldaps://"
- env.put(Context.PROVIDER_URL, directoryConfig.getDescription());
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, directoryConfig.getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS, directoryConfig.getAdminPassword());
-
- if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
- {
- openDSService.start();
- }
- }
-
- @Override
- public void stop() throws Exception
- {
- cleanUp(new InitialLdapContext(env, null));
-
- super.stop();
-
- if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
- {
- openDSService.stop();
- }
-
- }
-
- public void overrideFromProperties() throws Exception
- {
- super.overrideFromProperties();
-
- String dirName = System.getProperties().getProperty("directoryName");
-
- if (dirName != null && !dirName.startsWith("$"))
- {
- setDirectoryName(dirName);
- }
-
- String trustStorePath = System.getProperties().getProperty("trustStorePath");
-
- if (trustStorePath != null && !trustStorePath.startsWith("$"))
- {
- System.setProperty("javax.net.ssl.trustStore", trustStorePath);
- }
-
- String trustStorePassword = System.getProperties().getProperty("trustStorePassword");
-
- if (trustStorePassword != null && !trustStorePassword.startsWith("$"))
- {
- System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
- }
-
- }
-
- @Parameter
- public void setDirectoryName(String directoryName)
- {
- this.directoryName = directoryName;
- }
-
- public String getDirectoryName()
- {
- return directoryName;
- }
-
-// public void populate() throws Exception
-// {
-// populateLDIF("ldap/initial-opends.ldif");
-// }
-
- public void populateClean() throws Exception
- {
- populateLDIF(directoryConfig.getPopulateLdif());
- }
-
- public void populateLDIF(String ldif) throws Exception
- {
-
- URL ldifURL = Thread.currentThread().getContextClassLoader().getResource(ldif);
-
- System.out.println("LDIF: " + ldifURL.toURI().getPath());
-
- String[] cmd = new String[] {"-h", directoryConfig.getHost(),
- "-p", directoryConfig.getPort(),
- "-D", directoryConfig.getAdminDN(),
- "-w", directoryConfig.getAdminPassword(),
- "-a", "-f", ldifURL.toURI().getPath()};
-
- //Not sure why... but it actually does make a difference...
- if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
- {
- System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
- }
- else
- {
- System.out.println("Populate success: " + (LDAPModify.mainModify(cmd) == 0));
- }
- }
-
- protected void cleanUp(DirContext ldapCtx) throws Exception
- {
- try
- {
- String dn = directoryConfig.getCleanUpDN();
-
- System.out.println("Removing: " + dn);
-
- removeContext(ldapCtx, dn);
- }
- catch (Exception e)
- {
- //
- }
- }
-
- //subsequent remove of javax.naming.Context
- protected void removeContext(Context mainCtx, String name) throws Exception
- {
- Context deleteCtx = (Context)mainCtx.lookup(name);
- NamingEnumeration subDirs = mainCtx.listBindings(name);
-
- while (subDirs.hasMoreElements())
- {
- Binding binding = (Binding)subDirs.nextElement();
- String subName = binding.getName();
-
- removeContext(deleteCtx, subName);
- }
-
- mainCtx.unbind(name);
- }
-
-
- public LdapContext getLdapContext() throws Exception
- {
- return new InitialLdapContext(env, null);
- }
-
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/LDAPTestPOJO.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/LDAPTestPOJO.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,213 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl;
+
+import org.picketlink.idm.opends.OpenDSService;
+import org.jboss.portal.test.framework.embedded.DSConfig;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+
+import java.net.URL;
+import java.util.Hashtable;
+
+import javax.naming.Binding;
+import javax.naming.Context;
+import javax.naming.NamingEnumeration;
+import javax.naming.directory.DirContext;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+
+import org.opends.server.tools.LDAPModify;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPTestPOJO extends IdentityTestPOJO
+{
+
+ private String EMBEDDED_OPEN_DS_DIRECTORY_NAME = "EmbeddedOpenDS";
+
+ protected DSConfig directoryConfig;
+
+ private String directories = "datasources/directories.xml";
+
+ //By default use embedded OpenDS
+ private String directoryName = EMBEDDED_OPEN_DS_DIRECTORY_NAME;
+
+ public static Hashtable<String,String> env = new Hashtable<String,String>();
+
+ OpenDSService openDSService = new OpenDSService(null);
+
+ @Override
+ public void start() throws Exception
+ {
+
+ overrideFromProperties();
+
+ directoryConfig = DSConfig.obtainConfig(directories, directoryName);
+
+ identityConfig = directoryConfig.getConfigFile();
+
+ super.start();
+
+ env.put(Context.INITIAL_CONTEXT_FACTORY, directoryConfig.getContextFactory());
+ //Use description to store URL to be able to prefix with "ldaps://"
+ env.put(Context.PROVIDER_URL, directoryConfig.getDescription());
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, directoryConfig.getAdminDN());
+ env.put(Context.SECURITY_CREDENTIALS, directoryConfig.getAdminPassword());
+
+ if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
+ {
+ openDSService.start();
+ }
+ }
+
+ @Override
+ public void stop() throws Exception
+ {
+ cleanUp(new InitialLdapContext(env, null));
+
+ super.stop();
+
+ if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
+ {
+ openDSService.stop();
+ }
+
+ }
+
+ public void overrideFromProperties() throws Exception
+ {
+ super.overrideFromProperties();
+
+ String dirName = System.getProperties().getProperty("directoryName");
+
+ if (dirName != null && !dirName.startsWith("$"))
+ {
+ setDirectoryName(dirName);
+ }
+
+ String trustStorePath = System.getProperties().getProperty("trustStorePath");
+
+ if (trustStorePath != null && !trustStorePath.startsWith("$"))
+ {
+ System.setProperty("javax.net.ssl.trustStore", trustStorePath);
+ }
+
+ String trustStorePassword = System.getProperties().getProperty("trustStorePassword");
+
+ if (trustStorePassword != null && !trustStorePassword.startsWith("$"))
+ {
+ System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
+ }
+
+ }
+
+ @Parameter
+ public void setDirectoryName(String directoryName)
+ {
+ this.directoryName = directoryName;
+ }
+
+ public String getDirectoryName()
+ {
+ return directoryName;
+ }
+
+// public void populate() throws Exception
+// {
+// populateLDIF("ldap/initial-opends.ldif");
+// }
+
+ public void populateClean() throws Exception
+ {
+ populateLDIF(directoryConfig.getPopulateLdif());
+ }
+
+ public void populateLDIF(String ldif) throws Exception
+ {
+
+ URL ldifURL = Thread.currentThread().getContextClassLoader().getResource(ldif);
+
+ System.out.println("LDIF: " + ldifURL.toURI().getPath());
+
+ String[] cmd = new String[] {"-h", directoryConfig.getHost(),
+ "-p", directoryConfig.getPort(),
+ "-D", directoryConfig.getAdminDN(),
+ "-w", directoryConfig.getAdminPassword(),
+ "-a", "-f", ldifURL.toURI().getPath()};
+
+ //Not sure why... but it actually does make a difference...
+ if (directoryName.equals(EMBEDDED_OPEN_DS_DIRECTORY_NAME))
+ {
+ System.out.println("Populate success: " + (LDAPModify.mainModify(cmd, false, System.out, System.err) == 0));
+ }
+ else
+ {
+ System.out.println("Populate success: " + (LDAPModify.mainModify(cmd) == 0));
+ }
+ }
+
+ protected void cleanUp(DirContext ldapCtx) throws Exception
+ {
+ try
+ {
+ String dn = directoryConfig.getCleanUpDN();
+
+ System.out.println("Removing: " + dn);
+
+ removeContext(ldapCtx, dn);
+ }
+ catch (Exception e)
+ {
+ //
+ }
+ }
+
+ //subsequent remove of javax.naming.Context
+ protected void removeContext(Context mainCtx, String name) throws Exception
+ {
+ Context deleteCtx = (Context)mainCtx.lookup(name);
+ NamingEnumeration subDirs = mainCtx.listBindings(name);
+
+ while (subDirs.hasMoreElements())
+ {
+ Binding binding = (Binding)subDirs.nextElement();
+ String subName = binding.getName();
+
+ removeContext(deleteCtx, subName);
+ }
+
+ mainCtx.unbind(name);
+ }
+
+
+ public LdapContext getLdapContext() throws Exception
+ {
+ return new InitialLdapContext(env, null);
+ }
+
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,129 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class APILDAPTestCase extends LDAPTestPOJO implements APITestContext
-{
-
- PersistenceManagerTest persistenceManagerTest;
-
- RelationshipManagerTest relationshipManagerTest;
-
- RoleManagerTest roleManagerTest;
-
- UserQueryTest userQueryTest;
-
- GroupQueryTest groupQueryTest;
-
- RoleQueryTest roleQueryTest;
-
- IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
- persistenceManagerTest = new PersistenceManagerTest(this);
- relationshipManagerTest = new RelationshipManagerTest(this);
- roleManagerTest = new RoleManagerTest(this);
-
- userQueryTest = new UserQueryTest(this);
- groupQueryTest = new GroupQueryTest(this);
- roleQueryTest = new RoleQueryTest(this);
-
- setRealmName("realm://RedHat/DB_LDAP");
-
- populateClean();
-
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- persistenceManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManager() throws Exception
- {
- relationshipManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerCascade() throws Exception
- {
- relationshipManagerTest.testCascade(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerMergedRoleAssociations() throws Exception
- {
- relationshipManagerTest.testMergedRoleAssociations(getRealmName());
- }
-
- @Test
- public void testRoleManager() throws Exception
- {
- roleManagerTest.testMethods(getRealmName());
- }
-
- public void testUserQuery() throws Exception
- {
- userQueryTest.testQuery(getRealmName());
- }
-
- public void testGroupQuery() throws Exception
- {
- groupQueryTest.testQuery(getRealmName());
- }
-
- public void testRoleQuery() throws Exception
- {
- roleQueryTest.testQuery(getRealmName());
- }
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APILDAPTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APILDAPTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,129 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.impl.LDAPTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class APILDAPTestCase extends LDAPTestPOJO implements APITestContext
+{
+
+ PersistenceManagerTest persistenceManagerTest;
+
+ RelationshipManagerTest relationshipManagerTest;
+
+ RoleManagerTest roleManagerTest;
+
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
+ IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ persistenceManagerTest = new PersistenceManagerTest(this);
+ relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
+
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
+ setRealmName("realm://RedHat/DB_LDAP");
+
+ populateClean();
+
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ persistenceManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManager() throws Exception
+ {
+ relationshipManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerCascade() throws Exception
+ {
+ relationshipManagerTest.testCascade(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ relationshipManagerTest.testMergedRoleAssociations(getRealmName());
+ }
+
+ @Test
+ public void testRoleManager() throws Exception
+ {
+ roleManagerTest.testMethods(getRealmName());
+ }
+
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,131 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class APITestCase extends IdentityTestPOJO implements APITestContext
-{
-
- PersistenceManagerTest persistenceManagerTest;
-
- RelationshipManagerTest relationshipManagerTest;
-
- RoleManagerTest roleManagerTest;
-
- UserQueryTest userQueryTest;
-
- GroupQueryTest groupQueryTest;
-
- RoleQueryTest roleQueryTest;
-
- IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
- persistenceManagerTest = new PersistenceManagerTest(this);
- relationshipManagerTest = new RelationshipManagerTest(this);
- roleManagerTest = new RoleManagerTest(this);
-
- userQueryTest = new UserQueryTest(this);
- groupQueryTest = new GroupQueryTest(this);
- roleQueryTest = new RoleQueryTest(this);
-
- setRealmName("realm://RedHat/DB");
-
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- persistenceManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManager() throws Exception
- {
- relationshipManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerCascade() throws Exception
- {
- relationshipManagerTest.testCascade(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerMergedRoleAssociations() throws Exception
- {
- relationshipManagerTest.testMergedRoleAssociations(getRealmName());
- }
-
- @Test
- public void testRoleManager() throws Exception
- {
- roleManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testUserQuery() throws Exception
- {
- userQueryTest.testQuery(getRealmName());
- }
-
- @Test
- public void testGroupQuery() throws Exception
- {
- groupQueryTest.testQuery(getRealmName());
- }
-
- @Test
- public void testRoleQuery() throws Exception
- {
- roleQueryTest.testQuery(getRealmName());
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,131 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class APITestCase extends IdentityTestPOJO implements APITestContext
+{
+
+ PersistenceManagerTest persistenceManagerTest;
+
+ RelationshipManagerTest relationshipManagerTest;
+
+ RoleManagerTest roleManagerTest;
+
+ UserQueryTest userQueryTest;
+
+ GroupQueryTest groupQueryTest;
+
+ RoleQueryTest roleQueryTest;
+
+ IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ persistenceManagerTest = new PersistenceManagerTest(this);
+ relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
+
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
+ setRealmName("realm://RedHat/DB");
+
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ persistenceManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManager() throws Exception
+ {
+ relationshipManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerCascade() throws Exception
+ {
+ relationshipManagerTest.testCascade(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ relationshipManagerTest.testMergedRoleAssociations(getRealmName());
+ }
+
+ @Test
+ public void testRoleManager() throws Exception
+ {
+ roleManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,41 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public interface APITestContext
-{
-
-
- IdentitySessionFactory getIdentitySessionFactory();
-
- void begin();
-
- void commit();
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/APITestContext.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/APITestContext.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,41 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySessionFactory;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface APITestContext
+{
+
+
+ IdentitySessionFactory getIdentitySessionFactory();
+
+ void begin();
+
+ void commit();
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,128 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.query.GroupQueryBuilder;
-import junit.framework.Assert;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class GroupQueryTest extends Assert
-{
- private APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- private String DEPARTMENT = "DEPARTMENT";
-
- public GroupQueryTest(APITestContext testContext)
- {
- this.ctx = testContext;
- }
-
- public void testQuery(String realmName) throws Exception
- {
- ctx.begin();
-
- IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
-
- // Create stuff
-
- User user1 = ids.getPersistenceManager().createUser("user1");
- User user2 = ids.getPersistenceManager().createUser("user2");
- User user3 = ids.getPersistenceManager().createUser("user3");
- User user4 = ids.getPersistenceManager().createUser("user4");
-
- Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
- ids.getRelationshipManager().associateUser(group1, user1);
- ids.getRelationshipManager().associateUser(group1, user2);
- ids.getRelationshipManager().associateUser(group2, user3);
- ids.getRelationshipManager().associateGroups(group2, group3);
-
- RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
- RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
- RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
- RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
-
- Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
- Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
-
- // Assertions
-
- GroupQueryBuilder qb = ids.createGroupQueryBuilder();
-
- qb.addAssociatedUser(user1);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
- assertEquals(group1, ids.uniqueResult(qb.createQuery()));
-
- //
- qb.reset();
-
- qb.addAssociatedUser(user1);
- qb.addAssociatedUser(user2);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedUser(user1);
- qb.addRelatedUser(user2);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedUser(user1);
- qb.addRelatedUser(user4);
-
- assertEquals(0, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedUser(user3);
- qb.addAssociatedGroup(group3, false);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
- assertEquals(group2, ids.uniqueResult(qb.createQuery()));
-
-
- ctx.commit();
- }
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupQueryTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,128 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.Role;
+import org.picketlink.idm.api.query.GroupQueryBuilder;
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class GroupQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public GroupQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create stuff
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+ ids.getRelationshipManager().associateUser(group2, user3);
+ ids.getRelationshipManager().associateGroups(group2, group3);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
+
+ // Assertions
+
+ GroupQueryBuilder qb = ids.createGroupQueryBuilder();
+
+ qb.addAssociatedUser(user1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addAssociatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user1);
+ qb.addRelatedUser(user4);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedUser(user3);
+ qb.addAssociatedGroup(group3, false);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(group2, ids.uniqueResult(qb.createQuery()));
+
+
+ ctx.commit();
+ }
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,48 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-
-package org.jboss.identity.idm.impl.api;
-
-
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public enum GroupTypeEnum
-{
- ADMINISTRATION,
- ORGANIZATION,
- DIVISION,
- DEPARTMENT,
- PROJECT,
- SECURITY,
- COMMUNITY,
- OFFICE,
- CUSTOM;
-
- public String getName()
- {
- return this.name();
- }
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/GroupTypeEnum.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/GroupTypeEnum.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,48 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+
+package org.picketlink.idm.impl.api;
+
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum GroupTypeEnum
+{
+ ADMINISTRATION,
+ ORGANIZATION,
+ DIVISION,
+ DEPARTMENT,
+ PROJECT,
+ SECURITY,
+ COMMUNITY,
+ OFFICE,
+ CUSTOM;
+
+ public String getName()
+ {
+ return this.name();
+ }
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/MinimalFlexibleConfigTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,150 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class MinimalFlexibleConfigTestCase extends IdentityTestPOJO implements APITestContext
-{
- private OrganizationTest orgTest;
-
- private PersistenceManagerTest persistenceManagerTest;
-
- private RelationshipManagerTest relationshipManagerTest;
-
- private RoleManagerTest roleManagerTest;
-
- private UserQueryTest userQueryTest;
-
- private GroupQueryTest groupQueryTest;
-
- private RoleQueryTest roleQueryTest;
-
- private IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void setUp() throws Exception
- {
- setIdentityConfig("minimal-flexible-identity-config.xml");
- setRealmName("realm://FlexibleRealm");
-
- super.start();
-
- orgTest = new OrganizationTest(this);
-
- persistenceManagerTest = new PersistenceManagerTest(this);
- relationshipManagerTest = new RelationshipManagerTest(this);
- roleManagerTest = new RoleManagerTest(this);
-
- userQueryTest = new UserQueryTest(this);
- groupQueryTest = new GroupQueryTest(this);
- roleQueryTest = new RoleQueryTest(this);
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testOrganization() throws Exception
- {
-
- orgTest.testRedHatOrganization(getRealmName());
- }
-
- @Test
- public void testSamplePortal() throws Exception
- {
-
- orgTest.testSamplePortal(getRealmName());
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- persistenceManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManager() throws Exception
- {
- relationshipManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerCascade() throws Exception
- {
- relationshipManagerTest.testCascade(getRealmName());
- }
-
- @Test
- public void testRelationshipManagerMergedRoleAssociations() throws Exception
- {
- relationshipManagerTest.testMergedRoleAssociations(getRealmName());
- }
-
- @Test
- public void testRoleManager() throws Exception
- {
- roleManagerTest.testMethods(getRealmName());
- }
-
- @Test
- public void testUserQuery() throws Exception
- {
- userQueryTest.testQuery(getRealmName());
- }
-
- @Test
- public void testGroupQuery() throws Exception
- {
- groupQueryTest.testQuery(getRealmName());
- }
-
- @Test
- public void testRoleQuery() throws Exception
- {
- roleQueryTest.testQuery(getRealmName());
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/MinimalFlexibleConfigTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/MinimalFlexibleConfigTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,150 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class MinimalFlexibleConfigTestCase extends IdentityTestPOJO implements APITestContext
+{
+ private OrganizationTest orgTest;
+
+ private PersistenceManagerTest persistenceManagerTest;
+
+ private RelationshipManagerTest relationshipManagerTest;
+
+ private RoleManagerTest roleManagerTest;
+
+ private UserQueryTest userQueryTest;
+
+ private GroupQueryTest groupQueryTest;
+
+ private RoleQueryTest roleQueryTest;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ setIdentityConfig("minimal-flexible-identity-config.xml");
+ setRealmName("realm://FlexibleRealm");
+
+ super.start();
+
+ orgTest = new OrganizationTest(this);
+
+ persistenceManagerTest = new PersistenceManagerTest(this);
+ relationshipManagerTest = new RelationshipManagerTest(this);
+ roleManagerTest = new RoleManagerTest(this);
+
+ userQueryTest = new UserQueryTest(this);
+ groupQueryTest = new GroupQueryTest(this);
+ roleQueryTest = new RoleQueryTest(this);
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testOrganization() throws Exception
+ {
+
+ orgTest.testRedHatOrganization(getRealmName());
+ }
+
+ @Test
+ public void testSamplePortal() throws Exception
+ {
+
+ orgTest.testSamplePortal(getRealmName());
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ persistenceManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManager() throws Exception
+ {
+ relationshipManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerCascade() throws Exception
+ {
+ relationshipManagerTest.testCascade(getRealmName());
+ }
+
+ @Test
+ public void testRelationshipManagerMergedRoleAssociations() throws Exception
+ {
+ relationshipManagerTest.testMergedRoleAssociations(getRealmName());
+ }
+
+ @Test
+ public void testRoleManager() throws Exception
+ {
+ roleManagerTest.testMethods(getRealmName());
+ }
+
+ @Test
+ public void testUserQuery() throws Exception
+ {
+ userQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testGroupQuery() throws Exception
+ {
+ groupQueryTest.testQuery(getRealmName());
+ }
+
+ @Test
+ public void testRoleQuery() throws Exception
+ {
+ roleQueryTest.testQuery(getRealmName());
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,49 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import junit.framework.TestCase;
-import org.jboss.identity.idm.impl.api.model.GroupKey;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class ModelTestCase extends TestCase
-{
-
- public void testGroupId() throws Exception
- {
-
- GroupKey key = new GroupKey(GroupKey.PREFIX + GroupKey.SEPARATOR + "groupTypeName" + GroupKey.SEPARATOR + "groupName");
- assertEquals("groupName", key.getName());
- assertEquals("groupTypeName", key.getType());
-
- key = new GroupKey("groupName", "groupTypeName");
- assertEquals("groupName", key.getName());
- assertEquals("groupTypeName", key.getType());
-
- }
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/ModelTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/ModelTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,49 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import junit.framework.TestCase;
+import org.picketlink.idm.impl.api.model.GroupKey;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class ModelTestCase extends TestCase
+{
+
+ public void testGroupId() throws Exception
+ {
+
+ GroupKey key = new GroupKey(GroupKey.PREFIX + GroupKey.SEPARATOR + "groupTypeName" + GroupKey.SEPARATOR + "groupName");
+ assertEquals("groupName", key.getName());
+ assertEquals("groupTypeName", key.getType());
+
+ key = new GroupKey("groupName", "groupTypeName");
+ assertEquals("groupName", key.getName());
+ assertEquals("groupTypeName", key.getType());
+
+ }
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,108 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class OrganizationLDAPTestCase extends LDAPTestPOJO implements APITestContext
-{
- private OrganizationTest orgTest;
-
- private IdentitySessionFactory identitySessionFactory;
-
- private String samplePortalRealmName = "realm://portal/SamplePortal/DB_LDAP";
-
- private String sampleOrganizationRealmName = "realm://RedHat/DB_LDAP";
-
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
-
- orgTest = new OrganizationTest(this);
-
- populateClean();
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testOrganization() throws Exception
- {
-
- orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
- }
-
- @Test
- public void testSamplePortal() throws Exception
- {
-
- orgTest.testSamplePortal(getSamplePortalRealmName());
-
- }
-
- public String getSamplePortalRealmName()
- {
- return samplePortalRealmName;
- }
-
- @Parameter
- public void setSamplePortalRealmName(String samplePortalRealmName)
- {
- this.samplePortalRealmName = samplePortalRealmName;
- }
-
- public String getSampleOrganizationRealmName()
- {
- return sampleOrganizationRealmName;
- }
-
- @Parameter
- public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
- {
- this.sampleOrganizationRealmName = sampleOrganizationRealmName;
- }
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationLDAPTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationLDAPTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,108 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.impl.LDAPTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationLDAPTestCase extends LDAPTestPOJO implements APITestContext
+{
+ private OrganizationTest orgTest;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ private String samplePortalRealmName = "realm://portal/SamplePortal/DB_LDAP";
+
+ private String sampleOrganizationRealmName = "realm://RedHat/DB_LDAP";
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ orgTest = new OrganizationTest(this);
+
+ populateClean();
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testOrganization() throws Exception
+ {
+
+ orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
+ }
+
+ @Test
+ public void testSamplePortal() throws Exception
+ {
+
+ orgTest.testSamplePortal(getSamplePortalRealmName());
+
+ }
+
+ public String getSamplePortalRealmName()
+ {
+ return samplePortalRealmName;
+ }
+
+ @Parameter
+ public void setSamplePortalRealmName(String samplePortalRealmName)
+ {
+ this.samplePortalRealmName = samplePortalRealmName;
+ }
+
+ public String getSampleOrganizationRealmName()
+ {
+ return sampleOrganizationRealmName;
+ }
+
+ @Parameter
+ public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
+ {
+ this.sampleOrganizationRealmName = sampleOrganizationRealmName;
+ }
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,653 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.Attribute;
-import org.jboss.identity.idm.api.AttributeDescription;
-import org.jboss.identity.idm.api.Credential;
-import org.jboss.identity.idm.common.p3p.P3PConstants;
-import org.jboss.identity.idm.common.exception.IdentityException;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.Random;
-import java.util.Arrays;
-
-import junit.framework.Assert;
-
-/**
- * Abstract test mapping real life structures using the API
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class OrganizationTest extends Assert
-{
- APITestContext ctx;
-
- public OrganizationTest(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public void setCtx(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public APITestContext getCtx()
- {
- return ctx;
- }
-
- public void testRedHatOrganization(String realmName) throws Exception
- {
- // GroupType
-
- String ORGANIZATION = "ORGANIZATION";
- String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- String DIVISION = "DIVISION";
- String DEPARTMENT = "DEPARTMENT";
- String PROJECT = "PROJECT";
- String PEOPLE = "PEOPLE";
-
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- //ctx.begin();
-
- ctx.begin();
-
- // Organization structure
-
- Group rhOrg = session.getPersistenceManager().createGroup("RedHat", ORGANIZATION);
-
- Group jbossDivision = session.getPersistenceManager().createGroup("JBoss", DIVISION);
- Group rhelDivision = session.getPersistenceManager().createGroup("RHEL", DIVISION);
-
- session.getRelationshipManager().associateGroups(rhOrg, jbossDivision);
- session.getRelationshipManager().associateGroups(rhOrg, rhelDivision);
-
- Group itDepartment = session.getPersistenceManager().createGroup("IT", DEPARTMENT);
- Group hrDepartment = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
-
- session.getRelationshipManager().associateGroups(jbossDivision, itDepartment);
- session.getRelationshipManager().associateGroups(jbossDivision, hrDepartment);
-
- Group rndDepartment = session.getPersistenceManager().createGroup("RnD", DEPARTMENT);
-
- session.getRelationshipManager().associateGroups(itDepartment, rndDepartment);
-
- Group projectsOU = session.getPersistenceManager().createGroup("Projects", ORGANIZATION_UNIT);
- Group commonFrameworksOU = session.getPersistenceManager().createGroup("Common Frameworks", ORGANIZATION_UNIT);
-
- session.getRelationshipManager().associateGroups(rndDepartment, projectsOU);
-
- // Projects
-
- Group portalProject = session.getPersistenceManager().createGroup("Portal", PROJECT);
- Group soaProject = session.getPersistenceManager().createGroup("SOA", PROJECT);
- Group jbpmProject = session.getPersistenceManager().createGroup("jBPM", PROJECT);
- Group seamProject = session.getPersistenceManager().createGroup("Seam", PROJECT);
- Group asProject = session.getPersistenceManager().createGroup("AS", PROJECT);
- Group securityProject = session.getPersistenceManager().createGroup("Security", PROJECT);
-
- session.getRelationshipManager().associateGroups(projectsOU, portalProject);
- session.getRelationshipManager().associateGroups(projectsOU, soaProject);
- session.getRelationshipManager().associateGroups(projectsOU, jbpmProject);
- session.getRelationshipManager().associateGroups(projectsOU, asProject);
- session.getRelationshipManager().associateGroups(projectsOU, seamProject);
-
- // Check...
- assertTrue(session.getRelationshipManager().isAssociated(projectsOU, portalProject));
- assertTrue(session.getRelationshipManager().isAssociated(projectsOU, soaProject));
- assertTrue(session.getRelationshipManager().isAssociated(projectsOU, jbpmProject));
- assertTrue(session.getRelationshipManager().isAssociated(projectsOU, asProject));
- assertTrue(session.getRelationshipManager().isAssociated(projectsOU, seamProject));
-
- // Portal is part of common frameworks
- session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
-
- // People
-
- Group employeesGroup = session.getPersistenceManager().createGroup("Employees", PEOPLE);
-
- // Management
-
- User theuteUser = session.getPersistenceManager().createUser("theute");
- User mlittleUser = session.getPersistenceManager().createUser("mlittle");
- User bgeorgesUser = session.getPersistenceManager().createUser("bgeorges");
- User asaldhanaUser = session.getPersistenceManager().createUser("asaldhana");
- User janderseUser = session.getPersistenceManager().createUser("janderse");
-
- // Portal Team
-
- User bdawidowUser = session.getPersistenceManager().createUser("bdawidow");
- User claprunUser = session.getPersistenceManager().createUser("claprun");
- User whalesUser = session.getPersistenceManager().createUser("whales");
- User sshahUser = session.getPersistenceManager().createUser("sshah");
- User mwringeUser = session.getPersistenceManager().createUser("mwringe");
-
- // Store as employees
-
- session.getRelationshipManager().associateUser(employeesGroup, theuteUser);
- session.getRelationshipManager().associateUser(employeesGroup, mlittleUser);
- session.getRelationshipManager().associateUser(employeesGroup, asaldhanaUser);
- session.getRelationshipManager().associateUser(employeesGroup, bdawidowUser);
- session.getRelationshipManager().associateUser(employeesGroup, claprunUser);
- session.getRelationshipManager().associateUser(employeesGroup, whalesUser);
- session.getRelationshipManager().associateUser(employeesGroup, sshahUser);
- session.getRelationshipManager().associateUser(employeesGroup, mwringeUser);
-
- // Portal team for management purposes
-
- Group portalTeamGroup = session.getPersistenceManager().createGroup("Portal Team", PEOPLE);
- session.getRelationshipManager().associateUser(portalTeamGroup, bdawidowUser);
- session.getRelationshipManager().associateUser(portalTeamGroup, claprunUser);
- session.getRelationshipManager().associateUser(portalTeamGroup, whalesUser);
- session.getRelationshipManager().associateUser(portalTeamGroup, sshahUser);
- session.getRelationshipManager().associateUser(portalTeamGroup, mwringeUser);
-
- // Portal team is under common frameworks
-
- session.getRelationshipManager().associateGroups(commonFrameworksOU, portalTeamGroup);
-
- // Role Types
-
- RoleType developerRT = session.getRoleManager().createRoleType("Developer");
- RoleType managerRT = session.getRoleManager().createRoleType("Manager");
- RoleType leadDeveloperRT = session.getRoleManager().createRoleType("Lead Developer");
- RoleType productManagerRT = session.getRoleManager().createRoleType("Product Manager");
-
- // Assign roles
-
- // Common frameworks manager
-
- session.getRoleManager().createRole(managerRT, bgeorgesUser, commonFrameworksOU);
-
- // Portal developers
-
- session.getRoleManager().createRole(developerRT, theuteUser, portalProject);
- session.getRoleManager().createRole(developerRT, bdawidowUser, portalProject);
- session.getRoleManager().createRole(developerRT, claprunUser, portalProject);
- session.getRoleManager().createRole(developerRT, whalesUser, portalProject);
- session.getRoleManager().createRole(developerRT, sshahUser, portalProject);
- session.getRoleManager().createRole(developerRT, mwringeUser, portalProject);
-
- // Portal management
- session.getRoleManager().createRole(leadDeveloperRT, theuteUser, portalProject);
- session.getRoleManager().createRole(managerRT, theuteUser, portalTeamGroup);
- session.getRoleManager().createRole(productManagerRT, janderseUser, portalProject);
-
- // SOA
-
- session.getRoleManager().createRole(developerRT, mlittleUser, portalProject);
- session.getRoleManager().createRole(productManagerRT, mlittleUser, portalProject);
-
- // AS & Security
-
- session.getRoleManager().createRole(developerRT, asaldhanaUser, asProject);
- session.getRoleManager().createRole(developerRT, asaldhanaUser, securityProject);
- session.getRoleManager().createRole(leadDeveloperRT, asaldhanaUser, securityProject);
-
-
- // Check what RoleTypes has user theute
- Collection<RoleType> roleTypes = session.getRoleManager().findUserRoleTypes(theuteUser);
- assertEquals(3, roleTypes.size());
- assertTrue(roleTypes.contains(developerRT));
- assertTrue(roleTypes.contains(leadDeveloperRT));
- assertTrue(roleTypes.contains(managerRT));
- assertFalse(roleTypes.contains(productManagerRT));
-
- assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, developerRT));
- assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, leadDeveloperRT));
- assertTrue(session.getRoleManager().hasRole(theuteUser, portalTeamGroup, managerRT));
-
- // Check where anil is Lead Developer and where Developer
-
- roleTypes = session.getRoleManager().findUserRoleTypes(asaldhanaUser);
- assertEquals(2, roleTypes.size());
- assertTrue(roleTypes.contains(developerRT));
- assertTrue(roleTypes.contains(leadDeveloperRT));
-
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject);
- assertEquals(2, roleTypes.size());
- assertTrue(roleTypes.contains(leadDeveloperRT));
-
- roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject);
- assertEquals(1, roleTypes.size());
- assertTrue(roleTypes.contains(developerRT));
-
- // and simpler...
- assertTrue(session.getRoleManager().hasRole(asaldhanaUser, asProject, developerRT));
-
- // Assert relationships
-
- Collection<User> identities = session.getRelationshipManager().findAssociatedUsers(portalTeamGroup, false);
- assertEquals(5, identities.size());
- assertTrue(identities.contains(claprunUser));
- assertTrue(identities.contains(mwringeUser));
- assertTrue(identities.contains(sshahUser));
- assertTrue(identities.contains(whalesUser));
- assertTrue(identities.contains(bdawidowUser));
-
- Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false);
- assertEquals(0, groups.size());
-
- // Check to which group Anil belongs
- groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE);
- assertEquals(1, groups.size());
- assertTrue(groups.contains(employeesGroup));
-
- // Now check sshah
- groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE);
- assertEquals(2, groups.size());
- assertTrue(groups.contains(employeesGroup));
- assertTrue(groups.contains(portalTeamGroup));
-
-
-
-
- // User attributes
- Attribute[] userInfo = new Attribute[]
- {
- new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"}),
- new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"}),
- //new SimpleAttribute("picture", new byte[][]{picture}),
- new SimpleAttribute("email", new String[]{"bd(a)example.com"})
- };
-
- session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
-
- Map<String, Attribute> attributes = session.getAttributesManager().getAttributes(bdawidowUser);
- assertEquals(3, attributes.keySet().size());
- assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
-
-
- // Generate random binary data for binary attribute
- Random random = new Random();
-
- // Check that binary attribute picture is mapped
- AttributeDescription attributeDescription = session.getAttributesManager().getAttributeDescription(bdawidowUser, "picture");
-
- if (attributeDescription != null && attributeDescription.getType().equals("binary"))
- {
-
- // 900 kilobytes
- byte[] picture = new byte[921600];
- random.nextBytes(picture);
-
- userInfo = new Attribute[]
- {
- new SimpleAttribute("picture", new byte[][]{picture}),
- };
-
-
- session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
-
- attributes = session.getAttributesManager().getAttributes(bdawidowUser);
- assertEquals(4, attributes.keySet().size());
- assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
- assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
- }
-
-
- // Find user by email
- assertNull(session.getAttributesManager().findUserByUniqueAttribute("email", "toto"));
- User user = session.getAttributesManager().findUserByUniqueAttribute("email", "bd(a)example.com");
- assertEquals(bdawidowUser, user);
-
-
- // If email is configured as unique it should not be possible to set same value for different user
-
- attributeDescription = session.getAttributesManager().getAttributeDescription(bdawidowUser, "email");
-
- if (attributeDescription != null && attributeDescription.isUnique())
- {
-
-
- // check if same unique email can be used for other user
- try
- {
- userInfo = new Attribute[]
- {
- new SimpleAttribute("email", new String[]{"bd(a)example.com"})
- };
-
- session.getAttributesManager().addAttributes(theuteUser, userInfo);
- fail();
- }
- catch (IdentityException e)
- {
- // expected
- }
- }
-
-
-
- // Credential
- User anotherOne = bdawidowUser; //session.getPersistenceManager().createUser("blah1");
-
- if (session.getAttributesManager().isCredentialTypeSupported(PasswordCredential.TYPE))
- {
-
- // There is a known issue that on some LDAP servers (MSAD at least) old password can
- // still be used for some time together with the new one. Because of this testsuite cannot
- // assert previously set password values
-
- // #1
- session.getAttributesManager().updatePassword(anotherOne, "Password2000");
- assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2001"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
-
- // #1
- session.getAttributesManager().updatePassword(anotherOne, "Password2002");
- assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2001"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "wirdPasswordValue"));
-// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2003"));
-
-
- // #1
- session.getAttributesManager().updatePassword(anotherOne, "Password2003");
- assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2003"));
-// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
-// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2005"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2006"));
- assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2007"));
-
-
- // #2
- Credential password = new PasswordCredential("SuperPassword2345");
- session.getAttributesManager().updateCredential(anotherOne, password);
- assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{password}));
-
- // #3
- }
-
- if (session.getAttributesManager().isCredentialTypeSupported(BinaryCredential.TYPE))
- {
- // 500 kilobytes
- byte[] cert = new byte[512000];
- random.nextBytes(cert);
- Credential binaryCredential = new BinaryCredential(cert);
- session.getAttributesManager().updateCredential(anotherOne, binaryCredential);
- assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{binaryCredential}));
- }
-
-
- ctx.commit();
-
- }
-
- public void testSamplePortal(String realmName) throws Exception
- {
- String SYSTEM = "SYSTEM";
- String ADMINISTRATION = "ADMINISTRATION";
- String COMMUNITY = "COMMUNITY";
- String ORGANIZATION = "ORGANIZATION";
- String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- String OFFICE = "OFFICE";
- String DIVISION = "DIVISION";
- String DEPARTMENT = "DEPARTMENT";
- String SECURITY = "SECURITY";
- String PEOPLE = "PEOPLE";
-
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- ctx.begin();
-
-
-
- // Create all role types
- RoleType adminRT = session.getRoleManager().createRoleType("Admin");
- RoleType accountAdminRT = session.getRoleManager().createRoleType("Account Admin");
- RoleType managerRT = session.getRoleManager().createRoleType("Manager");
- RoleType officeManagerRT = session.getRoleManager().createRoleType("Office Manager");
- RoleType contributorRT = session.getRoleManager().createRoleType("Contributor");
- RoleType communityOwnerRT = session.getRoleManager().createRoleType("Community Owner");
- RoleType communityMemberRT = session.getRoleManager().createRoleType("Community Member");
- RoleType communityForumModeratorRT = session.getRoleManager().createRoleType("Community Forum Moderator");
- RoleType communityCMSAdminRT = session.getRoleManager().createRoleType("Community CMS Admin");
-
-
- // Create system root groups - groups containing all communities, global security groups and organization
-
- Group communityRootGroup = session.getPersistenceManager().createGroup("COMMUNITY_ROOT", SYSTEM);
- Group securityRootGroup = session.getPersistenceManager().createGroup("SECURITY_ROOT", SYSTEM);
- Group organizationRootGroup = session.getPersistenceManager().createGroup("ORGANIZATION_ROOT",SYSTEM);
- Group usersROOTGroup = session.getPersistenceManager().createGroup("USERS_ROOT",SYSTEM);
-
- ctx.commit();
-
- ctx.begin();
-
- // Communities
-
- Group portalLoversCommunity = session.getPersistenceManager().createGroup("Portal Lovers", COMMUNITY);
- Group baseJumpingCommunity = session.getPersistenceManager().createGroup("BASE Jumping", COMMUNITY);
- Group geeksCommunity = session.getPersistenceManager().createGroup("Geeks", COMMUNITY);
-
- session.getRelationshipManager().associateGroups(communityRootGroup, portalLoversCommunity);
- session.getRelationshipManager().associateGroups(communityRootGroup, baseJumpingCommunity);
- session.getRelationshipManager().associateGroups(communityRootGroup, geeksCommunity);
-
- // Security groups - act like global portal roles
-
- Group portalAdminGroup = session.getPersistenceManager().createGroup("Poral Admin", SECURITY);
- Group cmsAdminGroup = session.getPersistenceManager().createGroup("CMS Admin", SECURITY);
- Group userAdminGroup = session.getPersistenceManager().createGroup("User Admin", SECURITY);
- Group cmsEditorGroup = session.getPersistenceManager().createGroup("CMS Editor", SECURITY);
-
- session.getRelationshipManager().associateGroups(securityRootGroup, portalAdminGroup);
- session.getRelationshipManager().associateGroups(securityRootGroup, cmsAdminGroup);
- session.getRelationshipManager().associateGroups(securityRootGroup, userAdminGroup);
- session.getRelationshipManager().associateGroups(securityRootGroup, cmsEditorGroup);
-
- // Organization structure
-
- Group acmeOrg = session.getPersistenceManager().createGroup("ACME", ORGANIZATION);
-
- session.getRelationshipManager().associateGroups(organizationRootGroup, acmeOrg);
-
- Group departmentsOU = session.getPersistenceManager().createGroup("Departments", ORGANIZATION_UNIT);
- Group officesOU = session.getPersistenceManager().createGroup("Offices", ORGANIZATION_UNIT);
- Group employeesOU = session.getPersistenceManager().createGroup("Employees", ORGANIZATION_UNIT);
-
- session.getRelationshipManager().associateGroups(acmeOrg, departmentsOU);
- session.getRelationshipManager().associateGroups(acmeOrg, officesOU);
- session.getRelationshipManager().associateGroups(acmeOrg, employeesOU);
-
- // Departments
-
- Group hrDepart = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
- Group financeDepart = session.getPersistenceManager().createGroup("Finance", DEPARTMENT);
- Group rndDepart = session.getPersistenceManager().createGroup("R&D", DEPARTMENT);
-
- session.getRelationshipManager().associateGroups(departmentsOU, hrDepart);
- session.getRelationshipManager().associateGroups(departmentsOU, financeDepart);
- session.getRelationshipManager().associateGroups(departmentsOU, rndDepart);
-
- // Offices
-
- Group parisOffice =session.getPersistenceManager().createGroup("Paris", OFFICE);
- Group londonOffice =session.getPersistenceManager().createGroup("London", OFFICE);
- Group nyOffice =session.getPersistenceManager().createGroup("New York", OFFICE);
-
- session.getRelationshipManager().associateGroups(officesOU, parisOffice);
- session.getRelationshipManager().associateGroups(officesOU, londonOffice);
- session.getRelationshipManager().associateGroups(officesOU, nyOffice);
-
- // People
-
- User anneUser = session.getPersistenceManager().createUser("anne");
- User marieUser = session.getPersistenceManager().createUser("marie");
- User eveUser = session.getPersistenceManager().createUser("eve");
- User angelinaUser = session.getPersistenceManager().createUser("angelina");
- User joannaUser = session.getPersistenceManager().createUser("joanna");
- User merilUser = session.getPersistenceManager().createUser("meril");
- User johnUser = session.getPersistenceManager().createUser("john");
- User stanUser = session.getPersistenceManager().createUser("stan");
- User chrisUser = session.getPersistenceManager().createUser("chris");
- User billUser = session.getPersistenceManager().createUser("bill");
- User jackUser = session.getPersistenceManager().createUser("jack");
-
- ctx.commit();
-
- ctx.begin();
-
- // All users are under people root
-
- session.getRelationshipManager().associateUser(usersROOTGroup, anneUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, marieUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, eveUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, angelinaUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, joannaUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, merilUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, johnUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, stanUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, chrisUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, billUser);
- session.getRelationshipManager().associateUser(usersROOTGroup, jackUser);
-
- ctx.commit();
-
- ctx.begin();
-
- //
-
-
- // Anna is...
-
- // Anna Smith...
-
-
- session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_GIVEN, "Anne");
- session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_FAMILY, "Smith");
- session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_JOB_TITLE, "Senior Software Developer");
- session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "anne.smith(a)acme.com");
- session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "777 777 777 7 77");
-
- // Anna works in Paris office and participates in BASE jumping community as a forum moderator and CMS admin
-
- session.getRelationshipManager().associateUser(parisOffice, anneUser);
-
- // Anne could be just associated with BASE jumping community group using RelationshipManager but insted Role mechanism
- // is used to have more fine grained control of access rights inside of a community
-
-
- session.save();
-
- ctx.commit();
-
- ctx.begin();
-
- session.getRoleManager().createRole(communityMemberRT, anneUser, baseJumpingCommunity);
- session.getRoleManager().createRole(communityForumModeratorRT, anneUser, baseJumpingCommunity);
- session.getRoleManager().createRole(communityCMSAdminRT, anneUser, baseJumpingCommunity);
-
- // Anne belongs to CMS portal admins security group
-
- session.getRelationshipManager().associateUser(cmsAdminGroup, anneUser);
-
- // Ann is also an owner of geeks community
-
- session.getRoleManager().createRole(communityOwnerRT, anneUser, geeksCommunity);
-
-
- //
-
-
- // Angelina ...
-
- session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_GIVEN, "Angelina");
- session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_FAMILY, "Blond");
- session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_JOB_TITLE, "Very important looking job title");
- session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "angelina1979(a)acme.com");
- session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "888 88 88 8888");
-
- // She works in London and is office manager there - se both RelationshipManager and RoleManager used against
- // the same pair of identity objects
-
- session.getRelationshipManager().associateUser(londonOffice, angelinaUser);
-
- session.getRoleManager().createRole(officeManagerRT, angelinaUser, londonOffice);
-
- // Angelina is member of geeks community and manages cms content there
-
- session.getRoleManager().createRole(communityMemberRT, angelinaUser, geeksCommunity);
- session.getRoleManager().createRole(communityCMSAdminRT, angelinaUser, geeksCommunity);
-
- // As office manager she also edits portal cms content
-
- session.getRelationshipManager().associateUser(cmsEditorGroup, angelinaUser);
-
-
- //
-
-
- // Some assertions
-
- // How many users do we have in whole acme org and how many people in paris and london offices
- assertEquals(11, session.getRelationshipManager().findAssociatedUsers(usersROOTGroup, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedUsers(parisOffice, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedUsers(londonOffice, false).size());
-
-
- // Is anne geeks community owner?
- assertTrue(session.getRoleManager().hasRole(anneUser, geeksCommunity, communityOwnerRT));
-
- // Does she belong to cms admins
- assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup, anneUser));
-
- // Check all groups that anna belongs to
- Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser);
- assertEquals(3, groups.size());
- assertTrue(groups.contains(usersROOTGroup));
- assertTrue(groups.contains(parisOffice));
- assertTrue(groups.contains(cmsAdminGroup));
-
-
-
- ctx.commit();
-
- }
-
-
-
-
-
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,653 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.Attribute;
+import org.picketlink.idm.api.AttributeDescription;
+import org.picketlink.idm.api.Credential;
+import org.picketlink.idm.common.p3p.P3PConstants;
+import org.picketlink.idm.common.exception.IdentityException;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Random;
+import java.util.Arrays;
+
+import junit.framework.Assert;
+
+/**
+ * Abstract test mapping real life structures using the API
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationTest extends Assert
+{
+ APITestContext ctx;
+
+ public OrganizationTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testRedHatOrganization(String realmName) throws Exception
+ {
+ // GroupType
+
+ String ORGANIZATION = "ORGANIZATION";
+ String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ String DIVISION = "DIVISION";
+ String DEPARTMENT = "DEPARTMENT";
+ String PROJECT = "PROJECT";
+ String PEOPLE = "PEOPLE";
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ //ctx.begin();
+
+ ctx.begin();
+
+ // Organization structure
+
+ Group rhOrg = session.getPersistenceManager().createGroup("RedHat", ORGANIZATION);
+
+ Group jbossDivision = session.getPersistenceManager().createGroup("JBoss", DIVISION);
+ Group rhelDivision = session.getPersistenceManager().createGroup("RHEL", DIVISION);
+
+ session.getRelationshipManager().associateGroups(rhOrg, jbossDivision);
+ session.getRelationshipManager().associateGroups(rhOrg, rhelDivision);
+
+ Group itDepartment = session.getPersistenceManager().createGroup("IT", DEPARTMENT);
+ Group hrDepartment = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(jbossDivision, itDepartment);
+ session.getRelationshipManager().associateGroups(jbossDivision, hrDepartment);
+
+ Group rndDepartment = session.getPersistenceManager().createGroup("RnD", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(itDepartment, rndDepartment);
+
+ Group projectsOU = session.getPersistenceManager().createGroup("Projects", ORGANIZATION_UNIT);
+ Group commonFrameworksOU = session.getPersistenceManager().createGroup("Common Frameworks", ORGANIZATION_UNIT);
+
+ session.getRelationshipManager().associateGroups(rndDepartment, projectsOU);
+
+ // Projects
+
+ Group portalProject = session.getPersistenceManager().createGroup("Portal", PROJECT);
+ Group soaProject = session.getPersistenceManager().createGroup("SOA", PROJECT);
+ Group jbpmProject = session.getPersistenceManager().createGroup("jBPM", PROJECT);
+ Group seamProject = session.getPersistenceManager().createGroup("Seam", PROJECT);
+ Group asProject = session.getPersistenceManager().createGroup("AS", PROJECT);
+ Group securityProject = session.getPersistenceManager().createGroup("Security", PROJECT);
+
+ session.getRelationshipManager().associateGroups(projectsOU, portalProject);
+ session.getRelationshipManager().associateGroups(projectsOU, soaProject);
+ session.getRelationshipManager().associateGroups(projectsOU, jbpmProject);
+ session.getRelationshipManager().associateGroups(projectsOU, asProject);
+ session.getRelationshipManager().associateGroups(projectsOU, seamProject);
+
+ // Check...
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, portalProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, soaProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, jbpmProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, asProject));
+ assertTrue(session.getRelationshipManager().isAssociated(projectsOU, seamProject));
+
+ // Portal is part of common frameworks
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
+
+ // People
+
+ Group employeesGroup = session.getPersistenceManager().createGroup("Employees", PEOPLE);
+
+ // Management
+
+ User theuteUser = session.getPersistenceManager().createUser("theute");
+ User mlittleUser = session.getPersistenceManager().createUser("mlittle");
+ User bgeorgesUser = session.getPersistenceManager().createUser("bgeorges");
+ User asaldhanaUser = session.getPersistenceManager().createUser("asaldhana");
+ User janderseUser = session.getPersistenceManager().createUser("janderse");
+
+ // Portal Team
+
+ User bdawidowUser = session.getPersistenceManager().createUser("bdawidow");
+ User claprunUser = session.getPersistenceManager().createUser("claprun");
+ User whalesUser = session.getPersistenceManager().createUser("whales");
+ User sshahUser = session.getPersistenceManager().createUser("sshah");
+ User mwringeUser = session.getPersistenceManager().createUser("mwringe");
+
+ // Store as employees
+
+ session.getRelationshipManager().associateUser(employeesGroup, theuteUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mlittleUser);
+ session.getRelationshipManager().associateUser(employeesGroup, asaldhanaUser);
+ session.getRelationshipManager().associateUser(employeesGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(employeesGroup, claprunUser);
+ session.getRelationshipManager().associateUser(employeesGroup, whalesUser);
+ session.getRelationshipManager().associateUser(employeesGroup, sshahUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mwringeUser);
+
+ // Portal team for management purposes
+
+ Group portalTeamGroup = session.getPersistenceManager().createGroup("Portal Team", PEOPLE);
+ session.getRelationshipManager().associateUser(portalTeamGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, claprunUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, whalesUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, sshahUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, mwringeUser);
+
+ // Portal team is under common frameworks
+
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalTeamGroup);
+
+ // Role Types
+
+ RoleType developerRT = session.getRoleManager().createRoleType("Developer");
+ RoleType managerRT = session.getRoleManager().createRoleType("Manager");
+ RoleType leadDeveloperRT = session.getRoleManager().createRoleType("Lead Developer");
+ RoleType productManagerRT = session.getRoleManager().createRoleType("Product Manager");
+
+ // Assign roles
+
+ // Common frameworks manager
+
+ session.getRoleManager().createRole(managerRT, bgeorgesUser, commonFrameworksOU);
+
+ // Portal developers
+
+ session.getRoleManager().createRole(developerRT, theuteUser, portalProject);
+ session.getRoleManager().createRole(developerRT, bdawidowUser, portalProject);
+ session.getRoleManager().createRole(developerRT, claprunUser, portalProject);
+ session.getRoleManager().createRole(developerRT, whalesUser, portalProject);
+ session.getRoleManager().createRole(developerRT, sshahUser, portalProject);
+ session.getRoleManager().createRole(developerRT, mwringeUser, portalProject);
+
+ // Portal management
+ session.getRoleManager().createRole(leadDeveloperRT, theuteUser, portalProject);
+ session.getRoleManager().createRole(managerRT, theuteUser, portalTeamGroup);
+ session.getRoleManager().createRole(productManagerRT, janderseUser, portalProject);
+
+ // SOA
+
+ session.getRoleManager().createRole(developerRT, mlittleUser, portalProject);
+ session.getRoleManager().createRole(productManagerRT, mlittleUser, portalProject);
+
+ // AS & Security
+
+ session.getRoleManager().createRole(developerRT, asaldhanaUser, asProject);
+ session.getRoleManager().createRole(developerRT, asaldhanaUser, securityProject);
+ session.getRoleManager().createRole(leadDeveloperRT, asaldhanaUser, securityProject);
+
+
+ // Check what RoleTypes has user theute
+ Collection<RoleType> roleTypes = session.getRoleManager().findUserRoleTypes(theuteUser);
+ assertEquals(3, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+ assertTrue(roleTypes.contains(managerRT));
+ assertFalse(roleTypes.contains(productManagerRT));
+
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, developerRT));
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, leadDeveloperRT));
+ assertTrue(session.getRoleManager().hasRole(theuteUser, portalTeamGroup, managerRT));
+
+ // Check where anil is Lead Developer and where Developer
+
+ roleTypes = session.getRoleManager().findUserRoleTypes(asaldhanaUser);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject);
+ assertEquals(1, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+
+ // and simpler...
+ assertTrue(session.getRoleManager().hasRole(asaldhanaUser, asProject, developerRT));
+
+ // Assert relationships
+
+ Collection<User> identities = session.getRelationshipManager().findAssociatedUsers(portalTeamGroup, false);
+ assertEquals(5, identities.size());
+ assertTrue(identities.contains(claprunUser));
+ assertTrue(identities.contains(mwringeUser));
+ assertTrue(identities.contains(sshahUser));
+ assertTrue(identities.contains(whalesUser));
+ assertTrue(identities.contains(bdawidowUser));
+
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false);
+ assertEquals(0, groups.size());
+
+ // Check to which group Anil belongs
+ groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE);
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+
+ // Now check sshah
+ groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE);
+ assertEquals(2, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+ assertTrue(groups.contains(portalTeamGroup));
+
+
+
+
+ // User attributes
+ Attribute[] userInfo = new Attribute[]
+ {
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"}),
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"}),
+ //new SimpleAttribute("picture", new byte[][]{picture}),
+ new SimpleAttribute("email", new String[]{"bd(a)example.com"})
+ };
+
+ session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
+
+ Map<String, Attribute> attributes = session.getAttributesManager().getAttributes(bdawidowUser);
+ assertEquals(3, attributes.keySet().size());
+ assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+
+
+ // Generate random binary data for binary attribute
+ Random random = new Random();
+
+ // Check that binary attribute picture is mapped
+ AttributeDescription attributeDescription = session.getAttributesManager().getAttributeDescription(bdawidowUser, "picture");
+
+ if (attributeDescription != null && attributeDescription.getType().equals("binary"))
+ {
+
+ // 900 kilobytes
+ byte[] picture = new byte[921600];
+ random.nextBytes(picture);
+
+ userInfo = new Attribute[]
+ {
+ new SimpleAttribute("picture", new byte[][]{picture}),
+ };
+
+
+ session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
+
+ attributes = session.getAttributesManager().getAttributes(bdawidowUser);
+ assertEquals(4, attributes.keySet().size());
+ assertEquals("Dawidowicz", (attributes.get(P3PConstants.INFO_USER_NAME_FAMILY)).getValue());
+ assertTrue(Arrays.equals((byte[])attributes.get("picture").getValue(), picture));
+ }
+
+
+ // Find user by email
+ assertNull(session.getAttributesManager().findUserByUniqueAttribute("email", "toto"));
+ User user = session.getAttributesManager().findUserByUniqueAttribute("email", "bd(a)example.com");
+ assertEquals(bdawidowUser, user);
+
+
+ // If email is configured as unique it should not be possible to set same value for different user
+
+ attributeDescription = session.getAttributesManager().getAttributeDescription(bdawidowUser, "email");
+
+ if (attributeDescription != null && attributeDescription.isUnique())
+ {
+
+
+ // check if same unique email can be used for other user
+ try
+ {
+ userInfo = new Attribute[]
+ {
+ new SimpleAttribute("email", new String[]{"bd(a)example.com"})
+ };
+
+ session.getAttributesManager().addAttributes(theuteUser, userInfo);
+ fail();
+ }
+ catch (IdentityException e)
+ {
+ // expected
+ }
+ }
+
+
+
+ // Credential
+ User anotherOne = bdawidowUser; //session.getPersistenceManager().createUser("blah1");
+
+ if (session.getAttributesManager().isCredentialTypeSupported(PasswordCredential.TYPE))
+ {
+
+ // There is a known issue that on some LDAP servers (MSAD at least) old password can
+ // still be used for some time together with the new one. Because of this testsuite cannot
+ // assert previously set password values
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "Password2000");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2001"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "Password2002");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2001"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "wirdPasswordValue"));
+// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2003"));
+
+
+ // #1
+ session.getAttributesManager().updatePassword(anotherOne, "Password2003");
+ assertTrue(session.getAttributesManager().validatePassword(anotherOne, "Password2003"));
+// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2000"));
+// assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2002"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2005"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2006"));
+ assertFalse(session.getAttributesManager().validatePassword(anotherOne, "Password2007"));
+
+
+ // #2
+ Credential password = new PasswordCredential("SuperPassword2345");
+ session.getAttributesManager().updateCredential(anotherOne, password);
+ assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{password}));
+
+ // #3
+ }
+
+ if (session.getAttributesManager().isCredentialTypeSupported(BinaryCredential.TYPE))
+ {
+ // 500 kilobytes
+ byte[] cert = new byte[512000];
+ random.nextBytes(cert);
+ Credential binaryCredential = new BinaryCredential(cert);
+ session.getAttributesManager().updateCredential(anotherOne, binaryCredential);
+ assertTrue(session.getAttributesManager().validateCredentials(anotherOne, new Credential[]{binaryCredential}));
+ }
+
+
+ ctx.commit();
+
+ }
+
+ public void testSamplePortal(String realmName) throws Exception
+ {
+ String SYSTEM = "SYSTEM";
+ String ADMINISTRATION = "ADMINISTRATION";
+ String COMMUNITY = "COMMUNITY";
+ String ORGANIZATION = "ORGANIZATION";
+ String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ String OFFICE = "OFFICE";
+ String DIVISION = "DIVISION";
+ String DEPARTMENT = "DEPARTMENT";
+ String SECURITY = "SECURITY";
+ String PEOPLE = "PEOPLE";
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+
+
+ // Create all role types
+ RoleType adminRT = session.getRoleManager().createRoleType("Admin");
+ RoleType accountAdminRT = session.getRoleManager().createRoleType("Account Admin");
+ RoleType managerRT = session.getRoleManager().createRoleType("Manager");
+ RoleType officeManagerRT = session.getRoleManager().createRoleType("Office Manager");
+ RoleType contributorRT = session.getRoleManager().createRoleType("Contributor");
+ RoleType communityOwnerRT = session.getRoleManager().createRoleType("Community Owner");
+ RoleType communityMemberRT = session.getRoleManager().createRoleType("Community Member");
+ RoleType communityForumModeratorRT = session.getRoleManager().createRoleType("Community Forum Moderator");
+ RoleType communityCMSAdminRT = session.getRoleManager().createRoleType("Community CMS Admin");
+
+
+ // Create system root groups - groups containing all communities, global security groups and organization
+
+ Group communityRootGroup = session.getPersistenceManager().createGroup("COMMUNITY_ROOT", SYSTEM);
+ Group securityRootGroup = session.getPersistenceManager().createGroup("SECURITY_ROOT", SYSTEM);
+ Group organizationRootGroup = session.getPersistenceManager().createGroup("ORGANIZATION_ROOT",SYSTEM);
+ Group usersROOTGroup = session.getPersistenceManager().createGroup("USERS_ROOT",SYSTEM);
+
+ ctx.commit();
+
+ ctx.begin();
+
+ // Communities
+
+ Group portalLoversCommunity = session.getPersistenceManager().createGroup("Portal Lovers", COMMUNITY);
+ Group baseJumpingCommunity = session.getPersistenceManager().createGroup("BASE Jumping", COMMUNITY);
+ Group geeksCommunity = session.getPersistenceManager().createGroup("Geeks", COMMUNITY);
+
+ session.getRelationshipManager().associateGroups(communityRootGroup, portalLoversCommunity);
+ session.getRelationshipManager().associateGroups(communityRootGroup, baseJumpingCommunity);
+ session.getRelationshipManager().associateGroups(communityRootGroup, geeksCommunity);
+
+ // Security groups - act like global portal roles
+
+ Group portalAdminGroup = session.getPersistenceManager().createGroup("Poral Admin", SECURITY);
+ Group cmsAdminGroup = session.getPersistenceManager().createGroup("CMS Admin", SECURITY);
+ Group userAdminGroup = session.getPersistenceManager().createGroup("User Admin", SECURITY);
+ Group cmsEditorGroup = session.getPersistenceManager().createGroup("CMS Editor", SECURITY);
+
+ session.getRelationshipManager().associateGroups(securityRootGroup, portalAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, cmsAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, userAdminGroup);
+ session.getRelationshipManager().associateGroups(securityRootGroup, cmsEditorGroup);
+
+ // Organization structure
+
+ Group acmeOrg = session.getPersistenceManager().createGroup("ACME", ORGANIZATION);
+
+ session.getRelationshipManager().associateGroups(organizationRootGroup, acmeOrg);
+
+ Group departmentsOU = session.getPersistenceManager().createGroup("Departments", ORGANIZATION_UNIT);
+ Group officesOU = session.getPersistenceManager().createGroup("Offices", ORGANIZATION_UNIT);
+ Group employeesOU = session.getPersistenceManager().createGroup("Employees", ORGANIZATION_UNIT);
+
+ session.getRelationshipManager().associateGroups(acmeOrg, departmentsOU);
+ session.getRelationshipManager().associateGroups(acmeOrg, officesOU);
+ session.getRelationshipManager().associateGroups(acmeOrg, employeesOU);
+
+ // Departments
+
+ Group hrDepart = session.getPersistenceManager().createGroup("HR", DEPARTMENT);
+ Group financeDepart = session.getPersistenceManager().createGroup("Finance", DEPARTMENT);
+ Group rndDepart = session.getPersistenceManager().createGroup("R&D", DEPARTMENT);
+
+ session.getRelationshipManager().associateGroups(departmentsOU, hrDepart);
+ session.getRelationshipManager().associateGroups(departmentsOU, financeDepart);
+ session.getRelationshipManager().associateGroups(departmentsOU, rndDepart);
+
+ // Offices
+
+ Group parisOffice =session.getPersistenceManager().createGroup("Paris", OFFICE);
+ Group londonOffice =session.getPersistenceManager().createGroup("London", OFFICE);
+ Group nyOffice =session.getPersistenceManager().createGroup("New York", OFFICE);
+
+ session.getRelationshipManager().associateGroups(officesOU, parisOffice);
+ session.getRelationshipManager().associateGroups(officesOU, londonOffice);
+ session.getRelationshipManager().associateGroups(officesOU, nyOffice);
+
+ // People
+
+ User anneUser = session.getPersistenceManager().createUser("anne");
+ User marieUser = session.getPersistenceManager().createUser("marie");
+ User eveUser = session.getPersistenceManager().createUser("eve");
+ User angelinaUser = session.getPersistenceManager().createUser("angelina");
+ User joannaUser = session.getPersistenceManager().createUser("joanna");
+ User merilUser = session.getPersistenceManager().createUser("meril");
+ User johnUser = session.getPersistenceManager().createUser("john");
+ User stanUser = session.getPersistenceManager().createUser("stan");
+ User chrisUser = session.getPersistenceManager().createUser("chris");
+ User billUser = session.getPersistenceManager().createUser("bill");
+ User jackUser = session.getPersistenceManager().createUser("jack");
+
+ ctx.commit();
+
+ ctx.begin();
+
+ // All users are under people root
+
+ session.getRelationshipManager().associateUser(usersROOTGroup, anneUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, marieUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, eveUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, angelinaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, joannaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, merilUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, johnUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, stanUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, chrisUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, billUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, jackUser);
+
+ ctx.commit();
+
+ ctx.begin();
+
+ //
+
+
+ // Anna is...
+
+ // Anna Smith...
+
+
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_GIVEN, "Anne");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_FAMILY, "Smith");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_JOB_TITLE, "Senior Software Developer");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "anne.smith(a)acme.com");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "777 777 777 7 77");
+
+ // Anna works in Paris office and participates in BASE jumping community as a forum moderator and CMS admin
+
+ session.getRelationshipManager().associateUser(parisOffice, anneUser);
+
+ // Anne could be just associated with BASE jumping community group using RelationshipManager but insted Role mechanism
+ // is used to have more fine grained control of access rights inside of a community
+
+
+ session.save();
+
+ ctx.commit();
+
+ ctx.begin();
+
+ session.getRoleManager().createRole(communityMemberRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityForumModeratorRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, anneUser, baseJumpingCommunity);
+
+ // Anne belongs to CMS portal admins security group
+
+ session.getRelationshipManager().associateUser(cmsAdminGroup, anneUser);
+
+ // Ann is also an owner of geeks community
+
+ session.getRoleManager().createRole(communityOwnerRT, anneUser, geeksCommunity);
+
+
+ //
+
+
+ // Angelina ...
+
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_GIVEN, "Angelina");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_FAMILY, "Blond");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_JOB_TITLE, "Very important looking job title");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "angelina1979(a)acme.com");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "888 88 88 8888");
+
+ // She works in London and is office manager there - se both RelationshipManager and RoleManager used against
+ // the same pair of identity objects
+
+ session.getRelationshipManager().associateUser(londonOffice, angelinaUser);
+
+ session.getRoleManager().createRole(officeManagerRT, angelinaUser, londonOffice);
+
+ // Angelina is member of geeks community and manages cms content there
+
+ session.getRoleManager().createRole(communityMemberRT, angelinaUser, geeksCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, angelinaUser, geeksCommunity);
+
+ // As office manager she also edits portal cms content
+
+ session.getRelationshipManager().associateUser(cmsEditorGroup, angelinaUser);
+
+
+ //
+
+
+ // Some assertions
+
+ // How many users do we have in whole acme org and how many people in paris and london offices
+ assertEquals(11, session.getRelationshipManager().findAssociatedUsers(usersROOTGroup, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedUsers(parisOffice, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedUsers(londonOffice, false).size());
+
+
+ // Is anne geeks community owner?
+ assertTrue(session.getRoleManager().hasRole(anneUser, geeksCommunity, communityOwnerRT));
+
+ // Does she belong to cms admins
+ assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup, anneUser));
+
+ // Check all groups that anna belongs to
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser);
+ assertEquals(3, groups.size());
+ assertTrue(groups.contains(usersROOTGroup));
+ assertTrue(groups.contains(parisOffice));
+ assertTrue(groups.contains(cmsAdminGroup));
+
+
+
+ ctx.commit();
+
+ }
+
+
+
+
+
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,106 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.jboss.unit.api.pojo.annotations.Parameter;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class OrganizationTestCase extends IdentityTestPOJO implements APITestContext
-{
- private OrganizationTest orgTest;
-
- private IdentitySessionFactory identitySessionFactory;
-
- private String samplePortalRealmName = "realm://portal/SamplePortal/DB";
-
- private String sampleOrganizationRealmName = "realm://RedHat/DB";
-
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
-
- orgTest = new OrganizationTest(this);
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testOrganization() throws Exception
- {
-
- orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
- }
-
- @Test
- public void testSamplePortal() throws Exception
- {
-
- orgTest.testSamplePortal(getSamplePortalRealmName());
-
- }
-
- public String getSamplePortalRealmName()
- {
- return samplePortalRealmName;
- }
-
- @Parameter
- public void setSamplePortalRealmName(String samplePortalRealmName)
- {
- this.samplePortalRealmName = samplePortalRealmName;
- }
-
- public String getSampleOrganizationRealmName()
- {
- return sampleOrganizationRealmName;
- }
-
- @Parameter
- public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
- {
- this.sampleOrganizationRealmName = sampleOrganizationRealmName;
- }
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/OrganizationTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,106 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Parameter;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class OrganizationTestCase extends IdentityTestPOJO implements APITestContext
+{
+ private OrganizationTest orgTest;
+
+ private IdentitySessionFactory identitySessionFactory;
+
+ private String samplePortalRealmName = "realm://portal/SamplePortal/DB";
+
+ private String sampleOrganizationRealmName = "realm://RedHat/DB";
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ orgTest = new OrganizationTest(this);
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testOrganization() throws Exception
+ {
+
+ orgTest.testRedHatOrganization(getSampleOrganizationRealmName());
+ }
+
+ @Test
+ public void testSamplePortal() throws Exception
+ {
+
+ orgTest.testSamplePortal(getSamplePortalRealmName());
+
+ }
+
+ public String getSamplePortalRealmName()
+ {
+ return samplePortalRealmName;
+ }
+
+ @Parameter
+ public void setSamplePortalRealmName(String samplePortalRealmName)
+ {
+ this.samplePortalRealmName = samplePortalRealmName;
+ }
+
+ public String getSampleOrganizationRealmName()
+ {
+ return sampleOrganizationRealmName;
+ }
+
+ @Parameter
+ public void setSampleOrganizationRealmName(String sampleOrganizationRealmName)
+ {
+ this.sampleOrganizationRealmName = sampleOrganizationRealmName;
+ }
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,184 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.IdentitySearchCriteria;
-
-import junit.framework.Assert;
-
-/**
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class PersistenceManagerTest extends Assert
-{
- //TODO:
- //TODO: - force in removeGroup (NYI)
- //TODO: - exception handling
- //TODO: - search criteria
- //TODO: - features description
-
- APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- private String DIVISION = "DIVISION";
- private String DEPARTMENT = "DEPARTMENT";
- private String PROJECT = "PROJECT";
- private String PEOPLE = "PEOPLE";
-
- public PersistenceManagerTest(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public void setCtx(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public APITestContext getCtx()
- {
- return ctx;
- }
-
- public void testMethods(String realmName) throws Exception
- {
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
-
-
- ctx.begin();
-
- // Bad names
-
- try
- {
- session.getPersistenceManager().createUser("lol/olo");
- fail();
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
-
- try
- {
- session.getPersistenceManager().createGroup("/toto", ORGANIZATION);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- // expected
- }
-
-
- // Create / Remove
-
- // Group
- Group group1 = session.getPersistenceManager().createGroup("groupName1", ORGANIZATION);
-
- assertNotNull(group1);
- assertEquals(group1.getGroupType(), ORGANIZATION);
- assertEquals(group1.getName(), "groupName1");
-
- String group1Id = session.getPersistenceManager().createGroupKey("groupName1", ORGANIZATION);
-
- assertEquals(group1Id, group1.getKey());
-
- group1 = session.getPersistenceManager().findGroupByKey(group1Id);
-
- assertNotNull(group1);
- assertEquals(group1.getGroupType(), ORGANIZATION);
- assertEquals(group1.getName(), "groupName1");
-
- session.getPersistenceManager().createGroup("groupName2", ORGANIZATION);
- session.getPersistenceManager().createGroup("groupName3", PROJECT);
-
- assertEquals(2, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
- assertEquals(1, session.getPersistenceManager().getGroupTypeCount(PROJECT));
- assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
-
- assertEquals(2, session.getPersistenceManager().findGroup(ORGANIZATION).size());
- assertEquals(1, session.getPersistenceManager().findGroup(PROJECT).size());
- assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
-
- session.getPersistenceManager().removeGroup(group1, false);
- String id = session.getPersistenceManager().createGroupKey("groupName2", ORGANIZATION);
- session.getPersistenceManager().removeGroup(id, false);
- id = session.getPersistenceManager().createGroupKey("groupName3", PROJECT);
- session.getPersistenceManager().removeGroup(id, false);
-
- assertEquals(0, session.getPersistenceManager().findGroup(ORGANIZATION, (IdentitySearchCriteria)null).size());
- assertEquals(0, session.getPersistenceManager().findGroup(PROJECT).size());
- assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
-
- assertEquals(0, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
- assertEquals(0, session.getPersistenceManager().getGroupTypeCount(PROJECT));
- assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
-
-
- //User
-
- User u1 = session.getPersistenceManager().createUser("olo");
-
- assertNotNull(u1);
- assertEquals(u1.getKey(), "olo");
-
- session.getPersistenceManager().createUser("anna");
-
- assertEquals(2, session.getPersistenceManager().getUserCount());
-
- assertNotNull(session.getPersistenceManager().findUser("olo"));
- assertNotNull(session.getPersistenceManager().findUser("anna"));
-
- //TODO: this should throw some meaningfull exception or simply return null
- //assertNull(session.getPersistenceManager().findUser("olaf"));
-
- assertEquals(2, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
-
- session.getPersistenceManager().removeUser(u1, false);
-
- assertEquals(1, session.getPersistenceManager().getUserCount());
-
- session.getPersistenceManager().removeUser("anna", false);
-
- assertEquals(0, session.getPersistenceManager().getUserCount());
-
- assertEquals(0, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
-
-
- ctx.commit();
-
- }
-
-
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/PersistenceManagerTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/PersistenceManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,184 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.IdentitySearchCriteria;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class PersistenceManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - force in removeGroup (NYI)
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public PersistenceManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+
+
+ ctx.begin();
+
+ // Bad names
+
+ try
+ {
+ session.getPersistenceManager().createUser("lol/olo");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+ try
+ {
+ session.getPersistenceManager().createGroup("/toto", ORGANIZATION);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ // expected
+ }
+
+
+ // Create / Remove
+
+ // Group
+ Group group1 = session.getPersistenceManager().createGroup("groupName1", ORGANIZATION);
+
+ assertNotNull(group1);
+ assertEquals(group1.getGroupType(), ORGANIZATION);
+ assertEquals(group1.getName(), "groupName1");
+
+ String group1Id = session.getPersistenceManager().createGroupKey("groupName1", ORGANIZATION);
+
+ assertEquals(group1Id, group1.getKey());
+
+ group1 = session.getPersistenceManager().findGroupByKey(group1Id);
+
+ assertNotNull(group1);
+ assertEquals(group1.getGroupType(), ORGANIZATION);
+ assertEquals(group1.getName(), "groupName1");
+
+ session.getPersistenceManager().createGroup("groupName2", ORGANIZATION);
+ session.getPersistenceManager().createGroup("groupName3", PROJECT);
+
+ assertEquals(2, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
+ assertEquals(1, session.getPersistenceManager().getGroupTypeCount(PROJECT));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
+
+ assertEquals(2, session.getPersistenceManager().findGroup(ORGANIZATION).size());
+ assertEquals(1, session.getPersistenceManager().findGroup(PROJECT).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
+
+ session.getPersistenceManager().removeGroup(group1, false);
+ String id = session.getPersistenceManager().createGroupKey("groupName2", ORGANIZATION);
+ session.getPersistenceManager().removeGroup(id, false);
+ id = session.getPersistenceManager().createGroupKey("groupName3", PROJECT);
+ session.getPersistenceManager().removeGroup(id, false);
+
+ assertEquals(0, session.getPersistenceManager().findGroup(ORGANIZATION, (IdentitySearchCriteria)null).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(PROJECT).size());
+ assertEquals(0, session.getPersistenceManager().findGroup(DEPARTMENT).size());
+
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(ORGANIZATION));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(PROJECT));
+ assertEquals(0, session.getPersistenceManager().getGroupTypeCount(DEPARTMENT));
+
+
+ //User
+
+ User u1 = session.getPersistenceManager().createUser("olo");
+
+ assertNotNull(u1);
+ assertEquals(u1.getKey(), "olo");
+
+ session.getPersistenceManager().createUser("anna");
+
+ assertEquals(2, session.getPersistenceManager().getUserCount());
+
+ assertNotNull(session.getPersistenceManager().findUser("olo"));
+ assertNotNull(session.getPersistenceManager().findUser("anna"));
+
+ //TODO: this should throw some meaningfull exception or simply return null
+ //assertNull(session.getPersistenceManager().findUser("olaf"));
+
+ assertEquals(2, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
+
+ session.getPersistenceManager().removeUser(u1, false);
+
+ assertEquals(1, session.getPersistenceManager().getUserCount());
+
+ session.getPersistenceManager().removeUser("anna", false);
+
+ assertEquals(0, session.getPersistenceManager().getUserCount());
+
+ assertEquals(0, session.getPersistenceManager().findUser((IdentitySearchCriteria)null).size());
+
+
+ ctx.commit();
+
+ }
+
+
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,455 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.IdentitySearchCriteria;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import junit.framework.Assert;
-
-/**
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RelationshipManagerTest extends Assert
-{
- //TODO:
- //TODO: - inheritence in find methods
- //TODO: - creating forbidden associations
- //TODO: - exception handling
- //TODO: - search criteria
- //TODO: - features description
-
- APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- private String DIVISION = "DIVISION";
- private String DEPARTMENT = "DEPARTMENT";
- private String PROJECT = "PROJECT";
- private String PEOPLE = "PEOPLE";
-
- public RelationshipManagerTest(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public void setCtx(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public APITestContext getCtx()
- {
- return ctx;
- }
-
- public void testMethods(String realmName) throws Exception
- {
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- ctx.begin();
-
- // Create stuff
- User user1 = session.getPersistenceManager().createUser("user1");
- User user2 = session.getPersistenceManager().createUser("user2");
- User user3 = session.getPersistenceManager().createUser("user3");
- User user4 = session.getPersistenceManager().createUser("user4");
-
- Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
-
- // Associate groups
-
- session.getRelationshipManager().associateGroups(group1, group2);
- session.getRelationshipManager().associateGroups(group1, group3);
-
- // Assert
-
- // isAssociated
-
- assertTrue(session.getRelationshipManager().isAssociated(group1, group2));
- assertTrue(session.getRelationshipManager().isAssociated(group1, group3));
- assertFalse(session.getRelationshipManager().isAssociated(group1, group4));
- assertFalse(session.getRelationshipManager().isAssociated(group2, group1));
- assertFalse(session.getRelationshipManager().isAssociated(group2, group3));
-
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(group2, group3)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2, group3), Arrays.asList(group1)));
-
- assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group2.getKey()));
- assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group3.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group4.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group1.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group3.getKey()));
-
- assertTrue(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
- assertFalse(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
- assertFalse(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(group1.getKey())));
-
-
- // Associate groups - other methods
-
- // First disassociate and assert
- session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
-
- assertFalse(session.getRelationshipManager().isAssociated(group1, group2));
- assertFalse(session.getRelationshipManager().isAssociated(group1, group3));
-
- // reassociate #1
- session.getRelationshipManager().associateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
-
- session.getRelationshipManager().disassociateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
-
- // reassociate #2
- session.getRelationshipManager().associateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
-
- session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
-
- // reassociate #3
- session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group2.getKey());
- session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group3.getKey());
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
-
- session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
-
-
- // Associate Group and Users
-
- session.getRelationshipManager().associateUser(group1, user1);
- session.getRelationshipManager().associateUser(group1, user2);
-
- // isAssociated
-
- assertTrue(session.getRelationshipManager().isAssociated(group1, user1));
- assertTrue(session.getRelationshipManager().isAssociated(group1, user2));
- assertFalse(session.getRelationshipManager().isAssociated(group1, user3));
- assertFalse(session.getRelationshipManager().isAssociated(group2, user1));
- assertFalse(session.getRelationshipManager().isAssociated(group2, user3));
-
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(user1, user2)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(user3)));
-
- assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user1.getKey()));
- assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user2.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user3.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user1.getKey()));
- assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user3.getKey()));
-
- assertTrue(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
- assertFalse(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
- assertFalse(session.getRelationshipManager().
- isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(user1.getKey())));
-
-
- // Associate groups / users - other methods
-
- // First disassociate and assert
- session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
-
- assertFalse(session.getRelationshipManager().isAssociated(group1, user1));
- assertFalse(session.getRelationshipManager().isAssociated(group1, user2));
-
- // reassociate #1
- session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
-
- session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
-
- // reassociate #2
- session.getRelationshipManager().associateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
-
- session.getRelationshipManager().disassociateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
-
- // reassociate #3
- session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
- session.getRelationshipManager().associateUserByKeys(group1.getKey(), user2.getKey());
-
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
-
- session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
-
- // reassociate #4
- session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
- session.getRelationshipManager().associateUserByKeys(group2.getKey(), user1.getKey());
- session.getRelationshipManager().associateUserByKeys(group3.getKey(), user1.getKey());
-
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2, group3), Arrays.asList(user1)));
-
- session.getRelationshipManager().disassociateGroups(user1);
-
- assertFalse(session.getRelationshipManager().isAssociated(group1, user1));
- assertFalse(session.getRelationshipManager().isAssociated(group2, user1));
- assertFalse(session.getRelationshipManager().isAssociated(group3, user1));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2, group3), Arrays.asList(user1)));
-
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1).size());
-
-
-
- ctx.commit();
-
- ctx.begin();
-
-
- // Find methods - prepopulate
-
- session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
- session.getRelationshipManager().associateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
- session.getRelationshipManager().associateGroups(Arrays.asList(group2), Arrays.asList(group3, group4, group5));
-
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
- assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
-
- ctx.commit();
- ctx.begin();
-
- // Find users
- //TODO: check if collections contain correct objects (not only size)
-
- assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false).size());
-
- assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
-
- assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1.getKey(), false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2.getKey(), false, null).size());
-
- // Find groups
-
- // #1
- assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2, DEPARTMENT, true, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION_UNIT, true, false).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, true, false).size());
-
- // #1
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), DEPARTMENT, true, false, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION_UNIT, true, false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, true, false, null).size());
-
- // #3
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3, ORGANIZATION_UNIT, false, false).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4, ORGANIZATION_UNIT, false, false).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, false, false).size());
- assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
-
- // #4
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3.getKey(), ORGANIZATION_UNIT, false, false, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4.getKey(), ORGANIZATION_UNIT, false, false, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, false, false, null).size());
-
- // #5
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4).size());
-
- // #6
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), null).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), null).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), null).size());
-
- // #7
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION_UNIT).size());
- assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2, (String)null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION_UNIT).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION_UNIT).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION_UNIT).size());
-
- // #7
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION_UNIT, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION_UNIT, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION, null).size());
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION_UNIT, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION, null).size());
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION_UNIT, null).size());
-
- // Cleanup and check
- session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
- session.getRelationshipManager().disassociateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
- session.getRelationshipManager().disassociateGroups(Arrays.asList(group2), Arrays.asList(group3, group4));
-
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
- assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
-
- ctx.commit();
-
- }
-
- public void testCascade(String realmName) throws Exception
- {
-
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- ctx.begin();
-
- // Create stuff
- User user1 = session.getPersistenceManager().createUser("user1");
- User user2 = session.getPersistenceManager().createUser("user2");
- User user3 = session.getPersistenceManager().createUser("user3");
- User user4 = session.getPersistenceManager().createUser("user4");
- User user5 = session.getPersistenceManager().createUser("user5");
- User user6 = session.getPersistenceManager().createUser("user6");
- User user7 = session.getPersistenceManager().createUser("user7");
-
- Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION);
- Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION);
- Group group4 = session.getPersistenceManager().createGroup("group4", ORGANIZATION);
- Group group5 = session.getPersistenceManager().createGroup("group5", ORGANIZATION);
-
-
- // Create looped associations
- session.getRelationshipManager().associateGroups(group1, group2);
- session.getRelationshipManager().associateGroups(group1, group3);
- session.getRelationshipManager().associateGroups(group2, group4);
- session.getRelationshipManager().associateGroups(group2, group5);
- session.getRelationshipManager().associateGroups(group3, group1);
-
- // Assign users
- session.getRelationshipManager().associateUser(group1, user1);
- session.getRelationshipManager().associateUser(group2, user2);
- session.getRelationshipManager().associateUser(group3, user3);
- session.getRelationshipManager().associateUser(group5, user4);
- session.getRelationshipManager().associateUser(group5, user5);
-
-
- // Make sure that algorithm doesn't go in a loop
- Collection<Group> results = session.getRelationshipManager().
- findAssociatedGroups(group1, ORGANIZATION, true, true);
-
- assertEquals(4, results.size());
- assertFalse(results.contains(group1));
- assertTrue(results.contains(group2));
- assertTrue(results.contains(group3));
- assertTrue(results.contains(group4));
- assertTrue(results.contains(group5));
-
-
- // And get all users associated in a tree
- Collection<User> results2 = session.getRelationshipManager().
- findAssociatedUsers(group1, true);
-
- assertEquals(5, results2.size());
- assertFalse(results2.contains(user6));
- assertFalse(results2.contains(user7));
- assertTrue(results2.contains(user1));
- assertTrue(results2.contains(user2));
- assertTrue(results2.contains(user3));
- assertTrue(results2.contains(user4));
- assertTrue(results2.contains(user5));
-
- }
-
- public void testMergedRoleAssociations(String realmName) throws Exception
- {
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- ctx.begin();
-
- // Create stuff
- User user1 = session.getPersistenceManager().createUser("user1");
- User user2 = session.getPersistenceManager().createUser("user2");
- User user3 = session.getPersistenceManager().createUser("user3");
- User user4 = session.getPersistenceManager().createUser("user4");
-
- Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
- // Associate
-
- session.getRelationshipManager().associateGroups(group1, group2);
- session.getRelationshipManager().associateGroups(group1, group3);
- session.getRelationshipManager().associateUser(group1, user1);
- session.getRelationshipManager().associateUser(group1, user2);
-
- session.getRoleManager().createRoleType("rt1");
- session.getRoleManager().createRoleType("rt2");
-
- session.getRoleManager().createRole("rt1", user1.getKey(), group1.getKey());
- session.getRoleManager().createRole("rt1", user3.getKey(), group1.getKey());
- session.getRoleManager().createRole("rt1", user4.getKey(), group1.getKey());
- session.getRoleManager().createRole("rt2", user3.getKey(), group1.getKey());
-
- session.getRoleManager().createRole("rt1", user3.getKey(), group2.getKey());
- session.getRoleManager().createRole("rt2", user2.getKey(), group3.getKey());
-
- // Assert
-
- assertEquals(2, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
- assertEquals(4, session.getRelationshipManager().findRelatedUsers(group1, null).size());
-
- assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
- assertEquals(1, session.getRelationshipManager().findRelatedUsers(group2, null).size());
-
- assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user3, (IdentitySearchCriteria)null).size());
- assertEquals(2, session.getRelationshipManager().findRelatedGroups(user3, null, null).size());
-
- assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, (IdentitySearchCriteria)null).size());
- assertEquals(2, session.getRelationshipManager().findRelatedGroups(user2, null, null).size());
-
- ctx.commit();
-
- }
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RelationshipManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,455 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.IdentitySearchCriteria;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import junit.framework.Assert;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RelationshipManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - inheritence in find methods
+ //TODO: - creating forbidden associations
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public RelationshipManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+
+ // Associate groups
+
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+
+ // Assert
+
+ // isAssociated
+
+ assertTrue(session.getRelationshipManager().isAssociated(group1, group2));
+ assertTrue(session.getRelationshipManager().isAssociated(group1, group3));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group4));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, group1));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, group3));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(group2, group3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2, group3), Arrays.asList(group1)));
+
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group2.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group3.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), group4.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group1.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), group3.getKey()));
+
+ assertTrue(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(group2.getKey(), group3.getKey())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(group1.getKey())));
+
+
+ // Associate groups - other methods
+
+ // First disassociate and assert
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group2));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, group3));
+
+ // reassociate #1
+ session.getRelationshipManager().associateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
+
+ // reassociate #2
+ session.getRelationshipManager().associateGroupsByKeys(Arrays.asList(group1.getKey()), Arrays.asList(group2.getKey(), group3.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+ // reassociate #3
+ session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group2.getKey());
+ session.getRelationshipManager().associateGroupsByKeys(group1.getKey(), group3.getKey());
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(group2, group3)));
+
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group1), Arrays.asList(group2, group3));
+
+
+ // Associate Group and Users
+
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
+
+ // isAssociated
+
+ assertTrue(session.getRelationshipManager().isAssociated(group1, user1));
+ assertTrue(session.getRelationshipManager().isAssociated(group1, user2));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user3));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, user3));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2), Arrays.asList(user1, user2)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(user3)));
+
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user1.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user2.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group1.getKey(), user3.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user1.getKey()));
+ assertFalse(session.getRelationshipManager().isAssociatedByKeys(group2.getKey(), user3.getKey()));
+
+ assertTrue(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group1.getKey(), group2.getKey()), Arrays.asList(user1.getKey(), user2.getKey())));
+ assertFalse(session.getRelationshipManager().
+ isAssociatedByKeys(Arrays.asList(group2.getKey(), group3.getKey()), Arrays.asList(user1.getKey())));
+
+
+ // Associate groups / users - other methods
+
+ // First disassociate and assert
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user2));
+
+ // reassociate #1
+ session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+ // reassociate #2
+ session.getRelationshipManager().associateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsersByKeys(Arrays.asList(group1.getKey()), Arrays.asList(user1.getKey(), user2.getKey()));
+
+ // reassociate #3
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user2.getKey());
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2)));
+
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2));
+
+ // reassociate #4
+ session.getRelationshipManager().associateUserByKeys(group1.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group2.getKey(), user1.getKey());
+ session.getRelationshipManager().associateUserByKeys(group3.getKey(), user1.getKey());
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2, group3), Arrays.asList(user1)));
+
+ session.getRelationshipManager().disassociateGroups(user1);
+
+ assertFalse(session.getRelationshipManager().isAssociated(group1, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group2, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(group3, user1));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1, group2, group3), Arrays.asList(user1)));
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1).size());
+
+
+
+ ctx.commit();
+
+ ctx.begin();
+
+
+ // Find methods - prepopulate
+
+ session.getRelationshipManager().associateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
+ session.getRelationshipManager().associateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
+ session.getRelationshipManager().associateGroups(Arrays.asList(group2), Arrays.asList(group3, group4, group5));
+
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
+ assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
+
+ ctx.commit();
+ ctx.begin();
+
+ // Find users
+ //TODO: check if collections contain correct objects (not only size)
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false).size());
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
+
+ assertEquals(3, session.getRelationshipManager().findAssociatedUsers(group1.getKey(), false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2.getKey(), false, null).size());
+
+ // Find groups
+
+ // #1
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2, DEPARTMENT, true, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION_UNIT, true, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, true, false).size());
+
+ // #1
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), DEPARTMENT, true, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION_UNIT, true, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, true, false, null).size());
+
+ // #3
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3, ORGANIZATION_UNIT, false, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4, ORGANIZATION_UNIT, false, false).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2, ORGANIZATION, false, false).size());
+ assertEquals(3, session.getRelationshipManager().findAssociatedGroups(group2, null, true, false).size());
+
+ // #4
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group3.getKey(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(group4.getKey(), ORGANIZATION_UNIT, false, false, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(group2.getKey(), ORGANIZATION, false, false, null).size());
+
+ // #5
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4).size());
+
+ // #6
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), null).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), null).size());
+
+ // #7
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1, ORGANIZATION_UNIT).size());
+ assertEquals(2, session.getRelationshipManager().findAssociatedGroups(user2, (String)null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, ORGANIZATION_UNIT).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3, ORGANIZATION_UNIT).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4, ORGANIZATION_UNIT).size());
+
+ // #7
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user1.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION, null).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user3.getKey(), ORGANIZATION_UNIT, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION, null).size());
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user4.getKey(), ORGANIZATION_UNIT, null).size());
+
+ // Cleanup and check
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group1), Arrays.asList(user1, user2, user3));
+ session.getRelationshipManager().disassociateUsers(Arrays.asList(group3), Arrays.asList(user2, user3));
+ session.getRelationshipManager().disassociateGroups(Arrays.asList(group2), Arrays.asList(group3, group4));
+
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group1), Arrays.asList(user1, user2, user3)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group2), Arrays.asList(group3, group4, group5)));
+ assertFalse(session.getRelationshipManager().isAssociated(Arrays.asList(group3), Arrays.asList(user2, user3)));
+
+ ctx.commit();
+
+ }
+
+ public void testCascade(String realmName) throws Exception
+ {
+
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+ User user5 = session.getPersistenceManager().createUser("user5");
+ User user6 = session.getPersistenceManager().createUser("user6");
+ User user7 = session.getPersistenceManager().createUser("user7");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION);
+ Group group4 = session.getPersistenceManager().createGroup("group4", ORGANIZATION);
+ Group group5 = session.getPersistenceManager().createGroup("group5", ORGANIZATION);
+
+
+ // Create looped associations
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+ session.getRelationshipManager().associateGroups(group2, group4);
+ session.getRelationshipManager().associateGroups(group2, group5);
+ session.getRelationshipManager().associateGroups(group3, group1);
+
+ // Assign users
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group2, user2);
+ session.getRelationshipManager().associateUser(group3, user3);
+ session.getRelationshipManager().associateUser(group5, user4);
+ session.getRelationshipManager().associateUser(group5, user5);
+
+
+ // Make sure that algorithm doesn't go in a loop
+ Collection<Group> results = session.getRelationshipManager().
+ findAssociatedGroups(group1, ORGANIZATION, true, true);
+
+ assertEquals(4, results.size());
+ assertFalse(results.contains(group1));
+ assertTrue(results.contains(group2));
+ assertTrue(results.contains(group3));
+ assertTrue(results.contains(group4));
+ assertTrue(results.contains(group5));
+
+
+ // And get all users associated in a tree
+ Collection<User> results2 = session.getRelationshipManager().
+ findAssociatedUsers(group1, true);
+
+ assertEquals(5, results2.size());
+ assertFalse(results2.contains(user6));
+ assertFalse(results2.contains(user7));
+ assertTrue(results2.contains(user1));
+ assertTrue(results2.contains(user2));
+ assertTrue(results2.contains(user3));
+ assertTrue(results2.contains(user4));
+ assertTrue(results2.contains(user5));
+
+ }
+
+ public void testMergedRoleAssociations(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+ // Create stuff
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ // Associate
+
+ session.getRelationshipManager().associateGroups(group1, group2);
+ session.getRelationshipManager().associateGroups(group1, group3);
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
+
+ session.getRoleManager().createRoleType("rt1");
+ session.getRoleManager().createRoleType("rt2");
+
+ session.getRoleManager().createRole("rt1", user1.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt1", user3.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt1", user4.getKey(), group1.getKey());
+ session.getRoleManager().createRole("rt2", user3.getKey(), group1.getKey());
+
+ session.getRoleManager().createRole("rt1", user3.getKey(), group2.getKey());
+ session.getRoleManager().createRole("rt2", user2.getKey(), group3.getKey());
+
+ // Assert
+
+ assertEquals(2, session.getRelationshipManager().findAssociatedUsers(group1, false, null).size());
+ assertEquals(4, session.getRelationshipManager().findRelatedUsers(group1, null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedUsers(group2, false, null).size());
+ assertEquals(1, session.getRelationshipManager().findRelatedUsers(group2, null).size());
+
+ assertEquals(0, session.getRelationshipManager().findAssociatedGroups(user3, (IdentitySearchCriteria)null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user3, null, null).size());
+
+ assertEquals(1, session.getRelationshipManager().findAssociatedGroups(user2, (IdentitySearchCriteria)null).size());
+ assertEquals(2, session.getRelationshipManager().findRelatedGroups(user2, null, null).size());
+
+ ctx.commit();
+
+ }
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,285 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.Role;
-
-import junit.framework.Assert;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RoleManagerTest extends Assert
-{
- //TODO:
- //TODO: - exception handling
- //TODO: - search criteria
- //TODO: - features description
-
- APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- private String DIVISION = "DIVISION";
- private String DEPARTMENT = "DEPARTMENT";
- private String PROJECT = "PROJECT";
- private String PEOPLE = "PEOPLE";
-
- public RoleManagerTest(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public void setCtx(APITestContext ctx)
- {
- this.ctx = ctx;
- }
-
- public APITestContext getCtx()
- {
- return ctx;
- }
-
- public void testMethods(String realmName) throws Exception
- {
- IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
-
- IdentitySession session = factory.createIdentitySession(realmName);
-
- ctx.begin();
-
-
-
- // RoleTypes - pure
- assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
-
- // Create / remove
- RoleType rt1 = session.getRoleManager().createRoleType("rt1");
- RoleType rt2 = session.getRoleManager().createRoleType("rt2");
- RoleType rt3 = session.getRoleManager().createRoleType("rt3");
- RoleType rt4 = session.getRoleManager().createRoleType("rt4");
-
- assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
-
- session.getRoleManager().removeRoleType(rt1);
- session.getRoleManager().removeRoleType(rt2);
-
- assertEquals(2, session.getRoleManager().findRoleTypes(null).size());
-
- session.getRoleManager().removeRoleType("rt3");
- session.getRoleManager().removeRoleType("rt4");
-
- assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
-
- // Create all entities for tests
-
- User user1 = session.getPersistenceManager().createUser("user1");
- User user2 = session.getPersistenceManager().createUser("user2");
- User user3 = session.getPersistenceManager().createUser("user3");
- User user4 = session.getPersistenceManager().createUser("user4");
-
- Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
- rt1 = session.getRoleManager().createRoleType("rt1");
- rt2 = session.getRoleManager().createRoleType("rt2");
- rt3 = session.getRoleManager().createRoleType("rt3");
- rt4 = session.getRoleManager().createRoleType("rt4");
-
- assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
-
-
-
-
- // Create/remove and find roles
-
- Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
- Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = session.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
-
-
-
-
- //
-
- assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(1, session.getRoleManager().findRoles(user1, rt2).size());
- assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
- assertEquals(1, session.getRoleManager().findRoles(group1, rt2).size());
-
- //
-
- assertEquals(2, session.getRoleManager().findGroupRoleTypes(group1).size());
- assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
-
- //
-
- assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(1, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
- assertEquals(1, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
- assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
-
- //
-
- assertEquals(2, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
- assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
-
- //
-
- assertEquals(2, session.getRoleManager().findRoleTypes(user1, group1).size());
- assertEquals(1, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
-
- //
-
- assertEquals(2, session.getRoleManager().findUserRoleTypes(user1).size());
- assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
-
- //
- assertTrue(session.getRoleManager().hasRole(user1, group1, rt1));
- assertTrue(session.getRoleManager().hasRole(user1, group1, rt2));
- assertTrue(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
- assertFalse(session.getRoleManager().hasRole("user2", group2.getKey(), "rt1"));
- assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
- assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
-
- // Role properties
-
- assertEquals(0, session.getRoleManager().getProperties(role1).keySet().size());
- assertEquals(0, session.getRoleManager().getProperties(rt1).keySet().size());
- assertEquals(0, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
-
- session.getRoleManager().setProperty(role1, "roleProp1", "val1");
- session.getRoleManager().setProperty(role1, "roleProp1", "val2");
- session.getRoleManager().setProperty(role1, "roleProp2", "val1");
- session.getRoleManager().setProperty(rt1, "rtProp1", "val1");
- session.getRoleManager().setProperty(rt1.getName(), "rtProp1", "val2");
- session.getRoleManager().setProperty(rt1, "rtProp2", "val1");
- session.getRoleManager().setProperty(rt1, "rtProp3", "val1");
-
- assertEquals(2, session.getRoleManager().getProperties(role1).keySet().size());
- assertEquals(3, session.getRoleManager().getProperties(rt1).keySet().size());
- assertEquals(3, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
-
- assertEquals("val2", session.getRoleManager().getProperties(role1).get("roleProp1"));
- assertEquals("val1", session.getRoleManager().getProperties(role1).get("roleProp2"));
- assertEquals("val2", session.getRoleManager().getProperties(rt1).get("rtProp1"));
- assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp2"));
- assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp3"));
-
-
- Map<String, String> props = new HashMap<String, String>();
- props.put("prop5", "val1");
-
- session.getRoleManager().setProperties(role2, props);
-
- assertEquals(1, session.getRoleManager().getProperties(role2).keySet().size());
-
- assertEquals("val1", session.getRoleManager().getProperties(role2).get("prop5"));
-
-
- props.put("prop6", "val3");
- session.getRoleManager().setProperties(rt2, props);
- session.getRoleManager().setProperties(rt3.getName(), props);
-
- assertEquals(2, session.getRoleManager().getProperties(rt2).keySet().size());
-
- assertEquals("val3", session.getRoleManager().getProperties(rt2).get("prop6"));
- assertEquals("val3", session.getRoleManager().getProperties(rt3).get("prop6"));
-
-
- session.getRoleManager().removeProperty(role2, "prop5");
- assertEquals(0, session.getRoleManager().getProperties(role2).keySet().size());
-
- session.getRoleManager().removeProperty(rt2, "prop6");
- assertEquals(1, session.getRoleManager().getProperties(rt2).keySet().size());
- session.getRoleManager().removeProperty(rt2, "prop5");
- assertEquals(0, session.getRoleManager().getProperties(rt2).keySet().size());
-
-
- // Remove roles
-
- session.getRoleManager().removeRole(rt1, user1, group1);
- session.getRoleManager().removeRole(role2);
- session.getRoleManager().removeRole("rt2", user1.getKey(), group1.getKey());
-
- assertFalse(session.getRoleManager().hasRole(user1, group1, rt1));
- assertFalse(session.getRoleManager().hasRole(user1, group1, rt2));
- assertFalse(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
-
- //
-
- assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(0, session.getRoleManager().findRoles(user1, rt2).size());
- assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
- assertEquals(0, session.getRoleManager().findRoles(group1, rt2).size());
-
- //
-
- assertEquals(0, session.getRoleManager().findGroupRoleTypes(group1).size());
- assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
-
- //
-
- assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
- assertEquals(0, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
- assertEquals(0, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
- assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
-
- //
-
- assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
- assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
-
- //
-
- assertEquals(0, session.getRoleManager().findRoleTypes(user1, group1).size());
- assertEquals(0, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
-
- //
-
- assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
- assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
-
-
-
-
- ctx.commit();
-
- }
-
-
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleManagerTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleManagerTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,285 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.Role;
+
+import junit.framework.Assert;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleManagerTest extends Assert
+{
+ //TODO:
+ //TODO: - exception handling
+ //TODO: - search criteria
+ //TODO: - features description
+
+ APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DIVISION = "DIVISION";
+ private String DEPARTMENT = "DEPARTMENT";
+ private String PROJECT = "PROJECT";
+ private String PEOPLE = "PEOPLE";
+
+ public RoleManagerTest(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public void setCtx(APITestContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ public APITestContext getCtx()
+ {
+ return ctx;
+ }
+
+ public void testMethods(String realmName) throws Exception
+ {
+ IdentitySessionFactory factory = ctx.getIdentitySessionFactory();
+
+ IdentitySession session = factory.createIdentitySession(realmName);
+
+ ctx.begin();
+
+
+
+ // RoleTypes - pure
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create / remove
+ RoleType rt1 = session.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = session.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = session.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType(rt1);
+ session.getRoleManager().removeRoleType(rt2);
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(null).size());
+
+ session.getRoleManager().removeRoleType("rt3");
+ session.getRoleManager().removeRoleType("rt4");
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(null).size());
+
+ // Create all entities for tests
+
+ User user1 = session.getPersistenceManager().createUser("user1");
+ User user2 = session.getPersistenceManager().createUser("user2");
+ User user3 = session.getPersistenceManager().createUser("user3");
+ User user4 = session.getPersistenceManager().createUser("user4");
+
+ Group group1 = session.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = session.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = session.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = session.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = session.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ rt1 = session.getRoleManager().createRoleType("rt1");
+ rt2 = session.getRoleManager().createRoleType("rt2");
+ rt3 = session.getRoleManager().createRoleType("rt3");
+ rt4 = session.getRoleManager().createRoleType("rt4");
+
+ assertEquals(4, session.getRoleManager().findRoleTypes(null).size());
+
+
+
+
+ // Create/remove and find roles
+
+ Role role1 = session.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = session.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = session.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
+
+
+
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(1, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(1, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
+ assertEquals(1, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
+ assertEquals(1, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(1, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
+
+ //
+
+ assertEquals(2, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
+
+ //
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertTrue(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertTrue(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole("user2", group2.getKey(), "rt1"));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt3));
+ assertFalse(session.getRoleManager().hasRole(user1, group4, rt3));
+
+ // Role properties
+
+ assertEquals(0, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(0, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ session.getRoleManager().setProperty(role1, "roleProp1", "val1");
+ session.getRoleManager().setProperty(role1, "roleProp1", "val2");
+ session.getRoleManager().setProperty(role1, "roleProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp1", "val1");
+ session.getRoleManager().setProperty(rt1.getName(), "rtProp1", "val2");
+ session.getRoleManager().setProperty(rt1, "rtProp2", "val1");
+ session.getRoleManager().setProperty(rt1, "rtProp3", "val1");
+
+ assertEquals(2, session.getRoleManager().getProperties(role1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1).keySet().size());
+ assertEquals(3, session.getRoleManager().getProperties(rt1.getName()).keySet().size());
+
+ assertEquals("val2", session.getRoleManager().getProperties(role1).get("roleProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(role1).get("roleProp2"));
+ assertEquals("val2", session.getRoleManager().getProperties(rt1).get("rtProp1"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp2"));
+ assertEquals("val1", session.getRoleManager().getProperties(rt1).get("rtProp3"));
+
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("prop5", "val1");
+
+ session.getRoleManager().setProperties(role2, props);
+
+ assertEquals(1, session.getRoleManager().getProperties(role2).keySet().size());
+
+ assertEquals("val1", session.getRoleManager().getProperties(role2).get("prop5"));
+
+
+ props.put("prop6", "val3");
+ session.getRoleManager().setProperties(rt2, props);
+ session.getRoleManager().setProperties(rt3.getName(), props);
+
+ assertEquals(2, session.getRoleManager().getProperties(rt2).keySet().size());
+
+ assertEquals("val3", session.getRoleManager().getProperties(rt2).get("prop6"));
+ assertEquals("val3", session.getRoleManager().getProperties(rt3).get("prop6"));
+
+
+ session.getRoleManager().removeProperty(role2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(role2).keySet().size());
+
+ session.getRoleManager().removeProperty(rt2, "prop6");
+ assertEquals(1, session.getRoleManager().getProperties(rt2).keySet().size());
+ session.getRoleManager().removeProperty(rt2, "prop5");
+ assertEquals(0, session.getRoleManager().getProperties(rt2).keySet().size());
+
+
+ // Remove roles
+
+ session.getRoleManager().removeRole(rt1, user1, group1);
+ session.getRoleManager().removeRole(role2);
+ session.getRoleManager().removeRole("rt2", user1.getKey(), group1.getKey());
+
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt1));
+ assertFalse(session.getRoleManager().hasRole(user1, group1, rt2));
+ assertFalse(session.getRoleManager().hasRole("user1", group2.getKey(), "rt1"));
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt2).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt2).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group1).size());
+ assertEquals(0, session.getRoleManager().findGroupRoleTypes(group2.getKey(), null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoles(user1, rt1).size());
+ assertEquals(0, session.getRoleManager().findRoles(user1.getKey(), "rt2").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1.getKey(), "rt1").size());
+ assertEquals(0, session.getRoleManager().findRoles(group1, rt1).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1, null).size());
+ assertEquals(0, session.getRoleManager().findGroupsWithRelatedRole(user1.getKey(), ORGANIZATION, null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1, group1).size());
+ assertEquals(0, session.getRoleManager().findRoleTypes(user1.getKey(), group2.getKey(), null).size());
+
+ //
+
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user1).size());
+ assertEquals(0, session.getRoleManager().findUserRoleTypes(user2.getKey(), null).size());
+
+
+
+
+ ctx.commit();
+
+ }
+
+
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,116 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.query.RoleQueryBuilder;
-import org.jboss.identity.idm.api.query.RoleQuery;
-import junit.framework.Assert;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class RoleQueryTest extends Assert
-{
- private APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
- private String DEPARTMENT = "DEPARTMENT";
-
- public RoleQueryTest(APITestContext testContext)
- {
- this.ctx = testContext;
- }
-
- public void testQuery(String realmName) throws Exception
- {
- ctx.begin();
-
- IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
-
- // Create some stuff...
-
- User user1 = ids.getPersistenceManager().createUser("user1");
- User user2 = ids.getPersistenceManager().createUser("user2");
- User user3 = ids.getPersistenceManager().createUser("user3");
- User user4 = ids.getPersistenceManager().createUser("user4");
-
- Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
- RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
- RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
- RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
- RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
-
- Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
- Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
-
- // Test Query
-
- //
- RoleQueryBuilder rqb = ids.createRoleQueryBuilder();
-
- rqb.setUser("user1");
-
- RoleQuery rq = rqb.createQuery();
-
- assertEquals(3, ids.execute(rq).size());
-
- //
- rqb.setGroup(group1);
- rq = rqb.createQuery();
-
- assertEquals(2, ids.execute(rq).size());
-
- //
- rqb.setRoleType(rt2);
- rq = rqb.createQuery();
-
- assertEquals(1, ids.execute(rq).size());
-
-
- //
- rqb.reset();
-
- rqb.setGroup(group2);
- rqb.setRoleType(rt1);
-
- rq = rqb.createQuery();
-
- assertEquals(1, ids.execute(rq).size());
- assertEquals(role2, ids.uniqueResult(rq));
-
- ctx.commit();
- }
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/RoleQueryTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/RoleQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,116 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.Role;
+import org.picketlink.idm.api.query.RoleQueryBuilder;
+import org.picketlink.idm.api.query.RoleQuery;
+import junit.framework.Assert;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class RoleQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public RoleQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create some stuff...
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
+
+ // Test Query
+
+ //
+ RoleQueryBuilder rqb = ids.createRoleQueryBuilder();
+
+ rqb.setUser("user1");
+
+ RoleQuery rq = rqb.createQuery();
+
+ assertEquals(3, ids.execute(rq).size());
+
+ //
+ rqb.setGroup(group1);
+ rq = rqb.createQuery();
+
+ assertEquals(2, ids.execute(rq).size());
+
+ //
+ rqb.setRoleType(rt2);
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+
+
+ //
+ rqb.reset();
+
+ rqb.setGroup(group2);
+ rqb.setRoleType(rt1);
+
+ rq = rqb.createQuery();
+
+ assertEquals(1, ids.execute(rq).size());
+ assertEquals(role2, ids.uniqueResult(rq));
+
+ ctx.commit();
+ }
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/SimpleTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,140 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySessionFactory;
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-import java.util.logging.Logger;
-
-/**
- * Some iteration to help find possible n+1 selects in logs.
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class SimpleTestCase extends IdentityTestPOJO implements APITestContext
-{
- private static Logger log = Logger.getLogger(SimpleTestCase.class.getName());
-
-
- IdentitySessionFactory identitySessionFactory;
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
-
- setRealmName("realm://RedHat/DB");
-
-
- identitySessionFactory = new IdentityConfigurationImpl().
- configure(getIdentityConfig()).buildIdentitySessionFactory();
-
- log.fine("Statistics after IdentitySessionFactory creation:");
- hibernateSupport.getSessionFactory().getStatistics().logSummary();
-
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- public IdentitySessionFactory getIdentitySessionFactory()
- {
- return identitySessionFactory;
- }
-
- @Test
- public void testPersistenceManager() throws Exception
- {
- IdentitySession session = identitySessionFactory.createIdentitySession(getRealmName());
-
-
- String ORGANIZATION = "ORGANIZATION";
-
-
-
- for (int i = 0; i < 50; i++)
- {
- log.fine("\n\n\n### Create Group: " + i + "\n");
-
- begin();
- session.getPersistenceManager().createGroup("test" + i, ORGANIZATION);
- commit();
-
- }
-
- for (int i = 0; i < 50; i++)
- {
- log.fine("\n\n\n### Create User: " + i + "\n");
-
- begin();
- session.getPersistenceManager().createUser("test" + i);
- commit();
-
- }
-
- String groupKey = session.getPersistenceManager().createGroupKey("test0", ORGANIZATION);
-
- for (int i = 0; i < 50; i++)
- {
- log.fine("\n\n\n### Associate User[" + i + "] to a Group" + "\n");
-
- begin();
- session.getRelationshipManager().associateUserByKeys(groupKey, "test" + i);
- commit();
-
- }
-
- begin();
-
- groupKey = session.getPersistenceManager().createGroup("master", ORGANIZATION).getKey();
-
- commit();
-
- for (int i = 0; i < 50; i++)
- {
- log.fine("\n\n\n### Associate Group[" + i + "] of type DEPARTMENT to a Group" + groupKey + "\n");
-
-
-
- begin();
- String groupKey2 = session.getPersistenceManager().createGroupKey("test" + i, ORGANIZATION);
- session.getRelationshipManager().associateGroupsByKeys(groupKey, groupKey2);
- commit();
-
- }
-
-
-
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/SimpleTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/SimpleTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,140 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySessionFactory;
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import java.util.logging.Logger;
+
+/**
+ * Some iteration to help find possible n+1 selects in logs.
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class SimpleTestCase extends IdentityTestPOJO implements APITestContext
+{
+ private static Logger log = Logger.getLogger(SimpleTestCase.class.getName());
+
+
+ IdentitySessionFactory identitySessionFactory;
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ setRealmName("realm://RedHat/DB");
+
+
+ identitySessionFactory = new IdentityConfigurationImpl().
+ configure(getIdentityConfig()).buildIdentitySessionFactory();
+
+ log.fine("Statistics after IdentitySessionFactory creation:");
+ hibernateSupport.getSessionFactory().getStatistics().logSummary();
+
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public IdentitySessionFactory getIdentitySessionFactory()
+ {
+ return identitySessionFactory;
+ }
+
+ @Test
+ public void testPersistenceManager() throws Exception
+ {
+ IdentitySession session = identitySessionFactory.createIdentitySession(getRealmName());
+
+
+ String ORGANIZATION = "ORGANIZATION";
+
+
+
+ for (int i = 0; i < 50; i++)
+ {
+ log.fine("\n\n\n### Create Group: " + i + "\n");
+
+ begin();
+ session.getPersistenceManager().createGroup("test" + i, ORGANIZATION);
+ commit();
+
+ }
+
+ for (int i = 0; i < 50; i++)
+ {
+ log.fine("\n\n\n### Create User: " + i + "\n");
+
+ begin();
+ session.getPersistenceManager().createUser("test" + i);
+ commit();
+
+ }
+
+ String groupKey = session.getPersistenceManager().createGroupKey("test0", ORGANIZATION);
+
+ for (int i = 0; i < 50; i++)
+ {
+ log.fine("\n\n\n### Associate User[" + i + "] to a Group" + "\n");
+
+ begin();
+ session.getRelationshipManager().associateUserByKeys(groupKey, "test" + i);
+ commit();
+
+ }
+
+ begin();
+
+ groupKey = session.getPersistenceManager().createGroup("master", ORGANIZATION).getKey();
+
+ commit();
+
+ for (int i = 0; i < 50; i++)
+ {
+ log.fine("\n\n\n### Associate Group[" + i + "] of type DEPARTMENT to a Group" + groupKey + "\n");
+
+
+
+ begin();
+ String groupKey2 = session.getPersistenceManager().createGroupKey("test" + i, ORGANIZATION);
+ session.getRelationshipManager().associateGroupsByKeys(groupKey, groupKey2);
+ commit();
+
+ }
+
+
+
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,218 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.api;
-
-import org.jboss.identity.idm.api.IdentitySession;
-import org.jboss.identity.idm.api.User;
-import org.jboss.identity.idm.api.Group;
-import org.jboss.identity.idm.api.RoleType;
-import org.jboss.identity.idm.api.Role;
-import org.jboss.identity.idm.api.SortOrder;
-import org.jboss.identity.idm.api.query.UserQuery;
-import org.jboss.identity.idm.api.query.UserQueryBuilder;
-import junit.framework.Assert;
-
-import java.util.List;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class UserQueryTest extends Assert
-{
- private APITestContext ctx;
-
- private String ORGANIZATION = "ORGANIZATION";
-
- private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
-
- private String DEPARTMENT = "DEPARTMENT";
-
- public UserQueryTest(APITestContext testContext)
- {
- this.ctx = testContext;
- }
-
- public void testQuery(String realmName) throws Exception
- {
- ctx.begin();
-
- IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
-
- // Create stuff
-
- User user1 = ids.getPersistenceManager().createUser("user1");
- User user2 = ids.getPersistenceManager().createUser("user2");
- User user3 = ids.getPersistenceManager().createUser("user3");
- User user4 = ids.getPersistenceManager().createUser("user4");
- User testUser1 = ids.getPersistenceManager().createUser("testUser1");
- User testUser2 = ids.getPersistenceManager().createUser("testUser2");
- User testUser3 = ids.getPersistenceManager().createUser("testUser3");
- User testUser4 = ids.getPersistenceManager().createUser("testUser4");
-
- Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
- Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
- Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
- Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
- Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
-
- ids.getRelationshipManager().associateUser(group1, user1);
- ids.getRelationshipManager().associateUser(group1, user2);
-
- RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
- RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
- RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
- RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
-
- Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
- Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
- Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
-
- // Asserts
-
- //
- UserQueryBuilder qb = ids.createUserQueryBuilder();
-
- qb.withUserId("user1");
- UserQuery q = qb.createQuery();
-
- assertEquals(1, ids.execute(q).size());
- assertEquals(1, ids.list(q).size());
- assertEquals("user1", ids.uniqueResult(q).getKey());
-
- //
- qb.reset();
-
- qb.addAssociatedGroup(group2);
-
- assertEquals(0, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedGroup(group1);
-
- assertEquals(2, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedGroup(group1);
- qb.withUserId(user1.getKey());
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedGroup(group2);
- qb.withUserId(user1.getKey());
-
- assertEquals(0, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addAssociatedGroup(group1);
- qb.addGroupConnectedWithRole(group2);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
- assertEquals(user1, ids.uniqueResult(qb.createQuery()));
-
- //
- qb.reset();
-
- qb.addRelatedGroup(group1);
-
- assertEquals(2, ids.execute(qb.createQuery()).size());
-
- //
- qb.reset();
-
- qb.addRelatedGroup(group2);
- qb.addAssociatedGroup(group1);
-
- assertEquals(1, ids.execute(qb.createQuery()).size());
- assertEquals(user1, ids.uniqueResult(qb.createQuery()));
-
- //
- qb.reset();
-
- assertEquals(8, ids.execute(qb.createQuery()).size());
-
-
- // Criteria
-
- // All users
- qb.reset();
-
- assertEquals(8, ids.execute(qb.createQuery()).size());
-
- // All users sorted
- qb.reset();
- qb.sort(SortOrder.ASCENDING);
-
- List<User> results = ids.list(qb.createQuery());
-
- assertEquals(testUser1, results.get(0));
- assertEquals(user4, results.get(7));
-
- // All users sorted desc
- qb.reset();
- qb.sort(SortOrder.DESCENDING);
-
- results = ids.list(qb.createQuery());
-
- assertEquals(testUser1, results.get(7));
- assertEquals(user4, results.get(0));
-
- //
- qb.reset();
- qb.sort(SortOrder.DESCENDING);
- qb.idFilter("test*");
-
- results = ids.list(qb.createQuery());
-
- assertEquals(4, results.size());
- assertEquals(testUser1, results.get(3));
- assertEquals(testUser4, results.get(0));
-
- //
- qb.reset();
- qb.sort(SortOrder.ASCENDING);
- qb.idFilter("user*");
- qb.page(1, 2);
- results = ids.list(qb.createQuery());
-
- assertEquals(2, results.size());
- assertEquals(user2, results.get(0));
- assertEquals(user3, results.get(1));
-
-
-
- ctx.commit();
- }
-
-
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/api/UserQueryTest.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/api/UserQueryTest.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,218 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.api;
+
+import org.picketlink.idm.api.IdentitySession;
+import org.picketlink.idm.api.User;
+import org.picketlink.idm.api.Group;
+import org.picketlink.idm.api.RoleType;
+import org.picketlink.idm.api.Role;
+import org.picketlink.idm.api.SortOrder;
+import org.picketlink.idm.api.query.UserQuery;
+import org.picketlink.idm.api.query.UserQueryBuilder;
+import junit.framework.Assert;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UserQueryTest extends Assert
+{
+ private APITestContext ctx;
+
+ private String ORGANIZATION = "ORGANIZATION";
+
+ private String ORGANIZATION_UNIT = "ORGANIZATION_UNIT";
+
+ private String DEPARTMENT = "DEPARTMENT";
+
+ public UserQueryTest(APITestContext testContext)
+ {
+ this.ctx = testContext;
+ }
+
+ public void testQuery(String realmName) throws Exception
+ {
+ ctx.begin();
+
+ IdentitySession ids = ctx.getIdentitySessionFactory().getCurrentIdentitySession(realmName);
+
+ // Create stuff
+
+ User user1 = ids.getPersistenceManager().createUser("user1");
+ User user2 = ids.getPersistenceManager().createUser("user2");
+ User user3 = ids.getPersistenceManager().createUser("user3");
+ User user4 = ids.getPersistenceManager().createUser("user4");
+ User testUser1 = ids.getPersistenceManager().createUser("testUser1");
+ User testUser2 = ids.getPersistenceManager().createUser("testUser2");
+ User testUser3 = ids.getPersistenceManager().createUser("testUser3");
+ User testUser4 = ids.getPersistenceManager().createUser("testUser4");
+
+ Group group1 = ids.getPersistenceManager().createGroup("group1", ORGANIZATION);
+ Group group2 = ids.getPersistenceManager().createGroup("group2", ORGANIZATION_UNIT);
+ Group group3 = ids.getPersistenceManager().createGroup("group3", ORGANIZATION_UNIT);
+ Group group4 = ids.getPersistenceManager().createGroup("group4", DEPARTMENT);
+ Group group5 = ids.getPersistenceManager().createGroup("group5", DEPARTMENT);
+
+ ids.getRelationshipManager().associateUser(group1, user1);
+ ids.getRelationshipManager().associateUser(group1, user2);
+
+ RoleType rt1 = ids.getRoleManager().createRoleType("rt1");
+ RoleType rt2 = ids.getRoleManager().createRoleType("rt2");
+ RoleType rt3 = ids.getRoleManager().createRoleType("rt3");
+ RoleType rt4 = ids.getRoleManager().createRoleType("rt4");
+
+ Role role1 = ids.getRoleManager().createRole(rt1, user1, group1);
+ Role role2 = ids.getRoleManager().createRole(rt1, user1, group2);
+ Role role3 = ids.getRoleManager().createRole("rt2", user1.getKey(), group1.getKey());
+
+ // Asserts
+
+ //
+ UserQueryBuilder qb = ids.createUserQueryBuilder();
+
+ qb.withUserId("user1");
+ UserQuery q = qb.createQuery();
+
+ assertEquals(1, ids.execute(q).size());
+ assertEquals(1, ids.list(q).size());
+ assertEquals("user1", ids.uniqueResult(q).getKey());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.withUserId(user1.getKey());
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group2);
+ qb.withUserId(user1.getKey());
+
+ assertEquals(0, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addAssociatedGroup(group1);
+ qb.addGroupConnectedWithRole(group2);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group1);
+
+ assertEquals(2, ids.execute(qb.createQuery()).size());
+
+ //
+ qb.reset();
+
+ qb.addRelatedGroup(group2);
+ qb.addAssociatedGroup(group1);
+
+ assertEquals(1, ids.execute(qb.createQuery()).size());
+ assertEquals(user1, ids.uniqueResult(qb.createQuery()));
+
+ //
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+
+ // Criteria
+
+ // All users
+ qb.reset();
+
+ assertEquals(8, ids.execute(qb.createQuery()).size());
+
+ // All users sorted
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+
+ List<User> results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(0));
+ assertEquals(user4, results.get(7));
+
+ // All users sorted desc
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(testUser1, results.get(7));
+ assertEquals(user4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.DESCENDING);
+ qb.idFilter("test*");
+
+ results = ids.list(qb.createQuery());
+
+ assertEquals(4, results.size());
+ assertEquals(testUser1, results.get(3));
+ assertEquals(testUser4, results.get(0));
+
+ //
+ qb.reset();
+ qb.sort(SortOrder.ASCENDING);
+ qb.idFilter("user*");
+ qb.page(1, 2);
+ results = ids.list(qb.createQuery());
+
+ assertEquals(2, results.size());
+ assertEquals(user2, results.get(0));
+ assertEquals(user3, results.get(1));
+
+
+
+ ctx.commit();
+ }
+
+
+
+}
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/EvilBinaryTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,175 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.store.hibernate;
-
-import org.jboss.identity.idm.impl.model.hibernate.*;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.hibernate.Session;
-import org.hibernate.criterion.Projections;
-
-import java.util.*;
-
-
-/**
- * Simple test to show binary/blob issues in database
- *
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class EvilBinaryTestCase extends IdentityTestPOJO
-{
- public EvilBinaryTestCase()
- {
- }
-
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- @Test
- public void testBinary() throws Exception
- {
- begin();
-
- Session session = getSessionFactory().getCurrentSession();
-
-
- HibernateRealm realm = new HibernateRealm("default");
- session.persist(realm);
-
- HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
- session.persist(userType);
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
- session.persist(user1);
-
- Set<String> values1 = new HashSet<String>();
- values1.add("Val1");
- values1.add("Val2");
- values1.add("Val3");
-
- HibernateIdentityObjectAttribute attr = new HibernateIdentityObjectAttribute(user1, "simple1", HibernateIdentityObjectAttribute.TYPE_TEXT);
- attr.setTextValues(values1);
- user1.getAttributes().add(attr);
-
-
- commit();
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
-
- Random random = new Random();
-
- // Small
- byte[] picture = new byte[512000];
- random.nextBytes(picture);
-
- attr = new HibernateIdentityObjectAttribute(user1, "simple2", HibernateIdentityObjectAttribute.TYPE_BINARY);
- attr.setBinaryValue(new HibernateIdentityObjectAttributeBinaryValue(picture));
- user1.addAttribute(attr);
-
- values1 = new HashSet<String>();
- values1.add("Val1");
-
- attr = new HibernateIdentityObjectAttribute(user1, "simple3", HibernateIdentityObjectAttribute.TYPE_TEXT);
- attr.setTextValues(values1);
- user1.getAttributes().add(attr);
-
- values1 = new HashSet<String>();
- values1.add("Val8");
- values1.add("Val15");
-
- attr = new HibernateIdentityObjectAttribute(user1, "simple4", HibernateIdentityObjectAttribute.TYPE_TEXT);
- attr.setTextValues(values1);
- user1.getAttributes().add(attr);
-
- commit();
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
-
- // 900 kilobytes
- picture = new byte[921600];
-// picture = new byte[2];
- random.nextBytes(picture);
-
-
- attr = new HibernateIdentityObjectAttribute(user1, "simple5", HibernateIdentityObjectAttribute.TYPE_BINARY);
- attr.setBinaryValue(new HibernateIdentityObjectAttributeBinaryValue(picture));
- user1.getAttributes().add(attr);
-
- commit();
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
-
- assertEquals(5, user1.getAttributes().size());
-
- int binaryCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttributeBinaryValue.class).
- setProjection(Projections.rowCount()).uniqueResult()).intValue();
-
- assertEquals(2,binaryCount);
-
- int attrCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttribute.class).
- setProjection(Projections.rowCount()).uniqueResult()).intValue();
-
- assertEquals(5,attrCount);
-
- session.delete(user1);
-
- attrCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttribute.class).
- setProjection(Projections.rowCount()).uniqueResult()).intValue();
-
- assertEquals(0,attrCount);
-
- binaryCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttributeBinaryValue.class).
- setProjection(Projections.rowCount()).uniqueResult()).intValue();
-
- assertEquals(0,binaryCount);
-
-
- commit();
-
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/EvilBinaryTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/EvilBinaryTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,175 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.store.hibernate;
+
+import org.picketlink.idm.impl.model.hibernate.*;
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.hibernate.Session;
+import org.hibernate.criterion.Projections;
+
+import java.util.*;
+
+
+/**
+ * Simple test to show binary/blob issues in database
+ *
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class EvilBinaryTestCase extends IdentityTestPOJO
+{
+ public EvilBinaryTestCase()
+ {
+ }
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ @Test
+ public void testBinary() throws Exception
+ {
+ begin();
+
+ Session session = getSessionFactory().getCurrentSession();
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+
+ Set<String> values1 = new HashSet<String>();
+ values1.add("Val1");
+ values1.add("Val2");
+ values1.add("Val3");
+
+ HibernateIdentityObjectAttribute attr = new HibernateIdentityObjectAttribute(user1, "simple1", HibernateIdentityObjectAttribute.TYPE_TEXT);
+ attr.setTextValues(values1);
+ user1.getAttributes().add(attr);
+
+
+ commit();
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
+
+ Random random = new Random();
+
+ // Small
+ byte[] picture = new byte[512000];
+ random.nextBytes(picture);
+
+ attr = new HibernateIdentityObjectAttribute(user1, "simple2", HibernateIdentityObjectAttribute.TYPE_BINARY);
+ attr.setBinaryValue(new HibernateIdentityObjectAttributeBinaryValue(picture));
+ user1.addAttribute(attr);
+
+ values1 = new HashSet<String>();
+ values1.add("Val1");
+
+ attr = new HibernateIdentityObjectAttribute(user1, "simple3", HibernateIdentityObjectAttribute.TYPE_TEXT);
+ attr.setTextValues(values1);
+ user1.getAttributes().add(attr);
+
+ values1 = new HashSet<String>();
+ values1.add("Val8");
+ values1.add("Val15");
+
+ attr = new HibernateIdentityObjectAttribute(user1, "simple4", HibernateIdentityObjectAttribute.TYPE_TEXT);
+ attr.setTextValues(values1);
+ user1.getAttributes().add(attr);
+
+ commit();
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
+
+ // 900 kilobytes
+ picture = new byte[921600];
+// picture = new byte[2];
+ random.nextBytes(picture);
+
+
+ attr = new HibernateIdentityObjectAttribute(user1, "simple5", HibernateIdentityObjectAttribute.TYPE_BINARY);
+ attr.setBinaryValue(new HibernateIdentityObjectAttributeBinaryValue(picture));
+ user1.getAttributes().add(attr);
+
+ commit();
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
+
+ assertEquals(5, user1.getAttributes().size());
+
+ int binaryCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttributeBinaryValue.class).
+ setProjection(Projections.rowCount()).uniqueResult()).intValue();
+
+ assertEquals(2,binaryCount);
+
+ int attrCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttribute.class).
+ setProjection(Projections.rowCount()).uniqueResult()).intValue();
+
+ assertEquals(5,attrCount);
+
+ session.delete(user1);
+
+ attrCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttribute.class).
+ setProjection(Projections.rowCount()).uniqueResult()).intValue();
+
+ assertEquals(0,attrCount);
+
+ binaryCount = ((Integer)session.createCriteria(HibernateIdentityObjectAttributeBinaryValue.class).
+ setProjection(Projections.rowCount()).uniqueResult()).intValue();
+
+ assertEquals(0,binaryCount);
+
+
+ commit();
+
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,376 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.store.hibernate;
-
-import org.jboss.identity.idm.spi.model.IdentityObject;
-import org.jboss.identity.idm.spi.model.IdentityObjectAttribute;
-import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.idm.spi.store.IdentityStore;
-import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
-import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
-import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
-import org.jboss.identity.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
-import org.jboss.identity.idm.impl.store.IdentityTypeEnum;
-import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
-import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
-import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.impl.api.SimpleAttribute;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.common.exception.IdentityException;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-
-import java.util.Map;
-import java.util.Random;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class HibernateIdentityStoreTestCase extends IdentityTestPOJO implements IdentityStoreTestContext
-{
-
- protected HibernateIdentityStoreImpl store;
-
- protected IdentityStoreInvocationContext ctx;
-
- protected CommonIdentityStoreTest commonTest;
-
- public HibernateIdentityStoreTestCase()
- {
-
- }
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
-
- setIdentityConfig("store-test-config.xml");
-
- commonTest = new CommonIdentityStoreTest(this);
-
- IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
- .createConfigurationMetaData(getIdentityConfig());
-
- IdentityConfigurationContextRegistry identityConfiguration = (IdentityConfigurationContextRegistry)
- new IdentityConfigurationImpl().configure(configurationMD);
-
- IdentityStoreConfigurationMetaData storeMD = null;
-
- for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
- {
- if (metaData.getId().equals("HibernateTestStore"))
- {
- storeMD = metaData;
- break;
- }
- }
-
- IdentityStoreConfigurationContext context =
- new IdentityStoreConfigurationContextImpl(configurationMD, identityConfiguration, storeMD);
-
- store = new HibernateIdentityStoreImpl("HibernateTestStore")
- {
-
- @Override
- protected Session getHibernateSession(IdentityStoreInvocationContext ctx)
- {
- return getHibernateSupport().getSessionFactory().getCurrentSession();
- }
-
- @Override
- protected SessionFactory bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext) throws IdentityException
- {
- return getHibernateSupport().getSessionFactory();
- }
-
- };
-
- store.bootstrap(context);
-
-
- ctx = new IdentityStoreInvocationContext()
- {
- public IdentityStoreSession getIdentityStoreSession()
- {
- return null;
- }
-
- public String getRealmId()
- {
- return "testRealm";
- }
-
- public String getSessionId()
- {
- return "";
- }
- };
-
-
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- super.stop();
- }
-
- public void begin()
- {
- getHibernateSupport().openSession();
- }
-
- public void commit()
- {
- assertTrue(getHibernateSupport().commitTransaction());
- }
-
- public void flush() throws Exception
- {
-
- getHibernateSupport().getSessionFactory().getCurrentSession().flush();
- }
-
- public IdentityStore getStore()
- {
- return store;
- }
-
- public IdentityStoreInvocationContext getCtx()
- {
- return ctx;
- }
-
- // Tests
-
- @Test
- public void testStorePersistence() throws Exception
- {
-
- commonTest.testStorePersistence();
-
- }
-
- @Test
- public void testFindMethods() throws Exception
- {
-
- commonTest.testFindMethods();
-
- }
-
- public void testBinaryAttributes() throws Exception
- {
- begin();
-
- IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
- IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
-
- flush();
-
- IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
- new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- Random random = new Random();
-
- // 900 kilobytes
- byte[] picture1 = new byte[921600];
- random.nextBytes(picture1);
- byte[] picture2 = new byte[921600];
- random.nextBytes(picture2);
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key1", new byte[][]{picture1}),
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key2", new byte[][]{picture1, picture2}),
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key1", new byte[][]{picture2}),
- };
-
- store.updateAttributes(ctx, user1, attrs);
-
- store.removeAttributes(ctx, user1, new String[]{"key1", "key2"});
-
- assertNull(store.findIdentityObjectByUniqueAttribute(ctx, IdentityTypeEnum.USER, new SimpleAttribute("key1", new String[]{"toto"})));
-
-
- commit();
- }
-
- @Test
- public void testAttributes() throws Exception
- {
-
- begin();
-
- IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
- IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
-
- flush();
-
- IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
- new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(2, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").getSize());
-
- assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").getSize());
-
- flush();
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key3", new String[]{"val1"})
- };
-
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key1"));
- assertEquals(3, persistedAttrs.get("key1").getSize());
-
- assertTrue(persistedAttrs.containsKey("key2"));
- assertEquals(4, persistedAttrs.get("key2").getSize());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").getSize());
-
- flush();
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key3", new String[]{"val2"})
- };
-
- store.addAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(2, persistedAttrs.get("key3").getSize());
-
- flush();
-
- store.updateAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
- assertTrue(persistedAttrs.containsKey("key3"));
- assertEquals(1, persistedAttrs.get("key3").getSize());
-
- flush();
-
- attrs = new IdentityObjectAttribute[]{
- new SimpleAttribute("key4", new String[]{"val2"})
- };
-
- store.updateAttributes(ctx, user1, attrs);
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(4, persistedAttrs.keySet().size());
- assertEquals("val2", persistedAttrs.get("key4").getValue().toString());
-
-
- store.removeAttributes(ctx, user1, new String[] {"key3"});
-
- flush();
-
- persistedAttrs = store.getAttributes(ctx, user1);
-
- assertEquals(3, persistedAttrs.keySet().size());
-
-
- commit();
-
- }
-
- @Test
- public void testRelationships() throws Exception
- {
- commonTest.testRelationships();
- }
-
- @Test
- public void testPasswordCredentials() throws Exception
- {
- commonTest.testPasswordCredential();
- }
-
- public void testBinaryCredentials() throws Exception
- {
- commonTest.testBinaryCredential();
- }
-
- @Test
- public void testCriteria() throws Exception
- {
- commonTest.testCriteria();
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateIdentityStoreTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,376 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.store.hibernate;
+
+import org.picketlink.idm.spi.model.IdentityObject;
+import org.picketlink.idm.spi.model.IdentityObjectAttribute;
+import org.picketlink.idm.spi.store.IdentityStoreInvocationContext;
+import org.picketlink.idm.spi.store.IdentityStore;
+import org.picketlink.idm.spi.store.IdentityStoreSession;
+import org.picketlink.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.picketlink.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.picketlink.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.picketlink.idm.impl.store.hibernate.HibernateIdentityStoreImpl;
+import org.picketlink.idm.impl.store.IdentityTypeEnum;
+import org.picketlink.idm.impl.store.CommonIdentityStoreTest;
+import org.picketlink.idm.impl.store.IdentityStoreTestContext;
+import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.picketlink.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.impl.api.SimpleAttribute;
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.common.exception.IdentityException;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+import java.util.Map;
+import java.util.Random;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateIdentityStoreTestCase extends IdentityTestPOJO implements IdentityStoreTestContext
+{
+
+ protected HibernateIdentityStoreImpl store;
+
+ protected IdentityStoreInvocationContext ctx;
+
+ protected CommonIdentityStoreTest commonTest;
+
+ public HibernateIdentityStoreTestCase()
+ {
+
+ }
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+ setIdentityConfig("store-test-config.xml");
+
+ commonTest = new CommonIdentityStoreTest(this);
+
+ IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
+ .createConfigurationMetaData(getIdentityConfig());
+
+ IdentityConfigurationContextRegistry identityConfiguration = (IdentityConfigurationContextRegistry)
+ new IdentityConfigurationImpl().configure(configurationMD);
+
+ IdentityStoreConfigurationMetaData storeMD = null;
+
+ for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
+ {
+ if (metaData.getId().equals("HibernateTestStore"))
+ {
+ storeMD = metaData;
+ break;
+ }
+ }
+
+ IdentityStoreConfigurationContext context =
+ new IdentityStoreConfigurationContextImpl(configurationMD, identityConfiguration, storeMD);
+
+ store = new HibernateIdentityStoreImpl("HibernateTestStore")
+ {
+
+ @Override
+ protected Session getHibernateSession(IdentityStoreInvocationContext ctx)
+ {
+ return getHibernateSupport().getSessionFactory().getCurrentSession();
+ }
+
+ @Override
+ protected SessionFactory bootstrapHibernateSessionFactory(IdentityStoreConfigurationContext configurationContext) throws IdentityException
+ {
+ return getHibernateSupport().getSessionFactory();
+ }
+
+ };
+
+ store.bootstrap(context);
+
+
+ ctx = new IdentityStoreInvocationContext()
+ {
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return null;
+ }
+
+ public String getRealmId()
+ {
+ return "testRealm";
+ }
+
+ public String getSessionId()
+ {
+ return "";
+ }
+ };
+
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ public void begin()
+ {
+ getHibernateSupport().openSession();
+ }
+
+ public void commit()
+ {
+ assertTrue(getHibernateSupport().commitTransaction());
+ }
+
+ public void flush() throws Exception
+ {
+
+ getHibernateSupport().getSessionFactory().getCurrentSession().flush();
+ }
+
+ public IdentityStore getStore()
+ {
+ return store;
+ }
+
+ public IdentityStoreInvocationContext getCtx()
+ {
+ return ctx;
+ }
+
+ // Tests
+
+ @Test
+ public void testStorePersistence() throws Exception
+ {
+
+ commonTest.testStorePersistence();
+
+ }
+
+ @Test
+ public void testFindMethods() throws Exception
+ {
+
+ commonTest.testFindMethods();
+
+ }
+
+ public void testBinaryAttributes() throws Exception
+ {
+ begin();
+
+ IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+ IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+
+ flush();
+
+ IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ Random random = new Random();
+
+ // 900 kilobytes
+ byte[] picture1 = new byte[921600];
+ random.nextBytes(picture1);
+ byte[] picture2 = new byte[921600];
+ random.nextBytes(picture2);
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key1", new byte[][]{picture1}),
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key2", new byte[][]{picture1, picture2}),
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key1", new byte[][]{picture2}),
+ };
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ store.removeAttributes(ctx, user1, new String[]{"key1", "key2"});
+
+ assertNull(store.findIdentityObjectByUniqueAttribute(ctx, IdentityTypeEnum.USER, new SimpleAttribute("key1", new String[]{"toto"})));
+
+
+ commit();
+ }
+
+ @Test
+ public void testAttributes() throws Exception
+ {
+
+ begin();
+
+ IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+ IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+
+ flush();
+
+ IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key1", new String[]{"val1", "val2", "val3"}),
+ new SimpleAttribute("key2", new String[]{"val1", "val2", "val3", "val4"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(2, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key1"));
+ assertEquals(3, persistedAttrs.get("key1").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key2"));
+ assertEquals(4, persistedAttrs.get("key2").getSize());
+
+ flush();
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key3", new String[]{"val1"})
+ };
+
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key1"));
+ assertEquals(3, persistedAttrs.get("key1").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key2"));
+ assertEquals(4, persistedAttrs.get("key2").getSize());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(1, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key3", new String[]{"val2"})
+ };
+
+ store.addAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(2, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+ assertTrue(persistedAttrs.containsKey("key3"));
+ assertEquals(1, persistedAttrs.get("key3").getSize());
+
+ flush();
+
+ attrs = new IdentityObjectAttribute[]{
+ new SimpleAttribute("key4", new String[]{"val2"})
+ };
+
+ store.updateAttributes(ctx, user1, attrs);
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(4, persistedAttrs.keySet().size());
+ assertEquals("val2", persistedAttrs.get("key4").getValue().toString());
+
+
+ store.removeAttributes(ctx, user1, new String[] {"key3"});
+
+ flush();
+
+ persistedAttrs = store.getAttributes(ctx, user1);
+
+ assertEquals(3, persistedAttrs.keySet().size());
+
+
+ commit();
+
+ }
+
+ @Test
+ public void testRelationships() throws Exception
+ {
+ commonTest.testRelationships();
+ }
+
+ @Test
+ public void testPasswordCredentials() throws Exception
+ {
+ commonTest.testPasswordCredential();
+ }
+
+ public void testBinaryCredentials() throws Exception
+ {
+ commonTest.testBinaryCredential();
+ }
+
+ @Test
+ public void testCriteria() throws Exception
+ {
+ commonTest.testCriteria();
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,344 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.store.hibernate;
-
-import org.jboss.identity.idm.impl.model.hibernate.*;
-import org.jboss.identity.idm.impl.IdentityTestPOJO;
-import org.jboss.identity.idm.impl.api.PasswordCredential;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Test;
-import org.hibernate.Session;
-import org.hibernate.Query;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class HibernateModelTestCase extends IdentityTestPOJO
-{
- public HibernateModelTestCase()
- {
- }
-
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
- @Test
- public void testPersistence() {
-
-
- begin();
- Session session = getSessionFactory().getCurrentSession();
-
-
- HibernateRealm defaultRealm = new HibernateRealm("default");
- session.persist(defaultRealm);
-
- Map<String, String> props = new HashMap<String, String>();
- props.put("test", "testValue");
- defaultRealm.setProperties(props);
-
- defaultRealm = (HibernateRealm)session.get(HibernateRealm.class, defaultRealm.getId());
-
- assertEquals(defaultRealm.getProperties().keySet().size(), 1);
-
- //
-
- HibernateIdentityObjectType iot = new HibernateIdentityObjectType();
- iot.setName("User");
-
- session.persist(iot);
- assertTrue(session.contains(iot));
-
-
- HibernateIdentityObject io = new HibernateIdentityObject();
- io.setName("John Kowalski");
- io.setRealm(defaultRealm);
- io.setIdentityType(iot);
-
- session.persist(io);
- assertTrue(session.contains(io));
-
- session.delete(io);
- assertFalse(session.contains(io));
-
- //
-
-
-
- //
-
- HibernateIdentityObjectRelationshipType iort = new HibernateIdentityObjectRelationshipType();
- iort.setName("Member");
-
- session.persist(iort);
- assertTrue(session.contains(iort));
-
- assertTrue(session.contains(iort));
-
- session.delete(iort);
- assertFalse(session.contains(iort));
-
- commit();
-
-
- }
-
- @Test
- public void testRelationships()
- {
- begin();
-
-
- Session session = getSessionFactory().getCurrentSession();
-
-
- HibernateRealm realm = new HibernateRealm("default");
- session.persist(realm);
-
- HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
- session.persist(groupType);
- HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
- session.persist(userType);
-
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
- session.persist(user1);
- HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
- session.persist(user2);
- HibernateIdentityObject user3 = new HibernateIdentityObject("user3", userType, realm);
- session.persist(user3);
-
- HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
- session.persist(group1);
- HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
- session.persist(group2);
- HibernateIdentityObject group3 = new HibernateIdentityObject("group3", groupType, realm);
- session.persist(group3);
-
- HibernateIdentityObjectRelationshipType memberType = new HibernateIdentityObjectRelationshipType("member");
- session.persist(memberType);
-
- HibernateIdentityObjectRelationship relationship = new HibernateIdentityObjectRelationship(memberType, group1, user1);
- session.persist(relationship);
- relationship = new HibernateIdentityObjectRelationship(memberType, group1, user2);
- session.persist(relationship);
- relationship = new HibernateIdentityObjectRelationship(memberType, group2, user3);
- session.persist(relationship);
- relationship = new HibernateIdentityObjectRelationship(memberType, group2, group1);
- session.persist(relationship);
-
- commit();
-
- //
-
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- Query ioQuery = session.createQuery("select o from HibernateIdentityObject o where o.name like :name");
-
- group1 = (HibernateIdentityObject)ioQuery.setParameter("name", "group1").uniqueResult();
- assertEquals(2, group1.getFromRelationships().size());
- assertEquals(1, group1.getToRelationships().size());
- group2 = (HibernateIdentityObject)ioQuery.setParameter("name", "group2").uniqueResult();
- assertEquals(2, group2.getFromRelationships().size());
- assertEquals(0, group2.getToRelationships().size());
-
- user3 = (HibernateIdentityObject)ioQuery.setParameter("name", "user3").uniqueResult();
- assertEquals(1, user3.getToRelationships().size());
- assertEquals(0, user3.getFromRelationships().size());
- assertEquals("group2", user3.getToRelationships().iterator().next().getFromIdentityObject().getName());
- commit();
-
- }
-
- @Test
- public void testNameTypeConstraint() throws Exception
- {
-
- begin();
- Session session = getSessionFactory().getCurrentSession();
-
-
-
- HibernateRealm realm = new HibernateRealm("default");
- session.persist(realm);
-
- HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
- session.persist(groupType);
- HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
- session.persist(userType);
-
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
- session.persist(user1);
- HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
- session.persist(user2);
-
- commit();
-
-
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- try
- {
-
- HibernateIdentityObject user3 = new HibernateIdentityObject("user2", userType, realm);
- session.persist(user3);
-
- assertFalse(getHibernateSupport().commitTransaction());
-
- }
- catch (Exception e)
- {
- // may be expected
- getHibernateSupport().rollbackTransaction();
- }
-
-
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
-
- HibernateIdentityObject user4 = new HibernateIdentityObject("group1", userType, realm);
- session.persist(user4);
-
-
- HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
- session.persist(group1);
- HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
- session.persist(group2);
-
- //session.flush();
-
- try
- {
-
- HibernateIdentityObject group3 = new HibernateIdentityObject("group2", groupType, realm);
- session.persist(group3);
-
- // Should fail
- assertFalse(getHibernateSupport().commitTransaction());
- }
- catch (Exception e)
- {
- //expected
- getHibernateSupport().rollbackTransaction();
- }
-
-
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- HibernateIdentityObject group4 = new HibernateIdentityObject("user1", groupType, realm);
- session.persist(group4);
-
- session.flush();
-
- commit();
-
-
-
-
-
- }
-
- @Test
- public void testAttributes() throws Exception
- {
- begin();
-
- Session session = getSessionFactory().getCurrentSession();
-
-
-
-
- HibernateRealm realm = new HibernateRealm("default");
- session.persist(realm);
-
- HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
- session.persist(userType);
- HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
- session.persist(user1);
-
- Set<String> values1 = new HashSet<String>();
- values1.add("Val1");
- values1.add("Val2");
- values1.add("Val3");
-
- HibernateIdentityObjectAttribute attr = new HibernateIdentityObjectAttribute(user1, "simple1", HibernateIdentityObjectAttribute.TYPE_TEXT);
- attr.setTextValues(values1);
- user1.getAttributes().add(attr);
- attr = new HibernateIdentityObjectAttribute(user1, "simple2", HibernateIdentityObjectAttribute.TYPE_TEXT);
- attr.setTextValues(values1);
- user1.getAttributes().add(attr);
-
-
-
-
-
-
-
- commit();
-
-
-
- begin();
-
- session = getSessionFactory().getCurrentSession();
-
- user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
- assertEquals(2, user1.getAttributes().size() );
-// assertNotNull(user1.getProfileAttributes().get("simple1"));
-// assertEquals(3, user1.getProfileAttributes().get("simple1").length);
-
-
- commit();
-
- }
-
-}
\ No newline at end of file
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/hibernate/HibernateModelTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/hibernate/HibernateModelTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,344 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.store.hibernate;
+
+import org.picketlink.idm.impl.model.hibernate.*;
+import org.picketlink.idm.impl.IdentityTestPOJO;
+import org.picketlink.idm.impl.api.PasswordCredential;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Test;
+import org.hibernate.Session;
+import org.hibernate.Query;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class HibernateModelTestCase extends IdentityTestPOJO
+{
+ public HibernateModelTestCase()
+ {
+ }
+
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+ @Test
+ public void testPersistence() {
+
+
+ begin();
+ Session session = getSessionFactory().getCurrentSession();
+
+
+ HibernateRealm defaultRealm = new HibernateRealm("default");
+ session.persist(defaultRealm);
+
+ Map<String, String> props = new HashMap<String, String>();
+ props.put("test", "testValue");
+ defaultRealm.setProperties(props);
+
+ defaultRealm = (HibernateRealm)session.get(HibernateRealm.class, defaultRealm.getId());
+
+ assertEquals(defaultRealm.getProperties().keySet().size(), 1);
+
+ //
+
+ HibernateIdentityObjectType iot = new HibernateIdentityObjectType();
+ iot.setName("User");
+
+ session.persist(iot);
+ assertTrue(session.contains(iot));
+
+
+ HibernateIdentityObject io = new HibernateIdentityObject();
+ io.setName("John Kowalski");
+ io.setRealm(defaultRealm);
+ io.setIdentityType(iot);
+
+ session.persist(io);
+ assertTrue(session.contains(io));
+
+ session.delete(io);
+ assertFalse(session.contains(io));
+
+ //
+
+
+
+ //
+
+ HibernateIdentityObjectRelationshipType iort = new HibernateIdentityObjectRelationshipType();
+ iort.setName("Member");
+
+ session.persist(iort);
+ assertTrue(session.contains(iort));
+
+ assertTrue(session.contains(iort));
+
+ session.delete(iort);
+ assertFalse(session.contains(iort));
+
+ commit();
+
+
+ }
+
+ @Test
+ public void testRelationships()
+ {
+ begin();
+
+
+ Session session = getSessionFactory().getCurrentSession();
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
+ session.persist(groupType);
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user2);
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user3", userType, realm);
+ session.persist(user3);
+
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
+ session.persist(group1);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group2);
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group3", groupType, realm);
+ session.persist(group3);
+
+ HibernateIdentityObjectRelationshipType memberType = new HibernateIdentityObjectRelationshipType("member");
+ session.persist(memberType);
+
+ HibernateIdentityObjectRelationship relationship = new HibernateIdentityObjectRelationship(memberType, group1, user1);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group1, user2);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group2, user3);
+ session.persist(relationship);
+ relationship = new HibernateIdentityObjectRelationship(memberType, group2, group1);
+ session.persist(relationship);
+
+ commit();
+
+ //
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ Query ioQuery = session.createQuery("select o from HibernateIdentityObject o where o.name like :name");
+
+ group1 = (HibernateIdentityObject)ioQuery.setParameter("name", "group1").uniqueResult();
+ assertEquals(2, group1.getFromRelationships().size());
+ assertEquals(1, group1.getToRelationships().size());
+ group2 = (HibernateIdentityObject)ioQuery.setParameter("name", "group2").uniqueResult();
+ assertEquals(2, group2.getFromRelationships().size());
+ assertEquals(0, group2.getToRelationships().size());
+
+ user3 = (HibernateIdentityObject)ioQuery.setParameter("name", "user3").uniqueResult();
+ assertEquals(1, user3.getToRelationships().size());
+ assertEquals(0, user3.getFromRelationships().size());
+ assertEquals("group2", user3.getToRelationships().iterator().next().getFromIdentityObject().getName());
+ commit();
+
+ }
+
+ @Test
+ public void testNameTypeConstraint() throws Exception
+ {
+
+ begin();
+ Session session = getSessionFactory().getCurrentSession();
+
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType groupType = new HibernateIdentityObjectType("Group");
+ session.persist(groupType);
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+ HibernateIdentityObject user2 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user2);
+
+ commit();
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ try
+ {
+
+ HibernateIdentityObject user3 = new HibernateIdentityObject("user2", userType, realm);
+ session.persist(user3);
+
+ assertFalse(getHibernateSupport().commitTransaction());
+
+ }
+ catch (Exception e)
+ {
+ // may be expected
+ getHibernateSupport().rollbackTransaction();
+ }
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+
+ HibernateIdentityObject user4 = new HibernateIdentityObject("group1", userType, realm);
+ session.persist(user4);
+
+
+ HibernateIdentityObject group1 = new HibernateIdentityObject("group1", groupType, realm);
+ session.persist(group1);
+ HibernateIdentityObject group2 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group2);
+
+ //session.flush();
+
+ try
+ {
+
+ HibernateIdentityObject group3 = new HibernateIdentityObject("group2", groupType, realm);
+ session.persist(group3);
+
+ // Should fail
+ assertFalse(getHibernateSupport().commitTransaction());
+ }
+ catch (Exception e)
+ {
+ //expected
+ getHibernateSupport().rollbackTransaction();
+ }
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ HibernateIdentityObject group4 = new HibernateIdentityObject("user1", groupType, realm);
+ session.persist(group4);
+
+ session.flush();
+
+ commit();
+
+
+
+
+
+ }
+
+ @Test
+ public void testAttributes() throws Exception
+ {
+ begin();
+
+ Session session = getSessionFactory().getCurrentSession();
+
+
+
+
+ HibernateRealm realm = new HibernateRealm("default");
+ session.persist(realm);
+
+ HibernateIdentityObjectType userType = new HibernateIdentityObjectType("User");
+ session.persist(userType);
+ HibernateIdentityObject user1 = new HibernateIdentityObject("user1", userType, realm);
+ session.persist(user1);
+
+ Set<String> values1 = new HashSet<String>();
+ values1.add("Val1");
+ values1.add("Val2");
+ values1.add("Val3");
+
+ HibernateIdentityObjectAttribute attr = new HibernateIdentityObjectAttribute(user1, "simple1", HibernateIdentityObjectAttribute.TYPE_TEXT);
+ attr.setTextValues(values1);
+ user1.getAttributes().add(attr);
+ attr = new HibernateIdentityObjectAttribute(user1, "simple2", HibernateIdentityObjectAttribute.TYPE_TEXT);
+ attr.setTextValues(values1);
+ user1.getAttributes().add(attr);
+
+
+
+
+
+
+
+ commit();
+
+
+
+ begin();
+
+ session = getSessionFactory().getCurrentSession();
+
+ user1 = (HibernateIdentityObject)session.get(HibernateIdentityObject.class, new Long(user1.getId()));
+ assertEquals(2, user1.getAttributes().size() );
+// assertNotNull(user1.getProfileAttributes().get("simple1"));
+// assertEquals(3, user1.getProfileAttributes().get("simple1").length);
+
+
+ commit();
+
+ }
+
+}
\ No newline at end of file
Deleted: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-18 13:42:38 UTC (rev 1005)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -1,376 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-
-package org.jboss.identity.idm.impl.store.ldap;
-
-import org.jboss.identity.idm.impl.LDAPTestPOJO;
-import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
-import org.jboss.identity.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
-import org.jboss.identity.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
-import org.jboss.identity.idm.impl.store.CommonIdentityStoreTest;
-import org.jboss.identity.idm.impl.store.IdentityStoreTestContext;
-import org.jboss.identity.idm.spi.configuration.IdentityConfigurationContextRegistry;
-import org.jboss.identity.idm.spi.configuration.IdentityStoreConfigurationContext;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
-import org.jboss.identity.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
-import org.jboss.identity.idm.spi.store.IdentityStore;
-import org.jboss.identity.idm.spi.store.IdentityStoreInvocationContext;
-import org.jboss.identity.idm.spi.store.IdentityStoreSession;
-import org.jboss.unit.api.pojo.annotations.Create;
-import org.jboss.unit.api.pojo.annotations.Destroy;
-import org.jboss.unit.api.pojo.annotations.Test;
-
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
-import javax.naming.ldap.LdapContext;
-
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class LDAPIdentityStoreTestCase extends LDAPTestPOJO implements IdentityStoreTestContext
-{
-
- CommonIdentityStoreTest commonTest;
-
- IdentityStoreInvocationContext ctx;
-
- IdentityStore store;
-
- public LDAPIdentityStoreTestCase()
- {
-
- }
-
- @Create
- public void setUp() throws Exception
- {
- super.start();
-
-// setIdentityConfig("store-test-config.xml");
-
- commonTest = new CommonIdentityStoreTest(this);
-
- IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
- .createConfigurationMetaData(getIdentityConfig());
-
- IdentityConfigurationContextRegistry registry = (IdentityConfigurationContextRegistry) new IdentityConfigurationImpl().
- configure(configurationMD);
-
- IdentityStoreConfigurationMetaData storeMD = null;
-
- for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
- {
- if (metaData.getId().equals("LDAP Identity Store"))
- {
- storeMD = metaData;
- break;
- }
- }
-
- IdentityStoreConfigurationContext context = new IdentityStoreConfigurationContextImpl(configurationMD, registry, storeMD);
-
-
-
- //populate();
-
- store = new LDAPIdentityStoreImpl("LDAP Identity Store");
-
- store.bootstrap(context);
-
- final IdentityStoreSession storeSession = store.createIdentityStoreSession();
-
- ctx = new IdentityStoreInvocationContext()
- {
- public IdentityStoreSession getIdentityStoreSession()
- {
- return storeSession;
- }
-
- public String getRealmId()
- {
- return "testRealm";
- }
-
- public String getSessionId()
- {
- return "";
- }
- };
- }
-
- @Destroy
- public void tearDown() throws Exception
- {
- super.stop();
- }
-
-
- public void flush() throws Exception
- {
- //nothing
- }
-
- public IdentityStore getStore()
- {
- return store;
- }
-
- public IdentityStoreInvocationContext getCtx()
- {
- return ctx;
- }
-
-
- // Tests
-
-// Just test if OpenDS is running and was populated...
- @Test
- public void testSimple() throws Exception
- {
- populateClean();
-
- Hashtable<String,String> env = new Hashtable<String,String>();
- env.put(Context.INITIAL_CONTEXT_FACTORY, directoryConfig.getContextFactory());
- env.put(Context.PROVIDER_URL, directoryConfig.getDescription());
- env.put(Context.SECURITY_AUTHENTICATION, "simple");
- env.put(Context.SECURITY_PRINCIPAL, directoryConfig.getAdminDN());
- env.put(Context.SECURITY_CREDENTIALS, directoryConfig.getAdminPassword());
-
- LdapContext ldapCtx = null;
- try
- {
- ldapCtx = new InitialLdapContext(env, null);
-
-// Do something ...
- System.out.println("Attributes: " + ldapCtx.getAttributes(directoryConfig.getCleanUpDN()));
-
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- finally
- {
- try
- {
- if (ldapCtx != null)
- {
- ldapCtx.close();
- }
- }
- catch (NamingException e)
- {
- e.printStackTrace();
- }
- }
- }
-
-// @Test
-// public void testIdentityObjectCount() throws Exception
-// {
-// populate();
-//
-// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-// assertEquals(5, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.ROLE));
-// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
-// }
-//
-// @Test
-// public void testFindCreateRemove() throws Exception
-// {
-// populate();
-//
-// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-//
-// IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
-// assertEquals("admin", io.getName());
-// assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getKey().toString());
-//
-// //
-//
-// store.removeIdentityObject(ctx, io);
-//
-// assertEquals(6, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-//
-// store.createIdentityObject(ctx, "newUserA", IdentityTypeEnum.USER);
-//
-// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
-//
-// //
-//
-// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
-//
-// store.createIdentityObject(ctx, "newGroupA", IdentityTypeEnum.GROUP);
-//
-// assertEquals(3, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
-//
-// //
-//
-// io = store.findIdentityObject(ctx, "cn=newGroupA,ou=Groups,o=test,dc=portal,dc=example,dc=com");
-// assertEquals("newGroupA", io.getName());
-//
-// }
-
-// @Test
-// public void testAttributes() throws Exception{
-//
-// populate();
-//
-// IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
-// IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
-//
-// //
-//
-// IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
-// new SimpleAttribute("phone", new String[]{"val1"}),
-// new SimpleAttribute("description", new String[]{"val1", "val2", "val3", "val4"}),
-//
-// };
-//
-// store.addAttributes(ctx, user1, attrs);
-//
-// //
-//
-// Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
-//
-// assertEquals(2, persistedAttrs.keySet().size());
-//
-// assertTrue(persistedAttrs.containsKey("phone"));
-// assertEquals(1, persistedAttrs.get("phone").getSize());
-//
-// assertTrue(persistedAttrs.containsKey("description"));
-// assertEquals(4, persistedAttrs.get("description").getSize());
-//
-// //
-//
-// attrs = new IdentityObjectAttribute[]{
-// new SimpleAttribute("carLicense", new String[]{"val1"})
-// };
-//
-// store.addAttributes(ctx, user1, attrs);
-//
-// //
-//
-// persistedAttrs = store.getAttributes(ctx, user1);
-//
-// assertEquals(3, persistedAttrs.keySet().size());
-//
-// assertTrue(persistedAttrs.containsKey("phone"));
-// assertEquals(1, persistedAttrs.get("phone").getSize());
-//
-// assertTrue(persistedAttrs.containsKey("description"));
-// assertEquals(4, persistedAttrs.get("description").getSize());
-//
-// assertTrue(persistedAttrs.containsKey("carLicense"));
-// assertEquals(1, persistedAttrs.get("carLicense").getSize());
-//
-// attrs = new IdentityObjectAttribute[]{
-// new SimpleAttribute("carLicense", new String[]{"val2"})
-// };
-//
-// store.addAttributes(ctx, user1, attrs);
-//
-// //
-//
-// persistedAttrs = store.getAttributes(ctx, user1);
-//
-// assertEquals(3, persistedAttrs.keySet().size());
-//
-// assertTrue(persistedAttrs.containsKey("carLicense"));
-// assertEquals(2, persistedAttrs.get("carLicense").getSize());
-//
-// //
-//
-// store.updateAttributes(ctx, user1, attrs);
-//
-// //
-//
-// persistedAttrs = store.getAttributes(ctx, user1);
-//
-// assertEquals(3, persistedAttrs.keySet().size());
-//
-// assertTrue(persistedAttrs.containsKey("carLicense"));
-// assertEquals(1, persistedAttrs.get("carLicense").getSize());
-//
-// //
-//
-// String[] names = new String[]{"carLicense"};
-// store.removeAttributes(ctx, user1, names);
-//
-// //
-//
-// persistedAttrs = store.getAttributes(ctx, user1);
-//
-// assertEquals(2, persistedAttrs.keySet().size());
-//
-// }
-
- @Test
- public void testRelationships() throws Exception
- {
- populateClean();
-
- commonTest.testRelationships();
-
- }
-
- @Test
- public void testStorePersistence() throws Exception
- {
- populateClean();
-
- commonTest.testStorePersistence();
-
- }
-
- @Test
- public void testFindMethods() throws Exception
- {
- populateClean();
-
- commonTest.testFindMethods();
-
- }
-
- @Test
- public void testCriteria() throws Exception
- {
- populateClean();
-
- commonTest.testCriteria();
- }
-
-
- @Test
- public void testCredentials() throws Exception
- {
- populateClean();
-
- commonTest.testPasswordCredential();
- }
-
-}
Copied: migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java (from rev 1007, migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/jboss/identity/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java)
===================================================================
--- migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java (rev 0)
+++ migration/idm/trunk/picketlink-idm-testsuite/src/test/java/org/picketlink/idm/impl/store/ldap/LDAPIdentityStoreTestCase.java 2009-11-18 15:27:05 UTC (rev 1013)
@@ -0,0 +1,376 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.picketlink.idm.impl.store.ldap;
+
+import org.picketlink.idm.impl.LDAPTestPOJO;
+import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl;
+import org.picketlink.idm.impl.configuration.IdentityStoreConfigurationContextImpl;
+import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration;
+import org.picketlink.idm.impl.store.CommonIdentityStoreTest;
+import org.picketlink.idm.impl.store.IdentityStoreTestContext;
+import org.picketlink.idm.spi.configuration.IdentityConfigurationContextRegistry;
+import org.picketlink.idm.spi.configuration.IdentityStoreConfigurationContext;
+import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData;
+import org.picketlink.idm.spi.configuration.metadata.IdentityStoreConfigurationMetaData;
+import org.picketlink.idm.spi.store.IdentityStore;
+import org.picketlink.idm.spi.store.IdentityStoreInvocationContext;
+import org.picketlink.idm.spi.store.IdentityStoreSession;
+import org.jboss.unit.api.pojo.annotations.Create;
+import org.jboss.unit.api.pojo.annotations.Destroy;
+import org.jboss.unit.api.pojo.annotations.Test;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.ldap.InitialLdapContext;
+import javax.naming.ldap.LdapContext;
+
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class LDAPIdentityStoreTestCase extends LDAPTestPOJO implements IdentityStoreTestContext
+{
+
+ CommonIdentityStoreTest commonTest;
+
+ IdentityStoreInvocationContext ctx;
+
+ IdentityStore store;
+
+ public LDAPIdentityStoreTestCase()
+ {
+
+ }
+
+ @Create
+ public void setUp() throws Exception
+ {
+ super.start();
+
+// setIdentityConfig("store-test-config.xml");
+
+ commonTest = new CommonIdentityStoreTest(this);
+
+ IdentityConfigurationMetaData configurationMD = JAXB2IdentityConfiguration
+ .createConfigurationMetaData(getIdentityConfig());
+
+ IdentityConfigurationContextRegistry registry = (IdentityConfigurationContextRegistry) new IdentityConfigurationImpl().
+ configure(configurationMD);
+
+ IdentityStoreConfigurationMetaData storeMD = null;
+
+ for (IdentityStoreConfigurationMetaData metaData : configurationMD.getIdentityStores())
+ {
+ if (metaData.getId().equals("LDAP Identity Store"))
+ {
+ storeMD = metaData;
+ break;
+ }
+ }
+
+ IdentityStoreConfigurationContext context = new IdentityStoreConfigurationContextImpl(configurationMD, registry, storeMD);
+
+
+
+ //populate();
+
+ store = new LDAPIdentityStoreImpl("LDAP Identity Store");
+
+ store.bootstrap(context);
+
+ final IdentityStoreSession storeSession = store.createIdentityStoreSession();
+
+ ctx = new IdentityStoreInvocationContext()
+ {
+ public IdentityStoreSession getIdentityStoreSession()
+ {
+ return storeSession;
+ }
+
+ public String getRealmId()
+ {
+ return "testRealm";
+ }
+
+ public String getSessionId()
+ {
+ return "";
+ }
+ };
+ }
+
+ @Destroy
+ public void tearDown() throws Exception
+ {
+ super.stop();
+ }
+
+
+ public void flush() throws Exception
+ {
+ //nothing
+ }
+
+ public IdentityStore getStore()
+ {
+ return store;
+ }
+
+ public IdentityStoreInvocationContext getCtx()
+ {
+ return ctx;
+ }
+
+
+ // Tests
+
+// Just test if OpenDS is running and was populated...
+ @Test
+ public void testSimple() throws Exception
+ {
+ populateClean();
+
+ Hashtable<String,String> env = new Hashtable<String,String>();
+ env.put(Context.INITIAL_CONTEXT_FACTORY, directoryConfig.getContextFactory());
+ env.put(Context.PROVIDER_URL, directoryConfig.getDescription());
+ env.put(Context.SECURITY_AUTHENTICATION, "simple");
+ env.put(Context.SECURITY_PRINCIPAL, directoryConfig.getAdminDN());
+ env.put(Context.SECURITY_CREDENTIALS, directoryConfig.getAdminPassword());
+
+ LdapContext ldapCtx = null;
+ try
+ {
+ ldapCtx = new InitialLdapContext(env, null);
+
+// Do something ...
+ System.out.println("Attributes: " + ldapCtx.getAttributes(directoryConfig.getCleanUpDN()));
+
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ try
+ {
+ if (ldapCtx != null)
+ {
+ ldapCtx.close();
+ }
+ }
+ catch (NamingException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+// @Test
+// public void testIdentityObjectCount() throws Exception
+// {
+// populate();
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+// assertEquals(5, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.ROLE));
+// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+// }
+//
+// @Test
+// public void testFindCreateRemove() throws Exception
+// {
+// populate();
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// IdentityObject io = store.findIdentityObject(ctx, "admin", IdentityTypeEnum.USER);
+// assertEquals("admin", io.getName());
+// assertEquals("uid=admin,ou=People,o=test,dc=portal,dc=example,dc=com", io.getKey().toString());
+//
+// //
+//
+// store.removeIdentityObject(ctx, io);
+//
+// assertEquals(6, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// store.createIdentityObject(ctx, "newUserA", IdentityTypeEnum.USER);
+//
+// assertEquals(7, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.USER));
+//
+// //
+//
+// assertEquals(2, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+//
+// store.createIdentityObject(ctx, "newGroupA", IdentityTypeEnum.GROUP);
+//
+// assertEquals(3, store.getIdentityObjectsCount(ctx, IdentityTypeEnum.GROUP));
+//
+// //
+//
+// io = store.findIdentityObject(ctx, "cn=newGroupA,ou=Groups,o=test,dc=portal,dc=example,dc=com");
+// assertEquals("newGroupA", io.getName());
+//
+// }
+
+// @Test
+// public void testAttributes() throws Exception{
+//
+// populate();
+//
+// IdentityObject user1 = store.createIdentityObject(ctx, "Adam", IdentityTypeEnum.USER);
+// IdentityObject user2 = store.createIdentityObject(ctx, "Eva", IdentityTypeEnum.USER);
+//
+// //
+//
+// IdentityObjectAttribute[] attrs = new IdentityObjectAttribute[]{
+// new SimpleAttribute("phone", new String[]{"val1"}),
+// new SimpleAttribute("description", new String[]{"val1", "val2", "val3", "val4"}),
+//
+// };
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// Map<String, IdentityObjectAttribute> persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(2, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("phone"));
+// assertEquals(1, persistedAttrs.get("phone").getSize());
+//
+// assertTrue(persistedAttrs.containsKey("description"));
+// assertEquals(4, persistedAttrs.get("description").getSize());
+//
+// //
+//
+// attrs = new IdentityObjectAttribute[]{
+// new SimpleAttribute("carLicense", new String[]{"val1"})
+// };
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("phone"));
+// assertEquals(1, persistedAttrs.get("phone").getSize());
+//
+// assertTrue(persistedAttrs.containsKey("description"));
+// assertEquals(4, persistedAttrs.get("description").getSize());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(1, persistedAttrs.get("carLicense").getSize());
+//
+// attrs = new IdentityObjectAttribute[]{
+// new SimpleAttribute("carLicense", new String[]{"val2"})
+// };
+//
+// store.addAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(2, persistedAttrs.get("carLicense").getSize());
+//
+// //
+//
+// store.updateAttributes(ctx, user1, attrs);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(3, persistedAttrs.keySet().size());
+//
+// assertTrue(persistedAttrs.containsKey("carLicense"));
+// assertEquals(1, persistedAttrs.get("carLicense").getSize());
+//
+// //
+//
+// String[] names = new String[]{"carLicense"};
+// store.removeAttributes(ctx, user1, names);
+//
+// //
+//
+// persistedAttrs = store.getAttributes(ctx, user1);
+//
+// assertEquals(2, persistedAttrs.keySet().size());
+//
+// }
+
+ @Test
+ public void testRelationships() throws Exception
+ {
+ populateClean();
+
+ commonTest.testRelationships();
+
+ }
+
+ @Test
+ public void testStorePersistence() throws Exception
+ {
+ populateClean();
+
+ commonTest.testStorePersistence();
+
+ }
+
+ @Test
+ public void testFindMethods() throws Exception
+ {
+ populateClean();
+
+ commonTest.testFindMethods();
+
+ }
+
+ @Test
+ public void testCriteria() throws Exception
+ {
+ populateClean();
+
+ commonTest.testCriteria();
+ }
+
+
+ @Test
+ public void testCredentials() throws Exception
+ {
+ populateClean();
+
+ commonTest.testPasswordCredential();
+ }
+
+}
16 years, 6 months