aboutsummaryrefslogtreecommitdiffstats
path: root/resource-assignment
diff options
context:
space:
mode:
Diffstat (limited to 'resource-assignment')
-rw-r--r--resource-assignment/features/src/main/resources/features.xml2
-rwxr-xr-xresource-assignment/provider/pom.xml6
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java12
-rw-r--r--resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java28
4 files changed, 26 insertions, 22 deletions
diff --git a/resource-assignment/features/src/main/resources/features.xml b/resource-assignment/features/src/main/resources/features.xml
index f4191293..ca1126d3 100644
--- a/resource-assignment/features/src/main/resources/features.xml
+++ b/resource-assignment/features/src/main/resources/features.xml
@@ -34,7 +34,7 @@
<feature version="[3.1,4)">spring-jdbc</feature>
<feature>spring-dm</feature>
<bundle start-level="88">mvn:org.onap.ccsdk.sli.adaptors/resource-assignment-provider/${project.version}</bundle>
- <bundle>mvn:mysql/mysql-connector-java/${mysql.connector.version}</bundle>
+ <bundle>mvn:org.mariadb.jdbc/mariadb-java-client/${mariadb.connector.version}</bundle>
<bundle>mvn:commons-lang/commons-lang/2.6</bundle>
</feature>
diff --git a/resource-assignment/provider/pom.xml b/resource-assignment/provider/pom.xml
index 89134284..741f9fbe 100755
--- a/resource-assignment/provider/pom.xml
+++ b/resource-assignment/provider/pom.xml
@@ -61,9 +61,9 @@
<version>${slf4j.version}</version>
</dependency>
<dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>${mariadb.connector.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java
index d1913b33..8e7c63ce 100644
--- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java
+++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/ra/ResourceAllocator.java
@@ -149,7 +149,7 @@ public class ResourceAllocator implements SvcLogicResource {
prefix = prefix == null ? "" : prefix + '.';
- if (!resource.equals("NetworkCapacity")) {
+ if (!"NetworkCapacity".equals(resource)) {
log.info("resource: " + resource);
log.info("key: " + key);
@@ -374,7 +374,7 @@ public class ResourceAllocator implements SvcLogicResource {
log.info("Checking VPE port: " + portId);
String provStatus = String.valueOf(vpe.get("provisioning-status"));
- if (!provStatus.equals("PROV")) {
+ if (!"PROV".equals(provStatus)) {
log.info("Skipping port " + portId + ": Provisioning status is not PROV.");
continue;
}
@@ -476,7 +476,7 @@ public class ResourceAllocator implements SvcLogicResource {
log.info("Checking VPLSPE port: " + portId);
String provStatus = String.valueOf(vplspe.get("provisioning-status"));
- if (!provStatus.equals("PROV")) {
+ if (!"PROV".equals(provStatus)) {
log.info("Skipping port " + portId + ": Provisioning status is not PROV.");
continue;
}
@@ -572,7 +572,7 @@ public class ResourceAllocator implements SvcLogicResource {
for (AllocationOutcome ao1 : mrao.allocationOutcomeList) {
if (ao1 instanceof LimitAllocationOutcome) {
LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1;
- if (lao.request.resourceName.equals("Bandwidth")) {
+ if ("Bandwidth".equals(lao.request.resourceName)) {
ThresholdStatus th = allocationRequestBuilder.getThresholdStatus(sd, ed, lao);
setThresholdData(ctx, th, sd, ed);
}
@@ -588,12 +588,12 @@ public class ResourceAllocator implements SvcLogicResource {
for (AllocationOutcome ao1 : mrao.allocationOutcomeList) {
if (ao1 instanceof LimitAllocationOutcome) {
LimitAllocationOutcome lao = (LimitAllocationOutcome) ao1;
- if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Bandwidth")) {
+ if (lao.status == AllocationStatus.Failure && "Bandwidth".equals(lao.request.resourceName)) {
long available = lao.limit - lao.used;
if (available > maxAvailableSpeedServer)
maxAvailableSpeedServer = available;
}
- if (lao.status == AllocationStatus.Failure && lao.request.resourceName.equals("Connection")) {
+ if (lao.status == AllocationStatus.Failure && "Connection".equals(lao.request.resourceName)) {
maxAvailableSpeedServer = 0;
break;
}
diff --git a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
index 9ee3cc18..58f10365 100644
--- a/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
+++ b/resource-assignment/provider/src/main/java/org/onap/ccsdk/sli/adaptors/rm/dao/jdbc/ResourceDaoImpl.java
@@ -298,10 +298,12 @@ public class ResourceDaoImpl implements ResourceDao {
r = rr;
}
- r.resourceType = type;
- r.resourceKey = new ResourceKey();
- r.resourceKey.assetId = resourceEntity.assetId;
- r.resourceKey.resourceName = resourceEntity.name;
+ if (r != null) {
+ r.resourceType = type;
+ r.resourceKey = new ResourceKey();
+ r.resourceKey.assetId = resourceEntity.assetId;
+ r.resourceKey.resourceName = resourceEntity.name;
+ }
return r;
}
@@ -329,14 +331,16 @@ public class ResourceDaoImpl implements ResourceDao {
ai = rai;
}
- ai.resourceType = r.resourceType;
- ai.resourceKey = r.resourceKey;
- ai.resourceSetId = aiEntity.resourceSetId;
- ai.resourceUnionId = aiEntity.resourceUnionId;
- if (aiEntity.resourceShareGroupList != null)
- ai.resourceShareGroupList = new HashSet<String>(StrUtil.listStr(aiEntity.resourceShareGroupList));
- ai.applicationId = aiEntity.applicationId;
- ai.allocationTime = aiEntity.allocationTime;
+ if (ai!=null) {
+ ai.resourceType = r.resourceType;
+ ai.resourceKey = r.resourceKey;
+ ai.resourceSetId = aiEntity.resourceSetId;
+ ai.resourceUnionId = aiEntity.resourceUnionId;
+ if (aiEntity.resourceShareGroupList != null)
+ ai.resourceShareGroupList = new HashSet<String>(StrUtil.listStr(aiEntity.resourceShareGroupList));
+ ai.applicationId = aiEntity.applicationId;
+ ai.allocationTime = aiEntity.allocationTime;
+ }
return ai;
}