gatein SVN: r4714 - exo/maven/packager/tags.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2010-10-18 12:09:37 -0400 (Mon, 18 Oct 2010)
New Revision: 4714
Added:
exo/maven/packager/tags/1.0.0-CR03-PLF/
Log:
[maven-scm] copy for tag 1.0.0-CR03-PLF
Copied: exo/maven/packager/tags/1.0.0-CR03-PLF (from rev 4713, exo/maven/packager/branches/1.0.x)
14 years, 3 months
gatein SVN: r4713 - exo/maven/packager/branches.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2010-10-18 12:08:51 -0400 (Mon, 18 Oct 2010)
New Revision: 4713
Added:
exo/maven/packager/branches/1.0.x/
Removed:
exo/maven/packager/branches/1.1.x/
Log:
EXOGTN-112 Release exopackager-1.0.0-CR03
Copied: exo/maven/packager/branches/1.0.x (from rev 4712, exo/maven/packager/branches/1.1.x)
14 years, 3 months
gatein SVN: r4711 - exo/maven/packager.
by do-not-reply@jboss.org
Author: dbaeli
Date: 2010-10-18 12:03:49 -0400 (Mon, 18 Oct 2010)
New Revision: 4711
Added:
exo/maven/packager/tags/
Log:
EXOGTN-112 Release exopackager-1.0.0-CR03
14 years, 3 months
gatein SVN: r4710 - in portal/trunk: component/common/src/test/java/org/exoplatform/commons and 2 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-10-18 09:40:27 -0400 (Mon, 18 Oct 2010)
New Revision: 4710
Added:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/xml/DOMSerializer.java
portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/
portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java
Removed:
portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
Log:
GTNPORTAL-1569 : Performance problem with JSR286 header serialization in portal
Copied: portal/trunk/component/common/src/main/java/org/exoplatform/commons/xml/DOMSerializer.java (from rev 4415, exo/portal/branches/3.1.4-PLF-perf/component/common/src/main/java/org/exoplatform/commons/xml/DOMSerializer.java)
===================================================================
--- portal/trunk/component/common/src/main/java/org/exoplatform/commons/xml/DOMSerializer.java (rev 0)
+++ portal/trunk/component/common/src/main/java/org/exoplatform/commons/xml/DOMSerializer.java 2010-10-18 13:40:27 UTC (rev 4710)
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * 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.exoplatform.commons.xml;
+
+import org.gatein.common.logging.Logger;
+import org.gatein.common.logging.LoggerFactory;
+import org.w3c.dom.Attr;
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import javax.xml.stream.FactoryConfigurationError;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * An high performance and custom DOM serializer based on stax {@link XMLStreamWriter}.
+ *
+ * <p>The serializer takes care of correctly writing empty script elements with their non empty form, because we want to ouput
+ * xhtml text that will still work on html browsers.</p>
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class DOMSerializer
+{
+
+ /** . */
+ private static final Logger log = LoggerFactory.getLogger(DOMSerializer.class);
+
+ /** Thread safe. */
+ private static final XMLOutputFactory outputFactory;
+
+ /** . */
+ private static final String DEFAULT_XML_OUTPUT_FACTORY = "com.sun.xml.internal.stream.XMLOutputFactoryImpl";
+
+ static
+ {
+ XMLOutputFactory tmp;
+ try
+ {
+ tmp = XMLOutputFactory.newFactory(DEFAULT_XML_OUTPUT_FACTORY, Thread.currentThread().getContextClassLoader());
+ }
+ catch (FactoryConfigurationError error)
+ {
+ tmp = XMLOutputFactory.newFactory();
+ log.warn("Could not use " + DEFAULT_XML_OUTPUT_FACTORY + " will use default provided by runtime instead " +
+ tmp.getClass().getName());
+ }
+
+ //
+ outputFactory = tmp;
+ }
+
+ public static void serialize(Element element, Writer writer) throws IOException, XMLStreamException
+ {
+ XMLStreamWriter xml = outputFactory.createXMLStreamWriter(writer);
+ serialize(element, xml);
+ xml.writeEndDocument();
+ xml.flush();
+ }
+
+ private static void serialize(Element element, XMLStreamWriter writer) throws IOException, XMLStreamException
+ {
+ String tagName = element.getTagName();
+
+ // Determine if empty
+ // Note that we won't accumulate the elements that would be serialized for performance reason
+ // we will just reiterate later before ending the element
+ boolean empty;
+ if (tagName.equalsIgnoreCase("script"))
+ {
+ empty = false;
+ }
+ else
+ {
+ empty = true;
+ NodeList children = element.getChildNodes();
+ int length = children.getLength();
+ for (int i = 0;i < length && empty;i++)
+ {
+ Node child = children.item(i);
+ if (child instanceof CharacterData)
+ {
+ empty = false;
+ }
+ else if (child instanceof Element)
+ {
+ empty = false;
+ }
+ }
+ }
+
+ //
+ if (empty)
+ {
+ writer.writeEmptyElement(tagName);
+ }
+ else
+ {
+ writer.writeStartElement(tagName);
+ }
+
+ // Write attributes
+ if (element.hasAttributes())
+ {
+ NamedNodeMap attrs = element.getAttributes();
+ int length = attrs.getLength();
+ for (int i = 0;i < length;i++)
+ {
+ Attr attr = (Attr)attrs.item(i);
+ writer.writeAttribute(attr.getName(), attr.getValue());
+ }
+ }
+
+ //
+ if (!empty)
+ {
+ // Serialize children that are worth to be
+ NodeList children = element.getChildNodes();
+ int length = children.getLength();
+ for (int i = 0;i < length;i++)
+ {
+ Node child = children.item(i);
+ if (child instanceof CharacterData)
+ {
+ writer.writeCData(((CharacterData)child).getData());
+ }
+ else if (child instanceof Element)
+ {
+ serialize((Element)child, writer);
+ }
+ }
+
+ // Close
+ writer.writeEndElement();
+ }
+ }
+}
Copied: portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml (from rev 4415, exo/portal/branches/3.1.4-PLF-perf/component/common/src/test/java/org/exoplatform/commons/xml)
Deleted: portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java
===================================================================
--- exo/portal/branches/3.1.4-PLF-perf/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java 2010-09-28 21:58:33 UTC (rev 4415)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java 2010-10-18 13:40:27 UTC (rev 4710)
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * 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.exoplatform.commons.xml;
-
-import junit.framework.TestCase;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-/**
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
- * @version $Revision$
- */
-public class TestDOMSerializer extends TestCase
-{
-
- @Override
- protected void setUp() throws Exception
- {
- }
-
- public void testScriptNoAttributes() throws Exception
- {
- assertSerialization("<script></script>", "<script/>");
- }
-
- public void testScriptWithAttribute() throws Exception
- {
- assertSerialization("<script type=\"text/javascript\"></script>", "<script type='text/javascript'/>");
- }
-
- public void testMetaNoAttributes() throws Exception
- {
- assertSerialization("<meta/>", "<meta/>");
- }
-
- public void testMetaWithAttribute() throws Exception
- {
- assertSerialization("<meta http-equiv=\"Content-Type\"/>", "<meta http-equiv='Content-Type'></meta>");
- }
-
- private void assertSerialization(String expectedMarkup, String markup) throws Exception
- {
- Element elt = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(markup))).getDocumentElement();
- StringWriter writer = new StringWriter();
- DOMSerializer.serialize(elt, writer);
- assertEquals(expectedMarkup, writer.toString());
- }
-}
Copied: portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java (from rev 4415, exo/portal/branches/3.1.4-PLF-perf/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java)
===================================================================
--- portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java (rev 0)
+++ portal/trunk/component/common/src/test/java/org/exoplatform/commons/xml/TestDOMSerializer.java 2010-10-18 13:40:27 UTC (rev 4710)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * 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.exoplatform.commons.xml;
+
+import junit.framework.TestCase;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+/**
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+public class TestDOMSerializer extends TestCase
+{
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ }
+
+ public void testScriptNoAttributes() throws Exception
+ {
+ assertSerialization("<script></script>", "<script/>");
+ }
+
+ public void testScriptWithAttribute() throws Exception
+ {
+ assertSerialization("<script type=\"text/javascript\"></script>", "<script type='text/javascript'/>");
+ }
+
+ public void testMetaNoAttributes() throws Exception
+ {
+ assertSerialization("<meta/>", "<meta/>");
+ }
+
+ public void testMetaWithAttribute() throws Exception
+ {
+ assertSerialization("<meta http-equiv=\"Content-Type\"/>", "<meta http-equiv='Content-Type'></meta>");
+ }
+
+ private void assertSerialization(String expectedMarkup, String markup) throws Exception
+ {
+ Element elt = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader(markup))).getDocumentElement();
+ StringWriter writer = new StringWriter();
+ DOMSerializer.serialize(elt, writer);
+ assertEquals(expectedMarkup, writer.toString());
+ }
+}
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-10-18 12:09:28 UTC (rev 4709)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestContext.java 2010-10-18 13:40:27 UTC (rev 4710)
@@ -22,6 +22,7 @@
import org.exoplatform.Constants;
import org.exoplatform.commons.utils.ExpressionUtil;
import org.exoplatform.commons.utils.PortalPrinter;
+import org.exoplatform.commons.xml.DOMSerializer;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.portal.config.UserPortalConfigService;
import org.exoplatform.portal.config.model.Page;
@@ -40,19 +41,12 @@
import org.gatein.common.http.QueryStringParser;
import org.w3c.dom.Element;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.URLDecoder;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -432,35 +426,16 @@
public List<String> getExtraMarkupHeadersAsStrings() throws Exception
{
List<String> markupHeaders = new ArrayList<String>();
-
if (extraMarkupHeaders != null && !extraMarkupHeaders.isEmpty())
{
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-
+ StringWriter sw = new StringWriter();
for (Element element : extraMarkupHeaders)
{
- DOMSource source = new DOMSource(element);
- StreamResult result = new StreamResult(new StringWriter());
-
- // we want to ouput xhtml text that will still work on html browsers.
- // In order to do this we need to have the script tag be not self closing
- // which it will try and do with the xml or xhtml method. If we just use
- // the html method then the other tags will not be closed.
- if (element.getNodeName().equalsIgnoreCase("script"))
- {
- transformer.setOutputProperty(OutputKeys.METHOD, "html");
- }
- else
- {
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- }
- transformer.transform(source, result);
- markupHeaders.add(result.getWriter().toString());
+ DOMSerializer.serialize(element, sw);
+ markupHeaders.add(sw.toString());
}
}
-
- return markupHeaders;
+ return markupHeaders;
}
/**
14 years, 3 months
gatein SVN: r4709 - in components/wsrp/trunk: admin-gui/src/main/webapp/jsf/common and 1 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-18 08:09:28 -0400 (Mon, 18 Oct 2010)
New Revision: 4709
Modified:
components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
Log:
- Try to be smarter with exceptions display and show more details. It's unfortunate that JSF default renderer does not identify the detail part of the message so that progressive disclosure could be used. :(
Modified: components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2010-10-18 11:59:22 UTC (rev 4708)
+++ components/wsrp/trunk/admin-gui/src/main/java/org/gatein/wsrp/admin/ui/JSFBeanContext.java 2010-10-18 12:09:28 UTC (rev 4709)
@@ -62,7 +62,7 @@
protected void createMessage(String target, String message, Object severity, Object... additionalParams)
{
- outputMessage(target, message, severity);
+ outputMessage(target, message, severity, additionalParams);
}
public static void outputMessage(String target, String message, Object severity, Object... additionalParams)
Modified: components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml
===================================================================
--- components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml 2010-10-18 11:59:22 UTC (rev 4708)
+++ components/wsrp/trunk/admin-gui/src/main/webapp/jsf/common/template.xhtml 2010-10-18 12:09:28 UTC (rev 4709)
@@ -42,7 +42,7 @@
<div class="tab-container">
<!-- Status message -->
<h:messages id="status" infoClass="portlet-msg-success" errorClass="portlet-msg-error"
- fatalClass="portlet-msg-error" warnClass="portlet-msg-warn"/>
+ fatalClass="portlet-msg-error" warnClass="portlet-msg-warn" showDetail="true"/>
<div style="width:98%;margin: 0 auto">
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-10-18 11:59:22 UTC (rev 4708)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPExceptionFactory.java 2010-10-18 12:09:28 UTC (rev 4709)
@@ -23,6 +23,7 @@
package org.gatein.wsrp;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.wsrp.spec.v1.WSRP1ExceptionFactory;
import org.gatein.wsrp.spec.v2.WSRP2ExceptionFactory;
import org.slf4j.Logger;
@@ -76,6 +77,7 @@
protected abstract static class ExceptionFactory<E extends Exception>
{
+ private static final String CAUSE = " Cause: ";
private final Constructor<E> exceptionConstructor;
protected Object fault;
private static final String FAULT = "Fault";
@@ -94,6 +96,14 @@
{
try
{
+ if (cause != null)
+ {
+ String causeMsg = cause.getLocalizedMessage();
+ if (!ParameterValidation.isNullOrEmpty(causeMsg) && !message.contains(CAUSE))
+ {
+ message += CAUSE + causeMsg;
+ }
+ }
return exceptionConstructor.newInstance(message, fault, cause);
}
catch (Exception e)
14 years, 3 months
gatein SVN: r4708 - components/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render.
by do-not-reply@jboss.org
Author: thomas.heute(a)jboss.com
Date: 2010-10-18 07:59:22 -0400 (Mon, 18 Oct 2010)
New Revision: 4708
Modified:
components/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java
Log:
GTNPORTAL-1539: Remove gadget Error 404 in logs
Modified: components/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java
===================================================================
--- components/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java 2010-10-18 11:52:05 UTC (rev 4707)
+++ components/shindig/trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/render/DefaultServiceFetcherTest.java 2010-10-18 11:59:22 UTC (rev 4708)
@@ -113,11 +113,11 @@
public void testReadConfigWithValidEndpoints() throws Exception {
List<String> endPoint1Services = ImmutableList.of("do.something", "delete.someting");
JSONObject service1 = new JSONObject();
- service1.put("data", endPoint1Services);
+ service1.put("result", endPoint1Services);
List<String> endPoint2Services = ImmutableList.of("weather.get");
JSONObject service2 = new JSONObject();
- service2.put("data", endPoint2Services);
+ service2.put("result", endPoint2Services);
EasyMock.expect(mockFetcher.fetch(EasyMock.isA(HttpRequest.class))).andReturn(
new HttpResponse(service1.toString()));
14 years, 3 months
gatein SVN: r4707 - components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-18 07:52:05 -0400 (Mon, 18 Oct 2010)
New Revision: 4707
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
Log:
- GTNPC-37: Updated VERSION.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2010-10-18 10:09:43 UTC (rev 4706)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/spi/PortalContext.java 2010-10-18 11:52:05 UTC (rev 4707)
@@ -36,7 +36,7 @@
*/
public interface PortalContext
{
- public static final Version VERSION = new Version("GateIn Portlet Container", 2, 1, 1, new Version.Qualifier(Version.Qualifier.Prefix.GA), "Community");
+ public static final Version VERSION = new Version("GateIn Portlet Container", 2, 2, 0, new Version.Qualifier(Version.Qualifier.Prefix.GA), "Community");
/**
* Return info about the portal. Must conform to javax.portlet.PortalContext.getPortalInfo().
14 years, 3 months
gatein SVN: r4706 - in portal/trunk/component/identity/src: test/java/org/exoplatform/services/organization and 1 other directory.
by do-not-reply@jboss.org
Author: bdaw
Date: 2010-10-18 06:09:43 -0400 (Mon, 18 Oct 2010)
New Revision: 4706
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
Log:
GTNPORTAL-1562 A MembershipType is automatically created if missing while making a membership link
Modified: portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
--- portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-10-18 10:01:08 UTC (rev 4705)
+++ portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2010-10-18 10:09:43 UTC (rev 4706)
@@ -102,6 +102,11 @@
+ " because membership type is null");
}
+ if (orgService.getMembershipTypeHandler().findMembershipType(mt.getName()) == null)
+ {
+ throw new InvalidNameException("MembershipType doesn't exist: " + mt.getName());
+ }
+
String plGroupName = getPLIDMGroupName(g.getGroupName());
String groupId =
Modified: portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java
===================================================================
--- portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2010-10-18 10:01:08 UTC (rev 4705)
+++ portal/trunk/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationService.java 2010-10-18 10:09:43 UTC (rev 4706)
@@ -340,6 +340,7 @@
mt = mtHandler_.createMembershipTypeInstance();
mt.setName("membershipType3");
+ mtHandler_.createMembershipType(mt, true);
membershipHandler_.linkMembership(userBenj, group2, mt, true);
/*
@@ -491,6 +492,37 @@
// userHandler_.removeUser(user.getUserName(), false);
// }
+ public void testLinkMembership() throws Exception {
+ String g1 = "grp1";
+ String usr1 = "usr1";
+ String mstype1 = "mstype1";
+
+ Group group1 = groupHandler_.createGroupInstance();
+ group1.setGroupName(g1);
+ groupHandler_.addChild(null, group1, true);
+
+ User user = createUser(usr1);
+
+ MembershipType mt = mtHandler_.createMembershipTypeInstance();
+ mt.setName(mstype1);
+
+ try {
+
+ membershipHandler_.linkMembership(user, group1, mt, true);
+ fail();
+ }
+ catch (Exception e)
+ {
+ //expected as membership type was not created first
+ }
+
+ assertNull(mtHandler_.findMembershipType(mstype1));
+
+ userHandler_.removeUser(usr1, true);
+ groupHandler_.removeGroup(group1, true);
+ }
+
+
public void testFindUsersByGroupId() throws Exception
{
PageList users = userHandler_.findUsersByGroup("/users");
14 years, 3 months