You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by he...@apache.org on 2007/12/21 17:03:49 UTC
svn commit: r606228 [4/4] - in /directory/sandbox/hennejg/odm/trunk/src: ./
main/ main/java/ main/java/org/ main/java/org/apache/
main/java/org/apache/directory/ main/java/org/apache/directory/odm/
main/java/org/apache/directory/odm/auth/ main/resource...
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/TestCaching.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/TestCaching.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/TestCaching.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/TestCaching.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,252 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test;
+
+import javax.naming.NameNotFoundException;
+import javax.naming.directory.BasicAttribute;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.ldap.LdapContext;
+
+import org.apache.directory.odm.DirectoryException;
+import org.apache.directory.odm.Mapping;
+import org.apache.directory.odm.test.model.User;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestCaching extends AbstractEmbeddedDirectoryTest {
+ private static final String OBJECT_NAME = "someName";
+ private static final String OBJECT_NAME_IN_CTX = "cn=" + OBJECT_NAME
+ + ",ou=users";
+
+ @Before
+ public void setup() {
+ Mapping.disableCache = false;
+ mapping.close(); // will just clear the cache;
+ }
+
+ @Test
+ public void testPopulateCacheAtSave() throws Exception {
+ User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ // now delete the user, by-passing the mapping
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+ ctx.unbind(OBJECT_NAME_IN_CTX);
+ ctx.close();
+
+ // re-load the user. it should still be present, due to caching
+ u = mapping.load(User.class, u.getDn());
+ Assert.assertNull("Location", u.getLocation());
+ Assert.assertEquals("Name", OBJECT_NAME, u.getName());
+ Assert.assertEquals("Description", "some description", u.getDescription());
+ Assert.assertEquals("GivenName", "John", u.getGivenName());
+ Assert.assertEquals("SN", "Doe", u.getSn());
+ Assert.assertEquals("uid", new Integer(2345), u.getUid());
+ Assert.assertArrayEquals("password", new byte[]{1, 2, 3, 4, 5}, u
+ .getUserPassword());
+ }
+
+ @Test
+ public void testPopulateCacheAtLoad() throws Exception {
+ User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ // will clear the cache
+ mapping.close();
+
+ // re-load the user. and populate the cache
+ u = mapping.load(User.class, u.getDn());
+ Assert.assertNull("Location", u.getLocation());
+ Assert.assertEquals("Name", OBJECT_NAME, u.getName());
+ Assert.assertEquals("Description", "some description", u.getDescription());
+ Assert.assertEquals("GivenName", "John", u.getGivenName());
+ Assert.assertEquals("SN", "Doe", u.getSn());
+ Assert.assertEquals("uid", new Integer(2345), u.getUid());
+ Assert.assertArrayEquals("password", new byte[]{1, 2, 3, 4, 5}, u
+ .getUserPassword());
+
+ // now delete the user, by-passing the mapping
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+ ctx.unbind(OBJECT_NAME_IN_CTX);
+ ctx.close();
+
+ // re-load the user. it should still be present, due to caching
+ u = mapping.load(User.class, u.getDn());
+ Assert.assertNull("Location", u.getLocation());
+ Assert.assertEquals("Name", OBJECT_NAME, u.getName());
+ Assert.assertEquals("Description", "some description", u.getDescription());
+ Assert.assertEquals("GivenName", "John", u.getGivenName());
+ Assert.assertEquals("SN", "Doe", u.getSn());
+ Assert.assertEquals("uid", new Integer(2345), u.getUid());
+ Assert.assertArrayEquals("password", new byte[]{1, 2, 3, 4, 5}, u
+ .getUserPassword());
+ }
+
+ @Test
+ public void testCacheBypassOnLoadUsingDelete() throws Exception {
+ final User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+
+ try {
+ ctx.getAttributes(OBJECT_NAME_IN_CTX);
+ } catch (final NameNotFoundException e) {
+ Assert.fail("user wasn't saved");
+ }
+
+ // now delete the user, by-passing the mapping
+ ctx.unbind(OBJECT_NAME_IN_CTX);
+ ctx.close();
+
+ // must fail!
+ try {
+ mapping.load(User.class, u.getDn(), true);
+ Assert.fail("User loaded although it was deleted from the cache");
+ } catch (final DirectoryException e) {
+ Assert.assertEquals("Wrong cause", NameNotFoundException.class, e
+ .getCause().getClass());
+ }
+ }
+
+ @Test
+ public void testCacheBypassOnLoadUsingUpdate() throws Exception {
+ final User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+
+ final ModificationItem mi[] = new ModificationItem[]{new ModificationItem(
+ DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "test"))};
+
+ // update attribute
+ ctx.modifyAttributes(OBJECT_NAME_IN_CTX, mi);
+ ctx.close();
+
+ final User reloaded = mapping.load(User.class, u.getDn(), true);
+ Assert.assertEquals("Wrong attribute value still in cache", "test",
+ reloaded.getDescription());
+ }
+
+ @Test
+ public void testCacheBypassOnRefreshdUsingDelete() throws Exception {
+ final User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+
+ try {
+ ctx.getAttributes(OBJECT_NAME_IN_CTX);
+ } catch (final NameNotFoundException e) {
+ Assert.fail("user wasn't saved");
+ }
+
+ // now delete the user, by-passing the mapping
+ ctx.unbind(OBJECT_NAME_IN_CTX);
+ ctx.close();
+
+ // must fail!
+ try {
+ mapping.refresh(u);
+ Assert.fail("User loaded although it was deleted from the cache");
+ } catch (final DirectoryException e) {
+ Assert.assertTrue("wrong exception message", e.getMessage().indexOf(
+ "object doesn\'t exist") > 0);
+ }
+ }
+
+ @Test
+ public void testCacheBypassOnRefreshUsingUpdate() throws Exception {
+ final User u = new User();
+ u.setName(OBJECT_NAME);
+ u.setDescription("some description");
+ u.setGivenName("John");
+ u.setSn("Doe");
+ u.setUid(2345);
+ u.setUserPassword(new byte[]{1, 2, 3, 4, 5});
+
+ mapping.save(u);
+
+ final LdapContext ctx = connectionDescriptor.createDirectoryFacade()
+ .createDirContext();
+
+ final ModificationItem mi[] = new ModificationItem[]{new ModificationItem(
+ DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("description", "test"))};
+
+ // update attribute
+ ctx.modifyAttributes(OBJECT_NAME_IN_CTX, mi);
+ ctx.close();
+
+ mapping.refresh(u);
+ Assert.assertEquals("Wrong attribute value still in cache", "test", u
+ .getDescription());
+ }
+
+ @Test
+ public void testCacheUpdateOnObjectUpdate() throws Exception {
+
+ }
+
+ @Test
+ public void testPurgeOnDelete() throws Exception {
+
+ }
+}
\ No newline at end of file
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/TestCaching.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Client.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Client.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Client.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Client.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,103 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author levigo
+ */
+public class Client extends Profile {
+ private static final long serialVersionUID = 1L;
+
+ private HardwareType hardwareType;
+
+ private String ipAddress;
+ private String macAddress;
+ private Location location;
+
+ public String getIpHostNumber() {
+ if (null == ipAddress)
+ return "0.0.0.0";
+ return ipAddress;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+
+ public void setHardwareType(HardwareType hardwareType) {
+ this.hardwareType = hardwareType;
+ firePropertyChange("hardwareType", null, hardwareType);
+ }
+
+ public HardwareType getHardwareType() {
+ return hardwareType;
+ }
+
+ /**
+ * This method is used to beat the actually single-valued hardware type into
+ * the set semantics required by the ldap mapping.
+ *
+ * @deprecated for LDAP mapping only
+ */
+ @Deprecated
+ public void setHwTypes(Set<HardwareType> hardwareType) {
+ this.hardwareType = hardwareType.size() > 0 ? hardwareType.iterator()
+ .next() : null;
+ }
+
+ /**
+ * This method is used to beat the actually single-valued hardware type into
+ * the set semantics required by the ldap mapping.
+ *
+ * @deprecated for LDAP mapping only
+ */
+ @Deprecated
+ public Set<HardwareType> getHwTypes() {
+ final Set<HardwareType> set = new HashSet<HardwareType>();
+ if (null != hardwareType)
+ set.add(hardwareType);
+ return set;
+ }
+
+ public void setIpHostNumber(String ipHostNumber) {
+ final String oldIpAddress = this.ipAddress;
+ this.ipAddress = ipHostNumber;
+ firePropertyChange("ipHostNumber", oldIpAddress, ipHostNumber);
+ }
+
+ public void setLocation(Location location) {
+ // String dn = TypeMapping.idToUpperCase(location.getDn()).trim();
+ // location.setDn(dn);
+ this.location = location;
+ firePropertyChange("location", null, location);
+ }
+
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ public void setMacAddress(String macAddress) {
+ final String oldMacAddress = this.macAddress;
+ this.macAddress = macAddress.toLowerCase();
+ firePropertyChange("macAddress", oldMacAddress, macAddress);
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Client.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/DirectoryObject.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/DirectoryObject.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/DirectoryObject.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/DirectoryObject.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.Serializable;
+
+/**
+ * @author levigo
+ */
+public abstract class DirectoryObject implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private String dn;
+ private String name;
+ private String description;
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ boolean ret = (null != obj && getClass().equals(obj.getClass())
+ && dn != null && dn.equals(((DirectoryObject) obj).getDn()));
+ return ret;
+ }
+
+ @Override
+ public int hashCode() {
+ return getClass().hashCode() ^ (null != dn ? dn.hashCode() : 28764721);
+ }
+
+ public String getDn() {
+ return dn;
+ }
+
+ public void setDn(String dn) {
+ this.dn = dn;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ String oldDescription = this.description;
+ this.description = description;
+ firePropertyChange("description", oldDescription, description);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ String oldName = this.name;
+ this.name = name;
+ firePropertyChange("name", oldName, name);
+ }
+
+ /*
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return getName();
+ }
+
+ private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName,
+ PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * Support for reporting bound property changes for Object properties. This
+ * method can be called when a bound property has changed and it will send the
+ * appropriate PropertyChangeEvent to any registered PropertyChangeListeners.
+ *
+ * @param propertyName the property whose value has changed
+ * @param oldValue the property's previous value
+ * @param newValue the property's new value
+ */
+ protected void firePropertyChange(String propertyName, Object oldValue,
+ Object newValue) {
+ if (pcs == null
+ || (oldValue != null && newValue != null && oldValue.equals(newValue)))
+ return;
+ pcs.firePropertyChange(propertyName, oldValue, newValue);
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/DirectoryObject.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Group.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Group.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Group.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Group.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.Set;
+
+/**
+ * @author levigo
+ */
+public interface Group<T extends DirectoryObject> {
+
+ public abstract Set<T> getMembers();
+
+ public abstract void setMembers(Set<T> members);
+
+ /**
+ * Get the list of classes which can be members of this group.
+ *
+ * @return
+ */
+ public abstract Class<? extends DirectoryObject>[] getMemberClasses();
+
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Group.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/HardwareType.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/HardwareType.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/HardwareType.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/HardwareType.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.Set;
+
+/**
+ * @author levigo
+ */
+public class HardwareType extends Profile
+ implements
+ Group<Client> {
+ private static final long serialVersionUID = 1L;
+
+ // private static final Class[] MEMBER_CLASSES = new Class[]{Client.class,
+ // HardwareType.class};
+ private static final Class[] MEMBER_CLASSES = new Class[]{Client.class};
+
+ private Set<HardwareType> hardwareTypes;
+
+ private Set<Client> members;
+
+ public Set<HardwareType> getHardwareTypes() {
+ return hardwareTypes;
+ }
+
+ public void setHardwareTypes(Set<HardwareType> hardwareTypes) {
+ this.hardwareTypes = hardwareTypes;
+ firePropertyChange("hardwareTypes", null, hardwareTypes);
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#getMemberClasses()
+ */
+ public Class[] getMemberClasses() {
+ return MEMBER_CLASSES;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#getMembers()
+ */
+ public Set<Client> getMembers() {
+ return members;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#setMembers(java.util.Set)
+ */
+ public void setMembers(Set<Client> members) {
+ this.members = members;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Profile#getInheritedProfiles()
+ */
+ @Override
+ protected Profile[] getInheritedProfiles() {
+ return null != hardwareTypes ? hardwareTypes
+ .toArray(new Profile[hardwareTypes.size()]) : super
+ .getInheritedProfiles();
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/HardwareType.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Location.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Location.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Location.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Location.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+
+/**
+ * @author levigo
+ */
+public class Location extends Profile {
+ private static final long serialVersionUID = 1L;
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Location.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/OrganizationalUnit.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/OrganizationalUnit.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/OrganizationalUnit.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/OrganizationalUnit.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+
+/**
+ * @author levigo
+ */
+public class OrganizationalUnit extends DirectoryObject {
+ private static final long serialVersionUID = 1L;
+
+
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/OrganizationalUnit.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Profile.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Profile.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Profile.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Profile.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * The precedence for profile inheritance is:
+ * <nl>
+ * <li>My own (local) value
+ * <li>A value of one of the inherited profiles
+ * <li>The default of the local schema
+ * <li>The inherited value of one of the inherited profiles
+ * </nl>
+ *
+ * @author levigo
+ */
+public abstract class Profile extends DirectoryObject {
+ private static final long serialVersionUID = 1L;
+
+ public static final String WARNING_REMOVED_OPTION = null;
+
+ public static final String WARNING_NEW_FIELD = null;
+
+ private transient Properties properties;
+
+ private transient final Map<String, String> warnings = new HashMap<String, String>();
+
+ /*
+ * @see org.openthinclient.Profile#getValue(javax.swing.tree.String, boolean)
+ */
+ public String getValue(String key) {
+ final String myValue = getValueLocal(key);
+ return myValue;
+ }
+
+ /*
+ * @see org.openthinclient.Profile#getValue(javax.swing.tree.String, boolean)
+ */
+ public String getValueLocal(String key) {
+ return getProperties().getMap().get(key);
+ }
+
+ protected Profile[] getInheritedProfiles() {
+ final Profile none[] = {};
+ return none;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Profile#setValue(java.lang.String,
+ * java.lang.String)
+ */
+ public void setValue(String path, String value) {
+ getProperties().getMap().put(path, value);
+ }
+
+ public void removeValue(String key) {
+ getProperties().getMap().remove(key);
+ }
+
+ /*
+ * @see org.openthinclient.Profile#containsPath(javax.swing.tree.String)
+ */
+ public boolean containsValue(String key) {
+ return null != properties && getProperties().getMap().containsKey(key);
+ }
+
+ public boolean inherits(String key) {
+ final Profile[] inheritedProfiles = getInheritedProfiles();
+ return inheritedProfiles != null;
+ }
+
+ /**
+ * @return
+ */
+ protected String getSchemaName() {
+ return getProperties().getDescription();
+ }
+
+ /**
+ * Used for unmarshalling this profile from LDAP.
+ *
+ * @param props
+ * @deprecated To be used by the LDAP mapping only
+ */
+ @Deprecated
+ public final void setProperties(Properties props) {
+ this.properties = props;
+ }
+
+ /**
+ * Used for marshalling this profile to LDAP.
+ *
+ * @return
+ * @deprecated To be used by the LDAP mapping only
+ */
+ @Deprecated
+ public final Properties getProperties() {
+ if (null == properties)
+ properties = new Properties("profile", "unknown",
+ new TreeMap<String, String>());
+
+ return properties;
+ }
+
+ /**
+ * @param key
+ * @return
+ */
+ public String getWarning(String key) {
+ return warnings.get(key);
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Profile.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Properties.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Properties.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Properties.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Properties.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * This class is used mainly for marshalling/unmarshalling to/from ldap. It
+ * carries a set of properties consisting of name/value pairs.
+ *
+ * @author levigo
+ */
+public class Properties extends DirectoryObject {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * The properties kept in a key-value map for fast access. This map is not
+ * actually persisted. Persistence is realized by {@link #propertySet}.
+ */
+ private SortedMap<String, String> propertyMap;
+
+ /**
+ * This is the "persisten" set of properties. It is accessed by the LDAP
+ * mapping only (via {@link #getProperties()}/{@link #setProperties(Set)})
+ * and mirrored into the {@link #propertyMap}.
+ */
+ private Set<Property> propertySet;
+
+ /**
+ * @deprecated for LDAP mapping only!
+ */
+ @Deprecated
+ public Properties() {
+ }
+
+ /**
+ * @param string
+ * @param schemaName
+ * @param properties
+ */
+ public Properties(String string, String schemaName,
+ SortedMap<String, String> properties) {
+ setName(string);
+ setDescription(schemaName);
+ setMap(properties);
+ }
+
+ /**
+ * Used by LDAP mapping.
+ *
+ * @return
+ * @deprecated To be used by the LDAP mapping only
+ */
+ @Deprecated
+ public Set<Property> getProperties() {
+ // if the properties haven't been accessed via the map, we
+ // can safely return the initial set...
+ if(null != propertySet)
+ return propertySet;
+
+ // ...otherwise we copy it back from the map.
+ Set<Property> props = new HashSet<Property>();
+ if (null != propertyMap)
+ for (Map.Entry<String, String> e : propertyMap.entrySet())
+ props.add(new Property(this, e.getKey(), e.getValue()));
+
+ return props;
+ }
+
+ /**
+ * Used my LDAP mapping.
+ *
+ * @param props
+ * @deprecated To be used by the LDAP mapping only
+ */
+ @Deprecated
+ public void setProperties(Set<Property> props) {
+ this.propertySet = props;
+
+ // map will be initialized on demand later
+ this.propertyMap = null;
+ }
+
+ /**
+ * @return
+ */
+ public SortedMap<String, String> getMap() {
+ if (null == propertyMap) {
+ // trigger lazy proxy loading.
+ propertySet.size();
+
+ propertyMap = new TreeMap<String, String>();
+
+ if (null != propertySet)
+ for (Property p : propertySet)
+ propertyMap.put(p.getName(), p.getValue());
+
+ propertySet = null;
+ }
+ return propertyMap;
+ }
+
+ /**
+ * @param values
+ */
+ private void setMap(SortedMap<String, String> values) {
+ this.propertyMap = values;
+ }
+
+ public String getNisMapName() {
+ return (this.getName());
+ }
+
+ public void setNisMapName(String name) {
+ // ignored!
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Properties.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Property.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Property.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Property.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Property.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+/**
+ * This class is used mainly for marshalling/unmarshalling to/from ldap. It
+ * holds a name/value pair.
+ *
+ * @author levigo
+ */
+public class Property extends DirectoryObject {
+ private static final long serialVersionUID = 1L;
+
+ private Properties parent;
+
+ private String value;
+
+ /**
+ * @deprecated To be used by the LDAP mapping only
+ */
+ @Deprecated
+ public Property() {
+ }
+
+ /**
+ * @param key
+ * @param value
+ */
+ Property(Properties parent, String key, String value) {
+ this.parent = parent;
+ setName(key);
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getNisMapName() {
+ return null != parent ? parent.getName() : "profile";
+ }
+
+ public void setNisMapName(String name) {
+ // ignored!
+ }
+
+ public Properties getParent() {
+ return parent;
+ }
+
+ public void setParent(Properties parent) {
+ this.parent = parent;
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/Property.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/User.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/User.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/User.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/User.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.Set;
+
+import org.castor.util.Base64Encoder;
+
+/**
+ * @author levigo
+ */
+public class User extends DirectoryObject {
+ private static final long serialVersionUID = 1L;
+
+ private Set<UserGroup> userGroups;
+
+ private Location location;
+
+ private String sn;
+ private String givenName;
+ private byte[] userPassword;
+ private String newPassword = "";
+ private String verifyPassword = "";
+
+ private Integer uid;
+
+ public void setLocation(Location location) {
+ this.location = location;
+
+ firePropertyChange("location", null, location);
+ }
+
+ public Set<UserGroup> getUserGroups() {
+ return userGroups;
+ }
+
+ public void setUserGroups(Set<UserGroup> userGroups) {
+ this.userGroups = userGroups;
+ firePropertyChange("userGroups", null, userGroups);
+ }
+
+ public String getGivenName() {
+ return givenName;
+ }
+
+ public void setGivenName(String givenName) {
+ this.givenName = givenName;
+ firePropertyChange("givenName", null, givenName);
+ }
+
+ public String getSn() {
+ if(null == sn)
+ this.sn = getName(); //sn is mandatory
+ return sn;
+ }
+
+ public void setSn(String sn) {
+ this.sn = sn;
+ firePropertyChange("sn", null, sn);
+ }
+
+ /**
+ * @return
+ * @deprecared Used for LDAP-Mapping only
+ */
+ public byte[] getUserPassword() {
+ return userPassword;
+ }
+
+ /**
+ * @param userPassword
+ * @deprecared Used for LDAP-Mapping only
+ */
+ public void setUserPassword(byte[] userPassword) {
+ this.userPassword = userPassword;
+ }
+
+ public String getNewPassword() {
+ // we never hand out the real password, only the change one for verification
+ return newPassword;
+ }
+
+ public void setNewPassword(String password) {
+ try {
+ final MessageDigest digest = MessageDigest.getInstance("MD5");
+ digest.update(password.getBytes());
+ final String encrypted = "{MD5}"
+ + new String(Base64Encoder.encode(digest.digest()));
+
+ setUserPassword(encrypted.getBytes());
+ // setUserPassword(password.getBytes());
+
+ this.newPassword = password;
+
+ firePropertyChange("newPassword", "", password);
+ firePropertyChange("password", new byte[0], getUserPassword());
+ } catch (final NoSuchAlgorithmException e) {
+ throw new RuntimeException("Can't encrypt user's password", e);
+ }
+ }
+
+ public String getVerifyPassword() {
+ return verifyPassword;
+ }
+
+ public void setVerifyPassword(String verifyPassword) {
+ this.verifyPassword = verifyPassword;
+ firePropertyChange("verifyPassword", "", verifyPassword);
+ }
+
+ public Integer getUid() {
+ return uid;
+ }
+
+ public void setUid(Integer uid) {
+ this.uid = uid;
+ }
+
+ public Location getLocation() {
+ return location;
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/User.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/UserGroup.java
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/UserGroup.java?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/UserGroup.java (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/UserGroup.java Fri Dec 21 08:03:46 2007
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.apache.directory.odm.test.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * @author levigo
+ */
+public class UserGroup extends DirectoryObject
+ implements
+ Group<User> {
+ private static final long serialVersionUID = 1L;
+
+ private static final Class[] MEMBER_CLASSES = new Class[]{User.class};
+
+ private String businessCategory;
+
+ private Set<UserGroup> userGroups;
+ private Set<User> members;
+
+ public Set<UserGroup> getUserGroups() {
+ return userGroups;
+ }
+
+ public void setUserGroups(Set<UserGroup> userGroups) {
+ this.userGroups = userGroups;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#getMemberClasses()
+ */
+ public Class[] getMemberClasses() {
+ return MEMBER_CLASSES;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#getMembers()
+ */
+ public Set<User> getMembers() {
+ if (null == members)
+ members = new HashSet<User>();
+ return members;
+ }
+
+ /*
+ * @see org.apache.directory.odm.test.model.Group#setMembers(java.util.Set)
+ * @deprecated for LDAP mapping only
+ */
+ public void setMembers(Set<User> members) {
+ this.members = members;
+ }
+
+ /**
+ * @return
+ */
+ public String getBusinessCategory() {
+ return businessCategory;
+ }
+
+ /**
+ * @param businessCategory
+ * @deprecated for thow, this is for LDAP mapping only. The business category
+ * should not be updated.
+ */
+ @Deprecated
+ public void setBusinessCategory(String businessCategory) {
+ this.businessCategory = businessCategory;
+ }
+}
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/java/org/apache/directory/odm/test/model/UserGroup.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/resources/log4j.properties?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/resources/log4j.properties (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/resources/log4j.properties Fri Dec 21 08:03:46 2007
@@ -0,0 +1,37 @@
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+
+# For the general syntax of property based configuration files see the
+# documenation of org.apache.log4j.PropertyConfigurator.
+#
+# Valid log levels are: DEBUG, INFO, WARN, ERROR, FATAL
+#
+# Default setting: log level = WARN, log to the FCMSLOG file and to the console
+log4j.rootLogger=ERROR, console
+log4j.logger.org.apache.directory.odm.DIROP=DEBUG
+
+#################################################################
+# Appender definition for sending log to the console
+#
+# A1 is set to be a consoleAppender which outputs to System.out.
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%-5p %d [%c{2}; %t]: %m%n
+
+
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: directory/sandbox/hennejg/odm/trunk/src/test/resources/org/apache/odm/test/GENERIC_RFC.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/hennejg/odm/trunk/src/test/resources/org/apache/odm/test/GENERIC_RFC.xml?rev=606228&view=auto
==============================================================================
--- directory/sandbox/hennejg/odm/trunk/src/test/resources/org/apache/odm/test/GENERIC_RFC.xml (added)
+++ directory/sandbox/hennejg/odm/trunk/src/test/resources/org/apache/odm/test/GENERIC_RFC.xml Fri Dec 21 08:03:46 2007
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<mapping name="Generic RFC directory server">
+ <class name="org.apache.directory.odm.test.model.Client" base-rdn="ou=clients" filter="(objectclass=ipHost)"
+ object-classes="top, ipHost, ieee802Device" key-class="ipHost">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="cn" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+ <attribute name="ipHostNumber" type="java.lang.String" />
+ <attribute name="macAddress" type="java.lang.String" />
+
+ <many-to-one name="l" type="org.apache.directory.odm.test.model.Location" get-method="getLocation"
+ set-method="setLocation" cardinality="ZERO_OR_ONE" />
+ <many-to-many name="hwTypes" type="org.apache.directory.odm.test.model.HardwareType" filter="(uniqueMember={0})"
+ member-field="uniqueMember" />
+
+ <child name="properties" cardinality="ONE" type="org.apache.directory.odm.test.model.Properties"
+ filter="(nisMapName=profile)" />
+ </class>
+
+ <class name="org.apache.directory.odm.test.model.Location" base-rdn="ou=locations" filter="(objectclass=locality)"
+ object-classes="top, locality" key-class="locality">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="l" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+
+ <child name="properties" cardinality="ONE" type="org.apache.directory.odm.test.model.Properties"
+ filter="(nisMapName=profile)" />
+ </class>
+
+ <group name="org.apache.directory.odm.test.model.HardwareType" base-rdn="ou=hwtypes"
+ filter="(objectclass=groupOfUniqueNames)" object-classes="top, groupOfUniqueNames" key-class="groupOfUniqueNames"
+ member-attribute="uniqueMember">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="cn" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+
+ <one-to-many name="uniqueMember" type="*" get-method="getMembers" set-method="setMembers" />
+
+ <child name="properties" cardinality="ONE" type="org.apache.directory.odm.test.model.Properties"
+ filter="(nisMapName=profile)" />
+ </group>
+
+ <class name="org.apache.directory.odm.test.model.User" base-rdn="ou=users"
+ filter="(&(objectclass=person)(!(objectclass=computer)))"
+ object-classes="top, person, organizationalPerson, inetOrgPerson" key-class="person">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="cn" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+ <attribute name="sn" type="java.lang.String" />
+ <attribute name="givenName" type="java.lang.String" />
+ <attribute name="userPassword" type="[B" />
+ <attribute name="uid" type="java.lang.Integer" />
+
+ <many-to-many name="userGroups" type="org.apache.directory.odm.test.model.UserGroup" filter="(uniqueMember={0})"
+ member-field="uniqueMember" />
+ </class>
+
+ <group name="org.apache.directory.odm.test.model.UserGroup" base-rdn="ou=usergroups"
+ filter="(objectclass=groupOfUniqueNames)" object-classes="top, groupOfUniqueNames" key-class="groupOfUniqueNames"
+ member-attribute="uniqueMember">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="cn" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+ <many-to-many name="userGroups" type="org.apache.directory.odm.test.model.UserGroup" filter="(uniqueMember={0})"
+ member-field="uniqueMember" />
+ <one-to-many name="uniqueMember" type="*" get-method="getMembers" set-method="setMembers" />
+ </group>
+
+ <class name="org.apache.directory.odm.test.model.Properties" filter="(objectclass=nisMap)"
+ object-classes="top, nisMap" key-class="nisMap">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="nisMapName" get-method="getName" set-method="setName" />
+ <attribute name="description" type="java.lang.String"></attribute>
+ <child name="properties" cardinality="MANY" type="org.apache.directory.odm.test.model.Property" />
+ </class>
+
+ <class name="org.apache.directory.odm.test.model.Property" filter="(objectclass=nisObject)"
+ object-classes="top, nisObject" key-class="nisObject">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="cn" get-method="getName" set-method="setName" />
+
+ <attribute name="nisMapName" type="java.lang.String" get-method="getNisMapName" set-method="setNisMapName" />
+ <attribute name="nisMapEntry" type="java.lang.String" get-method="getValue" set-method="setValue" />
+ </class>
+
+ <class name="org.apache.directory.odm.test.model.OrganizationalUnit" filter="(objectclass=organizationalUnit)"
+ object-classes="top, organizationalUnit" key-class="organizationalUnit">
+ <dn-attribute name="dn" type="java.lang.String" />
+ <rdn-attribute name="ou" get-method="getName" set-method="setName" />
+
+ <attribute name="description" type="java.lang.String" />
+ </class>
+</mapping>
\ No newline at end of file
Propchange: directory/sandbox/hennejg/odm/trunk/src/test/resources/org/apache/odm/test/GENERIC_RFC.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain