Commit ea8c6826 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

Merge branch 'haaggarw-ut' into 'master'

Add UT for Azure

See merge request !185
parents 5a74fb37 67293aaf
Pipeline #105376 passed with stages
in 28 minutes and 5 seconds
......@@ -18,6 +18,7 @@ The following software have components provided under the terms of this license:
- ASM based accessors helper used by json-smart (from https://urielch.github.io/)
- AWS SDK For Java (from https://aws.amazon.com/sdkforjava)
- AWS SDK for Java - BOM (from https://aws.amazon.com/sdkforjava)
- AWS SDK for Java - Models (from https://aws.amazon.com/sdkforjava)
- Adapter: RxJava (from https://repo1.maven.org/maven2/com/squareup/retrofit2/adapter-rxjava)
- Apache Commons Codec (from http://commons.apache.org/proper/commons-codec/, https://commons.apache.org/proper/commons-codec/)
- Apache Commons Collections (from http://commons.apache.org/proper/commons-collections/)
......@@ -280,8 +281,6 @@ The following software have components provided under the terms of this license:
========================================================================
CC-BY-2.5
========================================================================
The following software have components provided under the terms of this license:
- FindBugs-jsr305 (from http://findbugs.sourceforge.net/)
========================================================================
......@@ -385,8 +384,6 @@ The following software have components provided under the terms of this license:
========================================================================
GPL-2.0-or-later
========================================================================
The following software have components provided under the terms of this license:
- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org)
========================================================================
......@@ -411,8 +408,6 @@ The following software have components provided under the terms of this license:
========================================================================
GPL-3.0-only
========================================================================
The following software have components provided under the terms of this license:
- Expression Language 3.0 (from http://el-spec.java.net, http://uel.java.net, https://projects.eclipse.org/projects/ee4j.el)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Project Lombok (from http://projectlombok.org, https://projectlombok.org)
......@@ -421,8 +416,6 @@ The following software have components provided under the terms of this license:
========================================================================
JSON
========================================================================
The following software have components provided under the terms of this license:
- JSON in Java (from https://github.com/douglascrockford/JSON-java)
========================================================================
......@@ -446,8 +439,6 @@ The following software have components provided under the terms of this license:
========================================================================
LGPL-2.1-or-later
========================================================================
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
- SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org)
......@@ -511,23 +502,17 @@ The following software have components provided under the terms of this license:
========================================================================
MPL-1.1
========================================================================
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
========================================================================
MPL-2.0
========================================================================
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
- OkHttp (from https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp, https://square.github.io/okhttp/)
========================================================================
PHP-3.01
========================================================================
The following software have components provided under the terms of this license:
- Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api)
- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec)
......@@ -546,8 +531,6 @@ The following software have components provided under the terms of this license:
========================================================================
WTFPL
========================================================================
The following software have components provided under the terms of this license:
- Reflections (from http://code.google.com/p/reflections/, http://github.com/ronmamo/reflections)
========================================================================
......
......@@ -144,6 +144,29 @@
<artifactId>core-lib-azure</artifactId>
<version>${osdu.corelibazure.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito2 -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4 -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
......
// Copyright © 2021 Amazon Web Services
//
// 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
//
// 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.
package org.opengroup.osdu.dataset.provider.azure.config;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class OsduApiConfigTest {
private final String FILE = "file_name";
private final String FILE_COLLECTION = "file-collection";
@Test
public void should_successfully_create_config() {
OsduApiConfig config = new OsduApiConfig();
config.setFile(FILE);
config.setFileCollection(FILE_COLLECTION);
assertEquals(FILE, config.getFile());
assertEquals(FILE_COLLECTION, config.getFileCollection());
}
}
// Copyright © 2021 Amazon Web Services
//
// 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
//
// 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.
package org.opengroup.osdu.dataset.provider.azure.config;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.assertEquals;
import org.mockito.runners.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class OsduDatasetKindConfigTest {
private final String FILE = "file_name";
private final String FILE_COLLECTION = "file-collection";
@Test
public void should_successfully_create_config() {
OsduDatasetKindConfig config = new OsduDatasetKindConfig();
config.setFile(FILE);
config.setFileCollection(FILE_COLLECTION);
assertEquals(FILE, config.getFile());
assertEquals(FILE_COLLECTION, config.getFileCollection());
}
}
// Copyright © 2021 Amazon Web Services
//
// 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
//
// 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.
package org.opengroup.osdu.dataset.provider.azure.service;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.opengroup.osdu.dataset.dms.DmsServiceProperties;
import org.opengroup.osdu.dataset.provider.azure.config.OsduApiConfig;
import org.opengroup.osdu.dataset.provider.azure.config.OsduDatasetKindConfig;
import org.opengroup.osdu.dataset.provider.azure.service.DatasetDmsServiceMapImpl;
import java.util.Map;
@RunWith(MockitoJUnitRunner.class)
public class DatasetDmsServiceMapImplTest {
private final String FILE = "file_name";
private final String FILE_COLLECTION = "file-collection";
@Mock
private OsduDatasetKindConfig osduDatasetKindConfig;
@Mock
private OsduApiConfig osduApiConfig;
@InjectMocks
private DatasetDmsServiceMapImpl datasetDmsServiceMapImpl;
@Before
public void setup() {
initMocks(this);
when(osduApiConfig.getFile()).thenReturn(FILE);
when(osduApiConfig.getFileCollection()).thenReturn(FILE_COLLECTION);
when(osduDatasetKindConfig.getFileCollection()).thenReturn(FILE_COLLECTION);
}
@Test
public void should_successfully_call_init() {
datasetDmsServiceMapImpl.init();
verify(osduApiConfig, times(1)).getFile();
verify(osduDatasetKindConfig, times(1)).getFile();
verify(osduApiConfig, times(1)).getFileCollection();
verify(osduDatasetKindConfig, times(1)).getFileCollection();
}
@Test
public void should_call_getResourceTypeToDmsServiceMap() {
datasetDmsServiceMapImpl.init();
Map<String, DmsServiceProperties> resourceTypeToDmsServiceMap = datasetDmsServiceMapImpl.getResourceTypeToDmsServiceMap();
assertNotNull(resourceTypeToDmsServiceMap);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment