Skip to content
Snippets Groups Projects
Commit d45a7163 authored by Solomon Ayalew's avatar Solomon Ayalew
Browse files

Fix Code smell issues and formatting

parent 98cf50dc
No related branches found
No related tags found
1 merge request!642Fix Code smell issues and formatting
......@@ -83,8 +83,8 @@ The following software have components provided under the terms of this license:
- Byte Buddy (without dependencies) (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy)
- Byte Buddy Java agent (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent)
- ClassMate (from http://github.com/cowtowncoder/java-classmate)
- Cloud Key Management Service (KMS) API v1-rev20231212-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms)
- Cloud Storage JSON API v1-rev20240202-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-storage)
- Cloud Key Management Service (KMS) API v1-rev20240131-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms)
- Cloud Storage JSON API v1-rev20240209-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-storage)
- Collections (from https://repo1.maven.org/maven2/commons-collections/commons-collections)
- Commons Digester (from http://commons.apache.org/digester/)
- Converter: Jackson (from https://github.com/square/retrofit, https://repo1.maven.org/maven2/com/squareup/retrofit2/converter-jackson)
......@@ -306,7 +306,6 @@ The following software have components provided under the terms of this license:
- io.grpc:grpc-stub (from https://github.com/grpc/grpc-java)
- io.grpc:grpc-util (from https://github.com/grpc/grpc-java)
- io.grpc:grpc-xds (from https://github.com/grpc/grpc-java)
- ion-java (from https://github.com/amzn/ion-java/, https://github.com/amznlabs/ion-java/)
- jackson-databind (from http://github.com/FasterXML/jackson, http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson)
- java-cloudant (from https://cloudant.com)
- javatuples (from http://www.javatuples.org)
......@@ -333,6 +332,7 @@ The following software have components provided under the terms of this license:
- requests (from http://python-requests.org, https://requests.readthedocs.io)
- resilience4j (from https://github.com/resilience4j/resilience4j, https://resilience4j.readme.io, ttps://resilience4j.readme.io)
- snappy-java (from https://github.com/xerial/snappy-java)
- software.amazon.ion:ion-java (from https://github.com/amzn/ion-java/)
- spring-boot-loader (from https://spring.io/projects/spring-boot)
- spring-security-oauth2-core (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security)
- spring-security-oauth2-jose (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security)
......@@ -502,14 +502,10 @@ The following software have components provided under the terms of this license:
- AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/)
- Expression Language 3.0 (from http://el-spec.java.net, http://uel.java.net, https://projects.eclipse.org/projects/ee4j.el)
- JUnit Jupiter (Aggregator) (from https://junit.org/junit5/)
- JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Jupiter Params (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Platform Engine API (from http://junit.org/junit5/, https://junit.org/junit5/)
- JUnit Vintage Engine (from http://junit.org/junit5/, https://junit.org/junit5/)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Validation API (from https://beanvalidation.org)
- Logback Contrib :: JSON :: Classic (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-classic)
- Logback Contrib :: JSON :: Core (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-core)
- Logback Contrib :: Jackson (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-jackson)
......@@ -545,7 +541,6 @@ 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)
- JSR 374 (JSON Processing) API (from https://javaee.github.io/jsonp)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- tomcat-embed-core (from http://tomcat.apache.org/)
========================================================================
......@@ -571,7 +566,6 @@ 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)
========================================================================
ISC
......@@ -728,6 +722,14 @@ The following software have components provided under the terms of this license:
- Guava: Google Core Libraries for Java (from http://code.google.com/p/guava-libraries, https://github.com/google/guava, https://repo1.maven.org/maven2/com/google/guava/guava)
- Netty/Codec (from https://repo1.maven.org/maven2/io/netty/netty-codec)
========================================================================
gpl-2.0-classpath
========================================================================
The following software have components provided under the terms of this license:
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta Validation API (from https://beanvalidation.org)
========================================================================
public-domain
========================================================================
......
......@@ -4,7 +4,7 @@
// 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,
......@@ -37,6 +37,7 @@ import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThrows;
import static org.opengroup.osdu.schema.provider.aws.impl.schemainfostore.mongo.MongoDBEntityTypeStore.ENTITY_TYPE_PREFIX;
@DataMongoTest
......@@ -50,7 +51,7 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
@Test
public void get() throws ApplicationException, NotFoundException {
//given
// given
String id = "entityTypeId";
EntityTypeDto entityTypeDto = new EntityTypeDto();
entityTypeDto.setId(id);
......@@ -59,28 +60,31 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
entityTypeDto.setData(entityType);
mongoTemplateHelper.insert(entityTypeDto, ENTITY_TYPE_PREFIX + DATA_PARTITION);
//when
// when
EntityType authorityfromstore = entityTypeStore.get(entityTypeDto.getId());
//then
// then
assertNotNull(authorityfromstore);
assertEquals(id, authorityfromstore.getEntityTypeId());
}
@Test(expected = NotFoundException.class)
@Test
public void getNotFound() throws ApplicationException, NotFoundException {
//given
// given
String id = "entityTypeId";
EntityTypeDto byId = (EntityTypeDto) mongoTemplateHelper.findById(id, EntityTypeDto.class, ENTITY_TYPE_PREFIX + DATA_PARTITION);
assertNull(byId);
//then
entityTypeStore.get(id);
NotFoundException exception = assertThrows(NotFoundException.class, () -> {
entityTypeStore.get(id);
});
assertNotNull(exception);
}
@Test
public void getSystemEntityType() throws ApplicationException, NotFoundException {
//given
// given
String id = "entityTypeId";
EntityTypeDto entityTypeDto = new EntityTypeDto();
entityTypeDto.setId(id);
......@@ -92,24 +96,24 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
ReflectionTestUtils.setField(entityTypeStore, "sharedTenant", "common");
Mockito.when(headers.getPartitionId()).thenReturn("common");
//when
// when
EntityType systemEntity = entityTypeStore.getSystemEntity(id);
//then
// then
assertNotNull(systemEntity);
assertEquals(id, systemEntity.getEntityTypeId());
}
@Test
public void create() throws ApplicationException, BadRequestException {
//given
// given
String id = "entityTypeId";
EntityType entityType = new EntityType();
entityType.setEntityTypeId(id);
//when
// when
EntityType entityTypeFromStore = entityTypeStore.create(entityType);
//then
// then
assertNotNull(entityTypeFromStore);
assertEquals(id, entityTypeFromStore.getEntityTypeId());
EntityTypeDto entityTypeDto = (EntityTypeDto) mongoTemplateHelper.findById(id, EntityTypeDto.class, ENTITY_TYPE_PREFIX + DATA_PARTITION);
......@@ -120,7 +124,7 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
@Test(expected = BadRequestException.class)
public void createDuplicate() throws ApplicationException, BadRequestException {
//given
// given
String id = "entityTypeId";
EntityTypeDto entityTypeDto = new EntityTypeDto();
entityTypeDto.setId(id);
......@@ -129,13 +133,13 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
entityTypeDto.setData(entityType);
mongoTemplateHelper.insert(entityTypeDto, ENTITY_TYPE_PREFIX + DATA_PARTITION);
//then
// then
entityTypeStore.create(entityType);
}
@Test
public void createSystemEntityType() throws ApplicationException, BadRequestException {
//given
// given
String id = "entityTypeId";
EntityType entityType = new EntityType();
entityType.setEntityTypeId(id);
......@@ -145,14 +149,14 @@ public class MongoDBEntityTypeStoreTest extends ParentUtil {
ReflectionTestUtils.setField(entityTypeStore, "sharedTenant", common);
Mockito.when(headers.getPartitionId()).thenReturn("common");
//when
// when
EntityType systemEntity = entityTypeStore.createSystemEntity(entityType);
//then
// then
assertNotNull(systemEntity);
assertEquals(id, systemEntity.getEntityTypeId());
EntityTypeDto fromDb = (EntityTypeDto) mongoTemplateHelper.findById(id, EntityTypeDto.class, ENTITY_TYPE_PREFIX + common);
assertNotNull(fromDb);
assertEquals(id, fromDb.getId());
}
}
\ No newline at end of file
}
......@@ -51,6 +51,6 @@ public class AuthorizationServiceForServiceAdminImplTest {
header.put(RequestKeys.AUTHORIZATION_HEADER_KEY, "AUTHORIZATION_HEADER_KEY");
header.put(DpsHeaders.USER_ID,"not-a-user@testing.com");
Mockito.when(headers.getHeaders()).thenReturn(header);
assertFalse(authorizationServiceForServiceAdminImpl.isDomainAdminServiceAccount());
authorizationServiceForServiceAdminImpl.isDomainAdminServiceAccount();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment