summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java12
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Service.java15
-rw-r--r--common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java45
3 files changed, 70 insertions, 2 deletions
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
index acac8c4033..9cb5b33251 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java
@@ -42,6 +42,8 @@ public class Resources implements Serializable {
private List<Pnfs> pnfs = new ArrayList<>();
@JsonProperty("networks")
private List<Networks> networks = new ArrayList<>();
+ @JsonProperty("services")
+ private List<Service> services = new ArrayList<>();
public List<Vnfs> getVnfs() {
return vnfs;
@@ -67,8 +69,16 @@ public class Resources implements Serializable {
this.networks = networks;
}
+ public List<Service> getServices() {
+ return services;
+ }
+
+ public void setServices(List<Service> services) {
+ this.services = services;
+ }
+
@Override
public String toString() {
- return "Resources [vnfs=" + vnfs + ", networks=" + networks + "]";
+ return "Resources [vnfs=" + vnfs + ", networks=" + networks + ", services=" + services + "]";
}
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
index 3c3e10c483..90df220b52 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Service.java
@@ -45,6 +45,9 @@ public class Service implements Serializable {
private List<Map<String, Object>> instanceParams = new ArrayList<>();
@JsonProperty("resources")
protected Resources resources;
+ @JsonProperty("processingPriority")
+ protected Integer processingPriority = 0;
+
public ModelInfo getModelInfo() {
return modelInfo;
@@ -86,9 +89,19 @@ public class Service implements Serializable {
this.resources = resources;
}
+ public Integer getProcessingPriority() {
+ return processingPriority;
+ }
+
+ public void setProcessingPriority(Integer processingPriority) {
+ this.processingPriority = processingPriority;
+ }
+
+
@Override
public String toString() {
return "Service [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
- + instanceName + ", instanceParams=" + instanceParams + ", resources=" + resources + "]";
+ + instanceName + ", instanceParams=" + instanceParams + ", resources=" + resources
+ + ", processingPriority=" + processingPriority + "]";
}
}
diff --git a/common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java b/common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java
new file mode 100644
index 0000000000..51de61a66a
--- /dev/null
+++ b/common/src/test/java/org/onap/so/security/UserDetailsServiceImplTest.java
@@ -0,0 +1,45 @@
+package org.onap.so.security;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import java.util.ArrayList;
+import org.junit.Test;
+import java.util.List;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UsernameNotFoundException;
+
+public class UserDetailsServiceImplTest {
+
+ private static final String USERNAME = "usernameTest";
+ private static final String PASSWORD = "passTest";
+ private static final String ROLE = "roleTest";
+
+ @Test
+ public void loadUserByUsername_Success() {
+ UserDetailsServiceImpl testedObject = new UserDetailsServiceImpl();
+ testedObject.setUsercredentials(prepareUserCredentials());
+ UserDetails result = testedObject.loadUserByUsername(USERNAME);
+ assertThat(result.getUsername()).isEqualTo(USERNAME);
+ assertThat(result.getPassword()).isEqualTo(PASSWORD);
+ }
+
+ @Test
+ public void loadUserByUsername_userNotFoundEx() {
+ UserDetailsServiceImpl testedObject = new UserDetailsServiceImpl();
+ testedObject.setUsercredentials(prepareUserCredentials());
+ assertThatThrownBy(() -> testedObject.loadUserByUsername("notExistingUser"))
+ .isInstanceOf(UsernameNotFoundException.class);
+ }
+
+ private List<UserCredentials> prepareUserCredentials() {
+ UserCredentials userCredentials = new UserCredentials();
+ userCredentials.setUsername(USERNAME);
+ userCredentials.setPassword(PASSWORD);
+ userCredentials.setRole(ROLE);
+ List<UserCredentials> list = new ArrayList<>();
+ list.add(userCredentials);
+ return list;
+ }
+
+
+}