blob: cfe7b9bd58e8888c9ecc86bdba97a4057cba03fc [file] [log] [blame]
Sean Condon06613e92017-06-09 15:14:01 +01001/*
2 * Copyright 2017-present Open Networking Laboratory
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 */
16package org.onosproject.yang.serializers.xml;
17
18import org.onosproject.yang.model.SchemaContext;
19import org.onosproject.yang.runtime.Annotation;
20import org.onosproject.yang.runtime.DefaultAnnotation;
21import org.onosproject.yang.runtime.YangSerializerContext;
22import org.onosproject.yang.runtime.impl.DefaultYangModelRegistry;
23
24import java.util.LinkedList;
25import java.util.List;
26
27public class MockYangSerializerContext implements YangSerializerContext {
28
29 private static MockYangSchemaNodeProvider schemaProvider =
30 new MockYangSchemaNodeProvider();
31 private static final String NETCONF_NS =
32 "urn:ietf:params:xml:ns:netconf:base:1.0";
33 private static final String XMNLS_NC = "xmlns:xc";
34
35
36 @Override
37 public SchemaContext getContext() {
38 schemaProvider.processSchemaRegistry();
39 DefaultYangModelRegistry registry = schemaProvider.registry();
40 return registry;
41 }
42
43 @Override
44 public List<Annotation> getProtocolAnnotations() {
45 Annotation annotation = new DefaultAnnotation(XMNLS_NC, NETCONF_NS);
46 List<Annotation> protocolAnnotation = new LinkedList<>();
47 protocolAnnotation.add(annotation);
48 return protocolAnnotation;
49 }
50}