Repository: cxf Updated Branches: refs/heads/master e158c96dc -> 517ef67f1
http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java new file mode 100644 index 0000000..c96eec5 --- /dev/null +++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/StudentPutResourceValidator.java @@ -0,0 +1,47 @@ +/** + * 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.cxf.systest.ws.transfer.validator; + +import org.w3c.dom.Element; +import org.apache.cxf.ws.transfer.Representation; +import org.apache.cxf.ws.transfer.shared.faults.PutDenied; +import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator; + +public class StudentPutResourceValidator implements ResourceValidator { + + public static final String UID_NAMESPACE = "http://university.edu/student"; + + public static final String UID_NAME = "uid"; + + @Override + public boolean validate(Representation newRepresentation, Representation oldRepresentation) { + Element newRepresentationEl = (Element) newRepresentation.getAny(); + Element oldRepresentationEl = (Element) oldRepresentation.getAny(); + + String newUid = newRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent(); + String oldUid = oldRepresentationEl.getElementsByTagNameNS(UID_NAMESPACE, UID_NAME).item(0).getTextContent(); + + if (!newUid.equals(oldUid)) { + throw new PutDenied(); + } + return true; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java new file mode 100644 index 0000000..0371366 --- /dev/null +++ b/systests/ws-transfer/src/test/java/org/apache/cxf/systest/ws/transfer/validator/TeacherResourceValidator.java @@ -0,0 +1,51 @@ +/** + * 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.cxf.systest.ws.transfer.validator; + +import org.w3c.dom.Element; +import org.apache.cxf.ws.transfer.Representation; +import org.apache.cxf.ws.transfer.shared.faults.PutDenied; +import org.apache.cxf.ws.transfer.validationtransformation.ResourceValidator; + +public class TeacherResourceValidator implements ResourceValidator { + + public static final String UID_NAMESPACE = "http://university.edu/teacher"; + + public static final String UID_NAME = "uid"; + + @Override + public boolean validate(Representation newRepresentation, Representation oldRepresentation) { + if (oldRepresentation != null) { + Element newRepresentationEl = (Element) newRepresentation.getAny(); + Element oldRepresentationEl = (Element) oldRepresentation.getAny(); + + String newUid = newRepresentationEl.getElementsByTagNameNS( + UID_NAMESPACE, UID_NAME).item(0).getTextContent(); + String oldUid = oldRepresentationEl.getElementsByTagNameNS( + UID_NAMESPACE, UID_NAME).item(0).getTextContent(); + + if (!newUid.equals(oldUid)) { + throw new PutDenied(); + } + } + return true; + } + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd new file mode 100644 index 0000000..1947c45 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/schema/studentCreate.xsd @@ -0,0 +1,46 @@ +<?xml version="1.0"?> + +<!-- + 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. +--> + +<xs:schema version="1.0" + targetNamespace="http://university.edu/student" + xmlns:ns="http://university.edu/student" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified"> + + <xs:complexType name="birthDateType"> + <xs:sequence> + <xs:element name="day" type="xs:integer"/> + <xs:element name="month" type="xs:integer"/> + <xs:element name="year" type="xs:integer"/> + </xs:sequence> + </xs:complexType> + + <xs:element name="student"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" /> + <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" /> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/studentPut.xsd ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/schema/studentPut.xsd b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd new file mode 100644 index 0000000..831ffce --- /dev/null +++ b/systests/ws-transfer/src/test/resources/schema/studentPut.xsd @@ -0,0 +1,47 @@ +<?xml version="1.0"?> + +<!-- + 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. +--> + +<xs:schema version="1.0" + targetNamespace="http://university.edu/student" + xmlns:ns="http://university.edu/student" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified"> + + <xs:complexType name="birthDateType"> + <xs:sequence> + <xs:element name="day" type="xs:integer"/> + <xs:element name="month" type="xs:integer"/> + <xs:element name="year" type="xs:integer"/> + </xs:sequence> + </xs:complexType> + + <xs:element name="student"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" /> + <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" /> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacher.xsd ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/schema/teacher.xsd b/systests/ws-transfer/src/test/resources/schema/teacher.xsd new file mode 100644 index 0000000..8dab259 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/schema/teacher.xsd @@ -0,0 +1,47 @@ +<?xml version="1.0"?> + +<!-- + 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. +--> + +<xs:schema version="1.0" + targetNamespace="http://university.edu/teacher" + xmlns:ns="http://university.edu/teacher" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified"> + + <xs:complexType name="birthDateType"> + <xs:sequence> + <xs:element name="day" type="xs:integer"/> + <xs:element name="month" type="xs:integer"/> + <xs:element name="year" type="xs:integer"/> + </xs:sequence> + </xs:complexType> + + <xs:element name="teacher"> + <xs:complexType> + <xs:sequence> + <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="surname" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="birthdate" type="ns:birthDateType" minOccurs="0" maxOccurs="1" /> + <xs:element name="address" type="xs:string" minOccurs="0" maxOccurs="1" /> + <xs:element name="uid" type="xs:integer" minOccurs="1" maxOccurs="1" /> + </xs:sequence> + </xs:complexType> + </xs:element> +</xs:schema> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd new file mode 100644 index 0000000..db1965f --- /dev/null +++ b/systests/ws-transfer/src/test/resources/schema/teacherCreateBasic.xsd @@ -0,0 +1,35 @@ +<?xml version="1.0"?> + +<!-- + 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. +--> + +<xs:schema version="1.0" + targetNamespace="http://university.edu/teacher" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + elementFormDefault="qualified"> + + <xs:element name="teacher"> + <xs:complexType> + <xs:sequence> + <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" /> + </xs:sequence> + </xs:complexType> + </xs:element> + +</xs:schema> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudent.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createStudent.xml b/systests/ws-transfer/src/test/resources/xml/createStudent.xml new file mode 100644 index 0000000..cb021af --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createStudent.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<student xmlns="http://university.edu/student"> + <name>John</name> + <surname>Smith</surname> + <birthdate> + <day>14</day> + <month>3</month> + <year>1994</year> + </birthdate> + <address>Street 21</address> +</student> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml new file mode 100644 index 0000000..3c00e64 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createStudentPartial.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<student xmlns="http://university.edu/student"> + <name>John</name> + <birthdate> + <day>14</day> + <month>3</month> + <year>1994</year> + </birthdate> +</student> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml new file mode 100644 index 0000000..957af34 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createStudentWrong.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<student xmlns="http://university.edu/student"> + <name>John</name> + <surname>Smith</surname> + <birthdate> + <day>14</day> + <month>3</month> + <year>1994</year> + </birthdate> + <address>Street 21</address> + <school>Standford</school> +</student> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacher.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacher.xml b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml new file mode 100644 index 0000000..0d6e18b --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createTeacher.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<teacher xmlns="http://university.edu/teacher"> + <name>Bob</name> + <surname>Stuart</surname> + <birthdate> + <day>5</day> + <month>7</month> + <year>1971</year> + </birthdate> + <address>Street 526</address> +</teacher> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml new file mode 100644 index 0000000..f9025b2 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createTeacherPartial.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<teacher xmlns="http://university.edu/teacher"> + <name>Bob</name> + <address>Street 526</address> +</teacher> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml new file mode 100644 index 0000000..31f86e6 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/createTeacherWrong.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<teacher xmlns="http://university.edu/teacher"> + <name>Bob</name> + <surname>Stuart</surname> + <birthdate> + <day>5</day> + <month>7</month> + <year>1971</year> + </birthdate> + <address>Street 526</address> + <school>Standford</school> +</teacher> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putStudent.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/putStudent.xml b/systests/ws-transfer/src/test/resources/xml/putStudent.xml new file mode 100644 index 0000000..2112f8c --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/putStudent.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<student xmlns="http://university.edu/student"> + <name>John</name> + <surname>Smith</surname> + <birthdate> + <day>14</day> + <month>3</month> + <year>1994</year> + </birthdate> + <address>Street 12</address> + <uid>1</uid> +</student> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/putTeacher.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/putTeacher.xml b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml new file mode 100644 index 0000000..dda58a8 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/putTeacher.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<teacher xmlns="http://university.edu/teacher"> + <name>Bob</name> + <surname>Stuart</surname> + <birthdate> + <day>5</day> + <month>7</month> + <year>1971</year> + </birthdate> + <address>Street 526</address> + <uid>1</uid> +</teacher> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xml/random.xml ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xml/random.xml b/systests/ws-transfer/src/test/resources/xml/random.xml new file mode 100644 index 0000000..43aa6b7 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xml/random.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<foo> + <bar/> +</foo> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl new file mode 100644 index 0000000..e9255f9 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xslt/studentCreate.xsl @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<xsl:stylesheet xmlns="http://university.edu/student" + xmlns:ns="http://university.edu/student" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager" + exclude-result-prefixes="uid" + version="1.0"> + <xsl:output method="xml"/> + + <xsl:template match="/"> + <xsl:element name="student"> + <xsl:call-template name="name"/> + <xsl:call-template name="surname"/> + <xsl:call-template name="birthdate"/> + <xsl:call-template name="address"/> + <xsl:call-template name="uid"/> + </xsl:element> + </xsl:template> + + <xsl:template name="name"> + <xsl:choose> + <xsl:when test="/ns:student/ns:name"> + <xsl:element name="name"> + <xsl:value-of select="/ns:student/ns:name" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="name">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="surname"> + <xsl:choose> + <xsl:when test="/ns:student/ns:surname"> + <xsl:element name="surname"> + <xsl:value-of select="/ns:student/ns:surname" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="surname">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="birthdate"> + <xsl:choose> + <xsl:when test="/ns:student/ns:birthdate"> + <xsl:element name="date"> + <xsl:element name="day"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:day" /> + </xsl:element> + <xsl:element name="month"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:month" /> + </xsl:element> + <xsl:element name="year"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:year" /> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="date"> + <xsl:element name="day">Unspecified</xsl:element> + <xsl:element name="month">Unspecified</xsl:element> + <xsl:element name="year">Unspecified</xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="address"> + <xsl:choose> + <xsl:when test="/ns:student/ns:address"> + <xsl:element name="address"> + <xsl:value-of select="/ns:student/ns:address" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="address">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="uid"> + <xsl:element name="uid"> + <xsl:value-of select="uid:getUID()" /> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl new file mode 100644 index 0000000..2768e5e --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xslt/studentPut.xsl @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<xsl:stylesheet xmlns="http://university.edu/student" + xmlns:ns="http://university.edu/student" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + <xsl:output method="xml"/> + + <xsl:template match="/"> + <xsl:element name="student"> + <xsl:call-template name="name"/> + <xsl:call-template name="surname"/> + <xsl:call-template name="birthdate"/> + <xsl:call-template name="address"/> + <xsl:call-template name="uid"/> + </xsl:element> + </xsl:template> + + <xsl:template name="name"> + <xsl:choose> + <xsl:when test="/ns:student/ns:name"> + <xsl:element name="name"> + <xsl:value-of select="/ns:student/ns:name" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="name">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="surname"> + <xsl:choose> + <xsl:when test="/ns:student/ns:surname"> + <xsl:element name="surname"> + <xsl:value-of select="/ns:student/ns:surname" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="surname">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="birthdate"> + <xsl:choose> + <xsl:when test="/ns:student/ns:birthdate"> + <xsl:element name="date"> + <xsl:element name="day"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:day" /> + </xsl:element> + <xsl:element name="month"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:month" /> + </xsl:element> + <xsl:element name="year"> + <xsl:value-of select="/ns:student/ns:birthdate/ns:year" /> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="date"> + <xsl:element name="day">Unspecified</xsl:element> + <xsl:element name="month">Unspecified</xsl:element> + <xsl:element name="year">Unspecified</xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="address"> + <xsl:choose> + <xsl:when test="/ns:student/ns:address"> + <xsl:element name="address"> + <xsl:value-of select="/ns:student/ns:address" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="address">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="uid"> + <xsl:element name="uid"> + <xsl:value-of select="ns:student/ns:uid" /> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl new file mode 100644 index 0000000..25c0aac --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xslt/teacherCreateBasic.xsl @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<xsl:stylesheet xmlns="http://university.edu/teacher" + xmlns:ns="http://university.edu/teacher" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:uid="org.apache.cxf.systest.ws.transfer.UIDManager" + exclude-result-prefixes="uid" + version="1.0"> + <xsl:output method="xml"/> + + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" /> + </xsl:copy> + </xsl:template> + + <xsl:template match="/ns:teacher"> + <xsl:element name="teacher"> + <xsl:apply-templates select="@*|node()" /> + <xsl:element name="uid"> + <xsl:value-of select="uid:getUID()" /> + </xsl:element> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> http://git-wip-us.apache.org/repos/asf/cxf/blob/517ef67f/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl ---------------------------------------------------------------------- diff --git a/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl new file mode 100644 index 0000000..6ab40d3 --- /dev/null +++ b/systests/ws-transfer/src/test/resources/xslt/teacherDefaultValues.xsl @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + 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. +--> + +<xsl:stylesheet xmlns="http://university.edu/teacher" + xmlns:ns="http://university.edu/teacher" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + <xsl:output method="xml"/> + + <xsl:template match="/"> + <xsl:element name="teacher"> + <xsl:call-template name="name"/> + <xsl:call-template name="surname"/> + <xsl:call-template name="birthdate"/> + <xsl:call-template name="address"/> + <xsl:call-template name="uid" /> + </xsl:element> + </xsl:template> + + <xsl:template name="name"> + <xsl:choose> + <xsl:when test="/ns:teacher/ns:name"> + <xsl:element name="name"> + <xsl:value-of select="/ns:teacher/ns:name" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="name">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="surname"> + <xsl:choose> + <xsl:when test="/ns:teacher/ns:surname"> + <xsl:element name="surname"> + <xsl:value-of select="/ns:teacher/ns:surname" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="surname">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="birthdate"> + <xsl:choose> + <xsl:when test="/ns:teacher/ns:birthdate"> + <xsl:element name="date"> + <xsl:element name="day"> + <xsl:value-of select="/ns:teacher/ns:birthdate/ns:day" /> + </xsl:element> + <xsl:element name="month"> + <xsl:value-of select="/ns:teacher/ns:birthdate/ns:month" /> + </xsl:element> + <xsl:element name="year"> + <xsl:value-of select="/ns:teacher/ns:birthdate/ns:year" /> + </xsl:element> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="date"> + <xsl:element name="day">Unspecified</xsl:element> + <xsl:element name="month">Unspecified</xsl:element> + <xsl:element name="year">Unspecified</xsl:element> + </xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="address"> + <xsl:choose> + <xsl:when test="/ns:teacher/ns:address"> + <xsl:element name="address"> + <xsl:value-of select="/ns:teacher/ns:address" /> + </xsl:element> + </xsl:when> + <xsl:otherwise> + <xsl:element name="address">Unspecified</xsl:element> + </xsl:otherwise> + </xsl:choose> + </xsl:template> + + <xsl:template name="uid"> + <xsl:element name="uid"> + <xsl:value-of select="/ns:teacher/ns:uid" /> + </xsl:element> + </xsl:template> + +</xsl:stylesheet>
