1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
18 package org.onap.ccsdk.features.sdnr.wt.common.test;
20 import static org.junit.Assert.assertEquals;
21 import static org.junit.Assert.assertNotNull;
22 import static org.junit.Assert.fail;
24 import java.io.ByteArrayInputStream;
25 import java.io.FileInputStream;
26 import java.io.IOException;
27 import javax.xml.parsers.ParserConfigurationException;
29 import org.junit.Test;
30 import org.onap.ccsdk.features.sdnr.wt.common.file.PomFile;
31 import org.onap.ccsdk.features.sdnr.wt.common.file.PomPropertiesFile;
32 import org.xml.sax.SAXException;
34 public class TestPomfile {
36 private static final String TESTPROPERTY_KEY="elasticsearch-rest-client.version";
37 private static final String TESTPROPERTY_VALUE = "6.4.3";
38 private static final String POMFILENAME = "pom.xml";
39 private static final String POM_PROPERTY = "#Generated by org.apache.felix.bundleplugin\n" +
40 "#Tue Nov 19 11:20:33 CET 2019\n" +
41 "version=0.7.0-SNAPSHOT\n" +
42 "groupId=org.onap.ccsdk.features.sdnr.wt\n" +
43 "artifactId=sdnr-wt-data-provider-provider\n";
44 //private static final Date DATE_EXPECTED = new Date(119, 10, 19, 11, 20, 33);
50 pom = new PomFile(new FileInputStream(POMFILENAME));
51 } catch (ParserConfigurationException | SAXException | IOException e) {
55 assertEquals(TESTPROPERTY_VALUE, pom.getProperty(TESTPROPERTY_KEY));
59 public void testProp() {
60 PomPropertiesFile file = null;
62 file = new PomPropertiesFile(new ByteArrayInputStream(POM_PROPERTY.getBytes()));
63 } catch (IOException e) {
64 // TODO Auto-generated catch block
68 assertNotNull(file.getBuildDate());