Commit 74484b34 authored by Aman Verma's avatar Aman Verma
Browse files

fixing indentation

parent 04829f9d
Pipeline #4081 passed with stage
in 3 minutes and 8 seconds
......@@ -17,7 +17,6 @@ package org.opengroup.osdu.schema.azure.definitions;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.opengroup.osdu.schema.azure.definitions.FlattenedSchemaInfo;
@Data
@AllArgsConstructor
......
......@@ -22,7 +22,6 @@ import com.azure.security.keyvault.secrets.models.KeyVaultSecret;
import javax.inject.Named;
@Component
public class AzureBootstrapConfig {
......
......@@ -73,15 +73,14 @@ public class TenantFactoryImpl implements ITenantFactory {
this.tenants = new HashMap<>();
cosmosStore.findAllItems( headers.getPartitionId(), cosmosDBName, tenantInfoContainer, TenantInfoDoc.class)
.forEach(doc -> {
TenantInfo ti = new TenantInfo();
String tenantName = doc.getId();
ti.setName(tenantName);
String complianceRuleSet = doc.getComplianceRuleSet();
ti.setComplianceRuleSet(complianceRuleSet);
this.tenants.put(tenantName, ti) ;
});
.forEach(doc -> {
TenantInfo ti = new TenantInfo();
String tenantName = doc.getId();
ti.setName(tenantName);
String complianceRuleSet = doc.getComplianceRuleSet();
ti.setComplianceRuleSet(complianceRuleSet);
this.tenants.put(tenantName, ti) ;
});
}
}
......@@ -62,7 +62,7 @@ public class AzureAuthorityStore implements IAuthorityStore {
@Override
public Authority get(String authorityId) throws NotFoundException, ApplicationException {
String id = headers.getPartitionId().toString() + ":" + authorityId;
String id = headers.getPartitionId() + ":" + authorityId;
AuthorityDoc authorityDoc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, authorityContainer, id, headers.getPartitionId(), AuthorityDoc.class)
.orElseThrow(() -> new NotFoundException("bad input parameter"));
......@@ -80,7 +80,7 @@ public class AzureAuthorityStore implements IAuthorityStore {
@Override
public Authority create(Authority authority) throws ApplicationException, BadRequestException {
String id = headers.getPartitionId().toString() + ":" + authority.getAuthorityId();
String id = headers.getPartitionId() + ":" + authority.getAuthorityId();
Boolean exists = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, authorityContainer, id, headers.getPartitionId(), AuthorityDoc.class).isPresent();
if (exists) {
......
......@@ -64,7 +64,7 @@ public class AzureEntityTypeStore implements IEntityTypeStore {
@Override
public EntityType get(String entityTypeId) throws NotFoundException, ApplicationException {
String id = headers.getPartitionId().toString() + ":" + entityTypeId;
String id = headers.getPartitionId() + ":" + entityTypeId;
EntityTypeDoc entityTypeDoc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, entityTypeContainer, id, headers.getPartitionId(), EntityTypeDoc.class)
.orElseThrow(() -> new NotFoundException("bad input parameter"));
......@@ -82,7 +82,7 @@ public class AzureEntityTypeStore implements IEntityTypeStore {
@Override
public EntityType create(EntityType entityType) throws BadRequestException, ApplicationException {
String id = headers.getPartitionId().toString() + ":" + entityType.getEntityTypeId();
String id = headers.getPartitionId() + ":" + entityType.getEntityTypeId();
// Check whether EntityType already exists and throw required exception.
Boolean exists = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, entityTypeContainer, id, headers.getPartitionId(), EntityTypeDoc.class).isPresent();
......
......@@ -85,7 +85,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
@Override
public SchemaInfo getSchemaInfo(String schemaId) throws ApplicationException, NotFoundException {
String id = headers.getPartitionId().toString() + ":" + schemaId;
String id = headers.getPartitionId() + ":" + schemaId;
SchemaInfoDoc schemaInfoDoc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, schemaInfoContainer, id, headers.getPartitionId(), SchemaInfoDoc.class)
.orElseThrow(() -> new NotFoundException(SchemaConstants.SCHEMA_NOT_PRESENT));
......@@ -103,7 +103,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
*/
@Override
public SchemaInfo createSchemaInfo(SchemaRequest schema) throws ApplicationException, BadRequestException {
String id = headers.getPartitionId().toString() + ":" + schema.getSchemaInfo().getSchemaIdentity().getId();
String id = headers.getPartitionId() + ":" + schema.getSchemaInfo().getSchemaIdentity().getId();
// Check whether SchemaInfo already exists and throw required exception.
Boolean exists = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, schemaInfoContainer, id, headers.getPartitionId(), SchemaInfoDoc.class).isPresent();
......@@ -135,7 +135,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
*/
@Override
public SchemaInfo updateSchemaInfo(SchemaRequest schema) throws ApplicationException, BadRequestException {
String id = headers.getPartitionId().toString() + ":" + schema.getSchemaInfo().getSchemaIdentity().getId();
String id = headers.getPartitionId() + ":" + schema.getSchemaInfo().getSchemaIdentity().getId();
FlattenedSchemaInfo flattenedSchemaInfo = populateSchemaInfo(schema.getSchemaInfo());
SchemaInfoDoc schemaInfoDoc = new SchemaInfoDoc(id, headers.getPartitionId(), flattenedSchemaInfo);
try {
......@@ -158,7 +158,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
*/
@Override
public boolean cleanSchema(String schemaId) throws ApplicationException {
String id = headers.getPartitionId().toString() + ":" + schemaId;
String id = headers.getPartitionId() + ":" + schemaId;
// Check whether SchemaInfo already exists
Boolean exists = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, schemaInfoContainer, id, headers.getPartitionId(), SchemaInfoDoc.class).isPresent();
......@@ -219,7 +219,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
// check for super-seeding schemas
String supersededById = "";
if (schemaInfo.getSupersededBy() != null) {
String id = headers.getPartitionId().toString() + ":" + schemaInfo.getSupersededBy().getId();
String id = headers.getPartitionId() + ":" + schemaInfo.getSupersededBy().getId();
if (schemaInfo.getSupersededBy().getId() == null
|| !cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, schemaInfoContainer, id, headers.getPartitionId(), FlattenedSchemaInfo.class).isPresent()) {
......@@ -228,6 +228,7 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
}
supersededById = schemaInfo.getSupersededBy().getId();
}
return FlattenedSchemaInfo.builder().id(schemaInfo.getSchemaIdentity().getId())
.supersededBy(supersededById)
.dateCreated(new Date())
......@@ -241,14 +242,12 @@ public class AzureSchemaInfoStore implements ISchemaInfoStore {
.scope(schemaInfo.getScope().name())
.status(schemaInfo.getStatus().name())
.build();
//return new FlattenedSchemaInfo();
}
private SchemaInfo getSchemaInfoObject(FlattenedSchemaInfo flattenedSchemaInfo) {
SchemaIdentity superSededBy = null;
if (!flattenedSchemaInfo.getSupersededBy().isEmpty()) {
String id = headers.getPartitionId().toString() + ":" + flattenedSchemaInfo.getSupersededBy();
String id = headers.getPartitionId() + ":" + flattenedSchemaInfo.getSupersededBy();
SchemaInfoDoc doc = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, schemaInfoContainer, id, headers.getPartitionId(), SchemaInfoDoc.class).get();
superSededBy = getSchemaIdentity(doc.getFlattenedSchemaInfo());
}
......
......@@ -79,16 +79,16 @@ public class AzureSourceStore implements ISourceStore {
@Override
public Source create(Source source) throws BadRequestException, ApplicationException {
String id = headers.getPartitionId().toString() + ":" + source.getSourceId();
String id = headers.getPartitionId() + ":" + source.getSourceId();
// Check whether Source already exists and throw required exception.
Boolean exists = cosmosStore.findItem(headers.getPartitionId(), cosmosDBName, sourceContainer, id, headers.getPartitionId(), SourceDoc.class).isPresent();
if (exists) {
log.warning(SchemaConstants.SOURCE_EXISTS);
throw new BadRequestException(MessageFormat.format(SchemaConstants.SOURCE_EXISTS_EXCEPTION,
source.getSourceId()));
}
try {
SourceDoc sourceDoc = new SourceDoc(id, headers.getPartitionId(), source);
cosmosStore.upsertItem(headers.getPartitionId(), cosmosDBName, sourceContainer, sourceDoc);
......
......@@ -15,7 +15,6 @@
package org.opengroup.osdu.schema.azure.impl.schemastore;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.specialized.BlockBlobClient;
import org.opengroup.osdu.core.common.logging.JaxRsDpsLog;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.schema.azure.utils.OSDUAzureBlobStorageImpl;
......@@ -26,10 +25,6 @@ import org.opengroup.osdu.schema.provider.interfaces.schemastore.ISchemaStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
/**
* Repository class to to register resolved Schema in Azure storage.
*
......
......@@ -72,7 +72,6 @@ public class AzureEntityTypeStoreTest {
Optional<EntityTypeDoc> cosmosItem = Optional.of(entityTypeDoc);
doReturn(cosmosItem).when(cosmosStore).findItem(anyString(), any(), any(), anyString(), anyString(), any());
assertNotNull(store.get(EntityTypeId));
assertEquals(EntityTypeId, store.get(EntityTypeId).getEntityTypeId());
}
......
......@@ -92,9 +92,8 @@ public class AzureSchemaInfoStoreTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Before
public void init() throws CosmosClientException {
public void init() {
initMocks(this);
doReturn(dataPartitionId).when(headers).getPartitionId();
}
......@@ -129,7 +128,6 @@ public class AzureSchemaInfoStoreTest {
@Test
public void testGetSchemaInfo_Empty() throws NotFoundException, ApplicationException {
expectedException.expect(NotFoundException.class);
expectedException.expectMessage(SchemaConstants.SCHEMA_NOT_PRESENT);
......
......@@ -49,7 +49,6 @@ public class AzureSchemaStoreTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
private static final String BUCKET = "test-schema";
private static final String dataPartitionId = "dataPartitionId";
private static final String FILE_PATH = "/test-folder/test-file";
private static final String CONTENT = "Hello World";
......
Markdown is supported
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