BUG-6858: adapt to ise api, wire harvestAll to template-provider
[groupbasedpolicy.git] / sxp-integration / sxp-ise-adapter / src / test / java / org / opendaylight / groupbasedpolicy / sxp_ise_adapter / impl / IseResourceTestHelper.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.groupbasedpolicy.sxp_ise_adapter.impl;
10
11 import java.io.BufferedReader;
12 import java.io.IOException;
13 import java.io.InputStream;
14 import java.io.InputStreamReader;
15
16 /**
17  * Purpose: read content of given test file
18  */
19 public class IseResourceTestHelper {
20     public static String readLocalResource(final String resourcePath) throws IOException {
21         final StringBuilder collector = new StringBuilder();
22         try (
23                 final InputStream iseReplySource = IseResourceTestHelper.class.getResourceAsStream(resourcePath);
24                 final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(iseReplySource))
25         ) {
26             String line;
27             while ((line = bufferedReader.readLine()) != null) {
28                 collector.append(line);
29             }
30         }
31         return collector.toString();
32     }
33 }