1 /*
2  * Copyright 1999-2006 University of Chicago
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  * 
8  * http://www.apache.org/licenses/LICENSE-2.0
9  * 
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "interop_test.h"
18
19 #include "xsd_dateTime.h"
20 #include "xsd_string.h"
21
22 #define WSRL_NS "http://docs.oasis-open.org" \
23                 "/wsrf/2004/06/wsrf-WS-ResourceLifetime-1.2-draft-01.xsd"
24
25 xsd_QName
26 termination_time_rp_qname =
27 {
28     WSRL_NS,
29     "TerminationTime"
30 };
31 xsd_QName
32 current_time_rp_qname =
33 {
34     WSRL_NS,
35     "CurrentTime"
36 };
37
38 xsd_QName
39 foo_rp_qname =
40 {
41     "http://widgets.com",
42     "foo"
43 };
44
45 static
46 globus_xsd_type_info_t termination_time_element_info;
47
48 static
49 globus_xsd_type_info_t current_time_element_info;
50
51 static
52 globus_xsd_type_info_t foo_element_info;
53
54 globus_result_t
55 interop_test_init_registry(
56     globus_xsd_type_registry_t          registry)
57 4 {
58 4     globus_result_t                     result;
59
60 4     result = globus_xsd_type_info_init_from_template(
61         &termination_time_element_info,
62         &termination_time_rp_qname,
63         &xsd_dateTime_info);
64
65 4     if (result != GLOBUS_SUCCESS)
66     {
67 0         goto out;
68     }
69 4     result = globus_xsd_type_info_init_from_template(
70         &current_time_element_info,
71         &current_time_rp_qname,
72         &xsd_dateTime_info);
73
74 4     if (result != GLOBUS_SUCCESS)
75     {
76 0         goto destroy_termination_time_element_info;
77     }
78
79 4     result = globus_xsd_type_info_init_from_template(
80         &foo_element_info,
81         &foo_rp_qname,
82         &xsd_string_info);
83
84 4     if (result != GLOBUS_SUCCESS)
85     {
86 0         goto destroy_current_time_element_info;
87     }
88
89 4     result = globus_xsd_type_registry_insert(
90         registry,
91         foo_element_info,
92         NULL);
93
94 4     if (result != GLOBUS_SUCCESS)
95     {
96 0         goto destroy_foo_element_info;
97     }
98 4     result = globus_xsd_type_registry_insert(
99         registry,
100         current_time_element_info,
101         NULL);
102
103 4     if (result != GLOBUS_SUCCESS)
104     {
105 0         goto destroy_current_time_element_info;
106     }
107 4     result = globus_xsd_type_registry_insert(
108         registry,
109         termination_time_element_info,
110         NULL);
111 4     if (result != GLOBUS_SUCCESS)
112     {
113 0         goto destroy_termination_time_element_info;
114     }
115
116 4     return result;
117
118 destroy_foo_element_info:
119 0     globus_xsd_type_info_destroy(foo_element_info);
120 destroy_current_time_element_info:
121 0     globus_xsd_type_info_destroy(current_time_element_info);
122 destroy_termination_time_element_info:
123 0     globus_xsd_type_info_destroy(termination_time_element_info);
124
125 out:
126 0     return result;
127 }