sonu gupta | 1bb37b8 | 2016-11-11 16:51:18 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-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 | */ |
| 16 | |
| 17 | package org.onosproject.yms.app.ydt; |
| 18 | |
| 19 | import org.onosproject.yangutils.datamodel.YangSchemaNode; |
| 20 | import org.onosproject.yms.app.ynh.YangNotificationExtendedService; |
| 21 | import org.onosproject.yms.app.ysr.DefaultYangSchemaRegistry; |
| 22 | import org.onosproject.yms.app.ysr.TestYangSchemaNodeProvider; |
| 23 | import org.onosproject.yms.app.ysr.YangSchemaRegistry; |
| 24 | |
| 25 | import static org.junit.Assert.assertEquals; |
| 26 | |
| 27 | |
| 28 | /** |
| 29 | * Represent Yang schema registry. Yang schema registry provides |
| 30 | * interface to an application to register its YANG |
| 31 | * schema with YMS. It provides YANG schema nodes to YDT, YNB and YSB. |
| 32 | */ |
| 33 | public class MockYangSchemaRegistry implements YangSchemaRegistry { |
| 34 | |
| 35 | |
| 36 | @Override |
| 37 | public void registerApplication( |
| 38 | Object managerObject, |
| 39 | Class<?> serviceClass, |
| 40 | YangNotificationExtendedService notificationExtendedService) { |
| 41 | } |
| 42 | |
| 43 | @Override |
| 44 | public void unRegisterApplication(Object managerObject, |
| 45 | Class<?> serviceClass) { |
| 46 | } |
| 47 | |
| 48 | @Override |
| 49 | public Object getRegisteredApplication(YangSchemaNode yangSchemaNode) { |
| 50 | return null; |
| 51 | } |
| 52 | |
| 53 | @Override |
| 54 | public YangSchemaNode getYangSchemaNodeUsingAppName(String schemaName) { |
| 55 | return null; |
| 56 | } |
| 57 | |
| 58 | @Override |
| 59 | public YangSchemaNode getYangSchemaNodeUsingSchemaName(String appName) { |
| 60 | |
| 61 | final String target = "target/TestYangSchemaNodeProvider"; |
| 62 | TestYangSchemaNodeProvider testYangSchemaNodeProvider = |
| 63 | new TestYangSchemaNodeProvider(); |
| 64 | |
| 65 | String searchDir = "src/test/resources/ydtTestYangFiles/"; |
| 66 | |
| 67 | testYangSchemaNodeProvider.processSchemaRegistry(null); |
| 68 | |
| 69 | DefaultYangSchemaRegistry registry = testYangSchemaNodeProvider |
| 70 | .getDefaultYangSchemaRegistry(); |
| 71 | YangSchemaNode yangNode = registry |
| 72 | .getYangSchemaNodeUsingSchemaName(appName); |
| 73 | assertEquals(appName, yangNode.getName()); |
| 74 | return yangNode; |
| 75 | } |
| 76 | |
| 77 | @Override |
| 78 | public YangSchemaNode |
| 79 | getYangSchemaNodeUsingGeneratedRootNodeInterfaceFileName( |
| 80 | String rootInterfaceFileName) { |
| 81 | return null; |
| 82 | } |
| 83 | |
| 84 | @Override |
| 85 | public YangSchemaNode getYangSchemaNodeUsingGeneratedRootNodeOpPramFileName( |
| 86 | String rootOpParamFileName) { |
| 87 | return null; |
| 88 | } |
| 89 | |
| 90 | @Override |
| 91 | public YangSchemaNode getRootYangSchemaNodeForNotification( |
| 92 | String eventSubject) { |
| 93 | return null; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public Class<?> getRegisteredClass(YangSchemaNode schemaNode, |
| 98 | String appName) { |
| 99 | return null; |
| 100 | } |
| 101 | } |