diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 3eb3fe1..c648cc2 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -525,7 +525,7 @@
 
     private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId,
             boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException {
-        StackInfo stackInfo = new StackInfo();
+        StackInfo stackInfo;
 
         // If client has requested a final response, poll for stack completion
         if (pollForCompletion) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 52b97da..5641186 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -310,7 +310,6 @@
             // First, look up to see if the Network already exists (by name).
             // For HEAT orchestration of networks, the stack name will always match the network name
             StackInfo heatStack = null;
-            long queryNetworkStarttime = System.currentTimeMillis();
             try {
                 heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
             } catch (MsoException me) {
@@ -564,7 +563,6 @@
             // Verify that the Network exists
             // For Neutron-based orchestration, the networkId is the Neutron Network UUID.
             NetworkInfo netInfo = null;
-            long queryNetworkStarttime = System.currentTimeMillis();
             try {
                 netInfo = neutron.queryNetwork(networkId, tenantId, cloudSiteId);
             } catch (MsoException me) {
@@ -608,7 +606,6 @@
             // First, look up to see that the Network already exists.
             // For Heat-based orchestration, the networkId is the network Stack ID.
             StackInfo heatStack = null;
-            long queryStackStarttime = System.currentTimeMillis();
             try {
                 heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName);
             } catch (MsoException me) {
@@ -728,7 +725,6 @@
 
             // Update the network stack
             // Ignore MsoStackNotFound exception because we already checked.
-            long updateStackStarttime = System.currentTimeMillis();
             try {
                 heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template,
                         stackParams, true, heatTemplate.getTimeoutMinutes());
@@ -892,9 +888,6 @@
 
         logger.debug("*** QUERY Network with Network: {} in {}/{}", networkNameOrId, cloudSiteId, tenantId);
 
-        // Will capture execution time for metrics
-        long startTime = System.currentTimeMillis();
-
         if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId)
                 || commonUtils.isNullOrEmpty(networkNameOrId)) {
 
@@ -919,7 +912,6 @@
         String neutronId = null;
         // Try Heat first, since networks may be named the same as the Heat stack
         StackInfo heatStack = null;
-        long queryStackStarttime = System.currentTimeMillis();
         try {
             heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkNameOrId);
         } catch (MsoException me) {
@@ -961,7 +953,6 @@
         // Query directly against the Neutron Network for the details
         // no RouteTargets available for ContrailV2 in neutron net-show
         // networkId is heatStackId
-        long queryNetworkStarttime = System.currentTimeMillis();
         try {
             NetworkInfo netInfo = neutron.queryNetwork(neutronId, tenantId, cloudSiteId);
             if (netInfo != null) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
index 6a38cc6..c782ade 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tenant/TenantAdapterRest.java
@@ -100,7 +100,7 @@
         logger.debug("createTenant enter: {}", req.toJsonString());
 
         String newTenantId = null;
-        TenantRollback tenantRollback = new TenantRollback();
+        TenantRollback tenantRollback;
 
         try {
             Holder<String> htenant = new Holder<>();
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index e9d8a5d..c421a67 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -26,7 +26,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.UUID;
-import org.assertj.core.util.Arrays;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
 import org.junit.Before;
@@ -65,9 +64,6 @@
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
 import org.onap.so.client.exception.BBObjectNotFoundException;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy;
 
 public class BuildingBlockTestDataSetup {
     private int collectionCounter;
@@ -80,7 +76,6 @@
     private int pnfCounter;
     private int projectCounter;
     private int serviceInstanceCounter;
-    private int serviceProxyCounter;
     private int serviceSubscriptionCounter;
     private int vfModuleCounter;
     private int volumeGroupCounter;
@@ -112,7 +107,6 @@
         pnfCounter = 0;
         projectCounter = 0;
         serviceInstanceCounter = 0;
-        serviceProxyCounter = 0;
         serviceSubscriptionCounter = 0;
         vfModuleCounter = 0;
         volumeGroupCounter = 0;
@@ -145,14 +139,6 @@
         return userInput;
     }
 
-    public Map<String, String> setUserInput() {
-        Map<String, String> userInput = buildUserInput();
-
-        gBBInput.setUserInput(userInput);
-
-        return userInput;
-    }
-
     public RequestContext buildRequestContext() {
         RequestContext requestContext = new RequestContext();
         requestContext.setMsoRequestId(UUID.randomUUID().toString());
@@ -216,14 +202,6 @@
         return orchestrationContext;
     }
 
-    public OrchestrationContext setOrchestrationContext() {
-        OrchestrationContext orchestrationContext = buildOrchestrationContext();
-
-        gBBInput.setOrchContext(orchestrationContext);
-
-        return orchestrationContext;
-    }
-
     public Collection buildCollection() {
         collectionCounter++;
 
@@ -350,7 +328,7 @@
         Collection collection = new Collection();
         collection.setId("testId");
 
-        ServiceInstance serviceInstance = null;
+        ServiceInstance serviceInstance;
 
         try {
             serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
@@ -363,30 +341,6 @@
         return collection;
     }
 
-    public InstanceGroup setInstanceGroup() {
-        InstanceGroup instanceGroup = new InstanceGroup();
-        instanceGroup.setId("testId");
-        instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
-
-        Collection collection = null;
-
-        try {
-            ServiceInstance serviceInstance =
-                    extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-            collection = serviceInstance.getCollection();
-
-            if (collection == null) {
-                collection = setCollection();
-            }
-        } catch (BBObjectNotFoundException e) {
-            collection = setCollection();
-        }
-
-        collection.setInstanceGroup(instanceGroup);
-
-        return instanceGroup;
-    }
-
     public VpnBinding buildVpnBinding() {
         vpnBindingCounter++;
 
@@ -398,21 +352,6 @@
         return vpnBinding;
     }
 
-    public VpnBinding setVpnBinding() {
-        VpnBinding vpnBinding = buildVpnBinding();
-
-        Customer customer = gBBInput.getCustomer();
-
-        if (customer == null) {
-            customer = buildCustomer();
-        }
-
-        customer.getVpnBindings().add(vpnBinding);
-        lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
-
-        return vpnBinding;
-    }
-
     public InstanceGroup buildInstanceGroup() {
         instanceGroupCounter++;
 
@@ -529,7 +468,7 @@
     public VfModule setVfModule() {
         VfModule vfModule = buildVfModule();
 
-        GenericVnf genericVnf = null;
+        GenericVnf genericVnf;
 
         try {
             genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -582,8 +521,6 @@
     }
 
     public ServiceProxy buildServiceProxy() {
-        serviceProxyCounter++;
-
         ServiceProxy serviceProxy = new ServiceProxy();
         serviceProxy.setServiceInstance(buildServiceInstance());
         serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf());
@@ -617,86 +554,4 @@
 
         return vpnBondingLink;
     }
-
-    public VpnBondingLink setVpnBondingLink() {
-        VpnBondingLink vpnBondingLink = buildVpnBondingLink();
-
-        ServiceInstance serviceInstance = null;
-
-        try {
-            serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-        } catch (BBObjectNotFoundException e) {
-            serviceInstance = setServiceInstance();
-        }
-
-        serviceInstance.getVpnBondingLinks().add(vpnBondingLink);
-        lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId());
-
-
-        return vpnBondingLink;
-    }
-
-    public Customer setAvpnCustomer() {
-        Customer customer = buildCustomer();
-
-        gBBInput.setCustomer(customer);
-
-        return customer;
-    }
-
-    public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) {
-        ServiceProxy serviceProxy = new ServiceProxy();
-        serviceProxy.setId("testProxyId" + uniqueIdentifier);
-        serviceProxy.setType(type);
-
-        ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy();
-        modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier);
-        modelInfo.setModelName("testProxyModelName" + uniqueIdentifier);
-        modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier);
-        modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier);
-        modelInfo.setModelInstanceName("testProxyInstanceName" + uniqueIdentifier);
-
-        serviceProxy.setModelInfoServiceProxy(modelInfo);
-
-        return serviceProxy;
-    }
-
-    public AllottedResource setAllottedResource(String uniqueIdentifier) {
-        AllottedResource ar = new AllottedResource();
-        ar.setId("testAllottedResourceId" + uniqueIdentifier);
-
-        ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource();
-        modelInfo.setModelInvariantUuid("testAllottedModelInvariantUuid" + uniqueIdentifier);
-        modelInfo.setModelName("testAllottedModelName" + uniqueIdentifier);
-        modelInfo.setModelUuid("testAllottedModelUuid" + uniqueIdentifier);
-        modelInfo.setModelVersion("testAllottedModelVersion" + uniqueIdentifier);
-        modelInfo.setModelInstanceName("testAllottedInstanceName" + uniqueIdentifier);
-
-        ar.setModelInfoAllottedResource(modelInfo);
-
-        return ar;
-    }
-
-    public Configuration setConfiguration() {
-        Configuration config = new Configuration();
-        config.setConfigurationId("testConfigurationId");
-        ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration();
-        modelInfoConfig.setModelCustomizationId("modelCustomizationId");
-        modelInfoConfig.setModelVersionId("modelVersionId");
-        modelInfoConfig.setModelInvariantId("modelInvariantId");
-        modelInfoConfig.setPolicyName("policyName");
-        config.setModelInfoConfiguration(modelInfoConfig);
-
-        List<Configuration> configurations = new ArrayList<>();
-        configurations.add(config);
-        ServiceInstance serviceInstance = new ServiceInstance();
-        try {
-            serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-        } catch (BBObjectNotFoundException e) {
-            serviceInstance = setServiceInstance();
-        }
-        lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
-        serviceInstance.setConfigurations(configurations);
-        return config;
-    }
 }
