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