aboutsummaryrefslogtreecommitdiffstats
path: root/datafile-commons/src/test
diff options
context:
space:
mode:
authorelinuxhenrik <henrik.b.andersson@est.tech>2018-09-14 15:49:10 +0200
committerelinuxhenrik <henrik.b.andersson@est.tech>2018-09-17 08:06:07 +0200
commitf394594ec70aaf1eefa4f23b80226c3426dbc17a (patch)
tree89e280889259b11c2651b06fb55d679cf5faf410 /datafile-commons/src/test
parent7ceca5db40ff6cbd88c95fe335a6a6e582189066 (diff)
Deliver first version of Datafile
Change-Id: Iadd1455d7fe45b4c022dd7fde2f8a506d1b7cd57 Issue-ID: DCAEGEN2-640 Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Diffstat (limited to 'datafile-commons/src/test')
-rw-r--r--datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/CommonFunctionsTest.java37
-rw-r--r--datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java57
-rw-r--r--datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/utils/HttpUtilsTest.java20
3 files changed, 50 insertions, 64 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 d3a0fb18..675589fb 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,21 +1,17 @@
/*
- * ============LICENSE_START=======================================================
- * Datafile Collector Service
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. 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) 2018 NOKIA Intellectual Property, 2018 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
*
- * 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.
+ * ============LICENSE_END========================================================================
*/
package org.onap.dcaegen2.collectors.datafile.model;
@@ -29,14 +25,13 @@ import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.collectors.datafile.model.CommonFunctions;
-import org.onap.dcaegen2.collectors.datafile.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.collectors.datafile.model.ConsumerDmaapModelForUnitTest;
class CommonFunctionsTest {
-
// Given
private ConsumerDmaapModel model = new ConsumerDmaapModelForUnitTest();
+ private static final String EXPECTED_RESULT =
+ "{\"location\":\"target/A20161224.1030-1045.bin.gz\",\"compression\":\"gzip\","
+ + "\"fileFormatType\":\"org.3GPP.32.435#measCollec\",\"fileFormatVersion\":\"V10\"}";
private static final HttpResponse httpResponseMock = mock(HttpResponse.class);
private static final HttpEntity httpEntityMock = mock(HttpEntity.class);
@@ -50,8 +45,6 @@ class CommonFunctionsTest {
@Test
void createJsonBody_shouldReturnJsonInString() {
- String expectedResult = "{\"pnf-name\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\""
- + ",\"ipaddress-v6-oam\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"}";
- assertEquals(expectedResult, CommonFunctions.createJsonBody(model));
+ assertEquals(EXPECTED_RESULT, CommonFunctions.createJsonBody(model));
}
}
diff --git a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java
index 50eb434b..dcccd5f5 100644
--- a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java
+++ b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/ConsumerDmaapModelTest.java
@@ -1,50 +1,45 @@
/*
- * ============LICENSE_START=======================================================
- * Datafile Collector Service
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. 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) 2018 NOKIA Intellectual Property, 2018 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
*
- * 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.
+ * ============LICENSE_END========================================================================
*/
package org.onap.dcaegen2.collectors.datafile.model;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.collectors.datafile.model.ConsumerDmaapModel;
-import org.onap.dcaegen2.collectors.datafile.model.ImmutableConsumerDmaapModel;
-class ConsumerDmaapModelTest {
+public class ConsumerDmaapModelTest {
+
+ // Given
+ private ConsumerDmaapModel consumerDmaapModel;
+ private static final String LOCATION = "target/A20161224.1030-1045.bin.gz";
+ private static final String COMPRESSION = "gzip";
+ private static final String FILE_FORMAT_TYPE = "org.3GPP.32.435#measCollec";
+ private static final String FILE_FORMAT_VERSION = "V10";
@Test
- void consumerDmaapModelBuilder_shouldBuildAnObject() {
+ public void consumerDmaapModelBuilder_shouldBuildAnObject() {
// When
- // Given
- String pnfName = "NOKnhfsadhff";
- String ipv4 = "11.22.33.155";
- String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334";
- ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder()
- .pnfName(pnfName)
- .ipv4(ipv4)
- .ipv6(ipv6)
- .build();
+ consumerDmaapModel = ImmutableConsumerDmaapModel.builder().location(LOCATION).compression(COMPRESSION)
+ .fileFormatType(FILE_FORMAT_TYPE).fileFormatVersion(FILE_FORMAT_VERSION).build();
// Then
Assertions.assertNotNull(consumerDmaapModel);
- Assertions.assertEquals(pnfName, consumerDmaapModel.getPnfName());
- Assertions.assertEquals(ipv4, consumerDmaapModel.getIpv4());
- Assertions.assertEquals(ipv6, consumerDmaapModel.getIpv6());
+ Assertions.assertEquals(LOCATION, consumerDmaapModel.getLocation());
+ Assertions.assertEquals(COMPRESSION, consumerDmaapModel.getCompression());
+ Assertions.assertEquals(FILE_FORMAT_TYPE, consumerDmaapModel.getFileFormatType());
+ Assertions.assertEquals(FILE_FORMAT_VERSION, consumerDmaapModel.getFileFormatVersion());
}
}
diff --git a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/utils/HttpUtilsTest.java b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/utils/HttpUtilsTest.java
index 544470a4..83fe14a7 100644
--- a/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/utils/HttpUtilsTest.java
+++ b/datafile-commons/src/test/java/org/onap/dcaegen2/collectors/datafile/model/utils/HttpUtilsTest.java
@@ -1,9 +1,7 @@
/*
- * ============LICENSE_START=======================================================
- * Datafile Collector Service
- * ================================================================================
- * Copyright (C) 2018 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
+ * ============LICENSE_START======================================================================
+ * Copyright (C) 2018 NOKIA Intellectual Property, 2018 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
@@ -15,7 +13,7 @@
* 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=========================================================
+ * ============LICENSE_END========================================================================
*/
package org.onap.dcaegen2.collectors.datafile.model.utils;
@@ -25,17 +23,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import org.apache.http.HttpStatus;
import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.collectors.datafile.model.utils.HttpUtils;
-class HttpUtilsTest {
+
+public class HttpUtilsTest {
@Test
- void isSuccessfulResponseCode_shouldReturnTrue() {
+ public void isSuccessfulResponseCode_shouldReturnTrue() {
assertTrue(HttpUtils.isSuccessfulResponseCode(HttpUtils.SC_ACCEPTED));
}
@Test
- void isSuccessfulResponseCode_shouldReturnFalse() {
+ public void isSuccessfulResponseCode_shouldReturnFalse() {
assertFalse(HttpUtils.isSuccessfulResponseCode(HttpStatus.SC_BAD_GATEWAY));
}
-} \ No newline at end of file
+}