diff options
Diffstat (limited to 'datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java')
-rw-r--r-- | datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java index cbc3e122..25f0dbfc 100644 --- a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java +++ b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java @@ -1,58 +1,51 @@ -/* - * ============LICENSE_START====================================================================== - * Copyright (C) 2018 NOKIA Intellectual Property, 2018-2019 Nordix Foundation. All rights reserved. - * =============================================================================================== - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END======================================================================== + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ package org.onap.dcaegen2.collectors.datafile.model; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.Test; +import java.nio.file.Paths; -class CommonFunctionsTest { - // @formatter:off - private ConsumerDmaapModel model = ImmutableConsumerDmaapModel.builder() - .productName("NrRadio") - .vendorName("Ericsson") - .lastEpochMicrosec("8745745764578") - .sourceName("oteNB5309") - .startEpochMicrosec("8745745764578") - .timeZoneOffset("UTC+05:00") - .name("A20161224.1030-1045.bin.gz") - .location("ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz") - .internalLocation("target/A20161224.1030-1045.bin.gz") - .compression("gzip") - .fileFormatType("org.3GPP.32.435#measCollec") - .fileFormatVersion("V10") - .build(); +import org.junit.jupiter.api.Test; - private static final String EXPECTED_RESULT = - "{\"productName\":\"NrRadio\"," - + "\"vendorName\":\"Ericsson\"," - + "\"lastEpochMicrosec\":\"8745745764578\"," - + "\"sourceName\":\"oteNB5309\"," - + "\"startEpochMicrosec\":\"8745745764578\"," - + "\"timeZoneOffset\":\"UTC+05:00\"," - + "\"name\":\"A20161224.1030-1045.bin.gz\"," - + "\"location\":\"ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz\"," - + "\"internalLocation\":\"target/A20161224.1030-1045.bin.gz\"," - + "\"compression\":\"gzip\"," - + "\"fileFormatType\":\"org.3GPP.32.435#measCollec\"," - + "\"fileFormatVersion\":\"V10\"}"; - // @formatter:on +public class CommonFunctionsTest { @Test - void createJsonBody_shouldReturnJsonInString() { - assertEquals(EXPECTED_RESULT, CommonFunctions.createJsonBody(model)); + public void createJsonBody_success() { + ImmutableConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel // + .builder() // + .productName("") // + .vendorName("") // + .lastEpochMicrosec("") // + .sourceName("") // + .startEpochMicrosec("") // + .timeZoneOffset("") // + .name("") // + .location("") // + .internalLocation(Paths.get("internalLocation")) // + .compression("") // + .fileFormatType("") // + .fileFormatVersion("") // + .build(); + String actualBody = CommonFunctions.createJsonBody(consumerDmaapModel); + + assertTrue(actualBody.contains("\"internalLocation\":\"internalLocation\"")); } -}
\ No newline at end of file +} |