Commit 10532ea0 authored by harshit aggarwal's avatar harshit aggarwal
Browse files

Clean up

parent aedd58cf
Pipeline #6102 failed with stage
in 7 seconds
package org.opengroup.osdu.wks.provider.azure.credentials;
import org.opengroup.osdu.azure.logging.Slf4JLogger;
import org.opengroup.osdu.azure.util.AzureServicePrincipal;
import org.opengroup.osdu.core.common.model.tenant.TenantInfo;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
......@@ -25,9 +24,6 @@ public class JwtTokenGenerator implements UserCredential {
@Autowired
private AzureServicePrincipal azureServicePrincipal;
@Autowired
private Slf4JLogger logger;
@Override
public String getIdToken(TenantInfo tenant) throws ApplicationException {
// Azure service principal will have access to all data partitions
......
......@@ -10,6 +10,8 @@ import lombok.Getter;
import org.opengroup.osdu.azure.util.AzureServicePrincipal;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.wks.provider.azure.utils.MDCContextMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......@@ -20,6 +22,8 @@ import javax.inject.Named;
@Getter
public class AzureBootstrapConfig {
private final static Logger LOGGER = LoggerFactory.getLogger(AzureBootstrapConfig.class);
@Value("${azure.storage.account-name}")
private String storageAccount;
......@@ -113,6 +117,7 @@ public class AzureBootstrapConfig {
try {
subscriptionClient = new SubscriptionClient(connectionStringBuilder, ReceiveMode.PEEKLOCK);
} catch (InterruptedException | ServiceBusException e) {
LOGGER.error("Unexpected error creating Subscription Client", e);
throw new AppException(500, "Server Error", "Unexpected error creating Subscription Client", e);
}
......@@ -127,11 +132,13 @@ public class AzureBootstrapConfig {
String getKeyVaultSecret(SecretClient kv, String secretName) {
KeyVaultSecret secret = kv.getSecret(secretName);
if (secret == null) {
LOGGER.error("No secret found with name {}", secretName);
throw new IllegalStateException(String.format("No secret found with name %s", secretName));
}
String secretValue = secret.getValue();
if (secretValue == null) {
LOGGER.error("Secret unexpectedly missing from KeyVault response for secret with name {}", secretName);
throw new IllegalStateException(String.format(
"Secret unexpectedly missing from KeyVault response for secret with name %s", secretName));
}
......
......@@ -18,8 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import java.util.Collections;
import static java.nio.charset.StandardCharsets.UTF_8;
@Component
......@@ -46,11 +44,11 @@ public class ProcessWKSTransform {
RawRecordDetails[] rawRecordDetails = retrieveDataFromMessage(message);
wKSService.transform(rawRecordDetails, dataPartitionId, correlationId);
} catch (BadRequestException e) {
LOGGER.error(String.format("Bad Request Reason: %s, pubsub message id: %s", e.getErrorMsg(),
message.getMessageId()));
LOGGER.error("Bad Request Reason: {}, pubsub message id: {}", e.getErrorMsg(),
message.getMessageId());
} catch (ApplicationException e) {
LOGGER.error(String.format("Application Error Reason: %s, pubsub message id: %s", e.getErrorMsg(),
message.getMessageId()));
LOGGER.error("Application Error Reason: {}, pubsub message id: {}", e.getErrorMsg(),
message.getMessageId());
}
MDC.clear();
......
......@@ -47,7 +47,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
executorService);
} catch (InterruptedException | ServiceBusException e) {
LOGGER.error(String.format("Error registering message handler %s", e.getMessage()));
LOGGER.error("Error registering message handler {}", e.getMessage());
}
}
......
......@@ -32,7 +32,7 @@ public class MappingStoreImpl implements MappingStore {
ObjectMapper mapper = new ObjectMapper();
mappings = mapper.readValue(content, MappingsModel.class);
} catch (Exception e) {
LOGGER.error(String.format("Error while processing mappings from blob store %s", e.getMessage()));
LOGGER.error("Error while processing mappings from blob store {}", e.getMessage());
}
return mappings;
}
......
......@@ -14,8 +14,6 @@
# limitations under the License.
#
service.domain.name=${service_domain_name}
azure-client-id=${AZURE_CLIENT_ID}
azure-client-secret=${AZURE_CLIENT_SECRET}
azure-tenant-id=${AZURE_TENANT_ID}
......
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