0c1ac43681979c25a40a1f5431b4b9d6d1e3a8a0
[dcaegen2/collectors/datafile.git] /
1 /*
2  * ============LICENSE_START======================================================================
3  * Copyright (C) 2018 NOKIA Intellectual Property, 2018-2019 Nordix Foundation. All rights reserved.
4  * ===============================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
6  * in compliance with the License. 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 distributed under the License
11  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12  * or implied. See the License for the specific language governing permissions and limitations under
13  * the License.
14  * ============LICENSE_END========================================================================
15  */
16
17 package org.onap.dcaegen2.collectors.datafile.model;
18
19 import java.nio.file.Path;
20 import java.nio.file.Paths;
21
22 import org.junit.jupiter.api.Assertions;
23 import org.junit.jupiter.api.Test;
24
25 public class ConsumerDmaapModelTest {
26     private static final String PRODUCT_NAME = "NrRadio";
27     private static final String VENDOR_NAME = "Ericsson";
28     private static final String LAST_EPOCH_MICROSEC = "8745745764578";
29     private static final String SOURCE_NAME = "oteNB5309";
30     private static final String START_EPOCH_MICROSEC = "8745745764578";
31     private static final String TIME_ZONE_OFFSET = "UTC+05:00";
32     private static final String NAME = "A20161224.1030-1045.bin.gz";
33     private static final String LOCATION = "ftpes://192.168.0.101:22/ftp/rop/A20161224.1030-1145.bin.gz";
34     private static final Path INTERNAL_LOCATION = Paths.get("target/A20161224.1030-1045.bin.gz");
35     private static final String COMPRESSION = "gzip";
36     private static final String FILE_FORMAT_TYPE = "org.3GPP.32.435#measCollec";
37     private static final String FILE_FORMAT_VERSION = "V10";
38
39     @Test
40     public void consumerDmaapModelBuilder_shouldBuildAnObject() {
41         ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder() //
42                 .productName(PRODUCT_NAME) //
43                 .vendorName(VENDOR_NAME) //
44                 .lastEpochMicrosec(LAST_EPOCH_MICROSEC) //
45                 .sourceName(SOURCE_NAME) //
46                 .startEpochMicrosec(START_EPOCH_MICROSEC) //
47                 .timeZoneOffset(TIME_ZONE_OFFSET) //
48                 .name(NAME) //
49                 .location(LOCATION) //
50                 .internalLocation(INTERNAL_LOCATION) //
51                 .compression(COMPRESSION) //
52                 .fileFormatType(FILE_FORMAT_TYPE) //
53                 .fileFormatVersion(FILE_FORMAT_VERSION) //
54                 .build();
55
56         Assertions.assertNotNull(consumerDmaapModel);
57         Assertions.assertEquals(PRODUCT_NAME, consumerDmaapModel.getProductName());
58         Assertions.assertEquals(VENDOR_NAME, consumerDmaapModel.getVendorName());
59         Assertions.assertEquals(LAST_EPOCH_MICROSEC, consumerDmaapModel.getLastEpochMicrosec());
60         Assertions.assertEquals(SOURCE_NAME, consumerDmaapModel.getSourceName());
61         Assertions.assertEquals(START_EPOCH_MICROSEC, consumerDmaapModel.getStartEpochMicrosec());
62         Assertions.assertEquals(TIME_ZONE_OFFSET, consumerDmaapModel.getTimeZoneOffset());
63         Assertions.assertEquals(NAME, consumerDmaapModel.getName());
64         Assertions.assertEquals(LOCATION, consumerDmaapModel.getLocation());
65         Assertions.assertEquals(INTERNAL_LOCATION, consumerDmaapModel.getInternalLocation());
66         Assertions.assertEquals(COMPRESSION, consumerDmaapModel.getCompression());
67         Assertions.assertEquals(FILE_FORMAT_TYPE, consumerDmaapModel.getFileFormatType());
68         Assertions.assertEquals(FILE_FORMAT_VERSION, consumerDmaapModel.getFileFormatVersion());
69     }
70 }