-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Schema generation from Annotations (#452)
* Add test for Schema generation from Annotations While working on the PatchGenerator I noticed a bug in the type detection. This change adds tests and simplifies related logic * Replaces ResourceReference with more specific GroupMembership/UserGroup The attributes of each are slightly different Fixes: #425
- Loading branch information
Showing
12 changed files
with
896 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...m-spec-schema/src/main/java/org/apache/directory/scim/spec/resources/GroupMembership.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* 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.scim.spec.resources; | ||
|
||
import jakarta.xml.bind.annotation.XmlAccessType; | ||
import jakarta.xml.bind.annotation.XmlAccessorType; | ||
import jakarta.xml.bind.annotation.XmlElement; | ||
import jakarta.xml.bind.annotation.XmlEnum; | ||
import jakarta.xml.bind.annotation.XmlEnumValue; | ||
import jakarta.xml.bind.annotation.XmlType; | ||
import lombok.Data; | ||
import org.apache.directory.scim.spec.annotation.ScimAttribute; | ||
import org.apache.directory.scim.spec.annotation.ScimResourceIdReference; | ||
import org.apache.directory.scim.spec.schema.Schema; | ||
|
||
import java.io.Serializable; | ||
|
||
@Data | ||
@XmlType(propOrder = {"value","ref","display","type"}) | ||
@XmlAccessorType(XmlAccessType.NONE) | ||
public class GroupMembership implements Serializable { | ||
|
||
private static final long serialVersionUID = 9126588075353486789L; | ||
|
||
@XmlEnum | ||
public enum Type { | ||
@XmlEnumValue("User") USER, | ||
@XmlEnumValue("Group") GROUP; | ||
} | ||
|
||
@ScimAttribute(description="Identifier of the member of this Group.", | ||
mutability = Schema.Attribute.Mutability.IMMUTABLE) | ||
@ScimResourceIdReference | ||
@XmlElement | ||
String value; | ||
|
||
@ScimAttribute(name = "$ref", description="The URI corresponding to a SCIM resource that is a member of this Group.", | ||
referenceTypes={"User", "Group"}, | ||
mutability = Schema.Attribute.Mutability.IMMUTABLE) | ||
@XmlElement(name = "$ref") | ||
String ref; | ||
|
||
@ScimAttribute(description="A human readable name, primarily used for display purposes.", | ||
mutability = Schema.Attribute.Mutability.READ_ONLY) | ||
@XmlElement | ||
String display; | ||
|
||
@ScimAttribute(description="A label indicating the type of resource, e.g., 'User' or 'Group'.", | ||
canonicalValueList={"User", "Group"}, | ||
mutability = Schema.Attribute.Mutability.IMMUTABLE) | ||
@XmlElement | ||
Type type; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.