diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai')
3 files changed, 87 insertions, 90 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java index 680beb5d5b..bee0a828ea 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIPServerTest.java @@ -30,39 +30,36 @@ import org.junit.BeforeClass; import org.junit.Ignore;
import org.junit.Test;
import org.onap.aai.domain.yang.Pserver;
-
import static org.junit.Assert.assertEquals;
-
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
-
public class AAIPServerTest {
- @BeforeClass
- public static void setUp() {
- System.setProperty("mso.config.path", "src/test/resources");
- System.setProperty("javax.net.ssl.keyStore", "C:/etc/ecomp/mso/config/msoClientKeyStore.jks");
- System.setProperty("javax.net.ssl.keyStorePassword", "mso4you");
- System.setProperty("javax.net.ssl.trustStore", "C:/etc/ecomp/mso/config/msoTrustStore.jks");
- System.setProperty("javax.net.ssl.trustStorePassword", "mso_Domain2.0_4you");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- File file = new File("src/test/resources/__files/AAI/pserver.json");
- List<Pserver> list = client.getListOfPservers(file);
-
- assertEquals("", list.get(0).getHostname(), "test");
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
- assertEquals("", list.size(), 0);
- }
+ @BeforeClass
+ public static void setUp() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ System.setProperty("javax.net.ssl.keyStore", "C:/etc/ecomp/mso/config/msoClientKeyStore.jks");
+ System.setProperty("javax.net.ssl.keyStorePassword", "mso4you");
+ System.setProperty("javax.net.ssl.trustStore", "C:/etc/ecomp/mso/config/msoTrustStore.jks");
+ System.setProperty("javax.net.ssl.trustStorePassword", "mso_Domain2.0_4you");
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void pserverTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ File file = new File("src/test/resources/__files/AAI/pserver.json");
+ List<Pserver> list = client.getListOfPservers(file);
+
+ assertEquals("", list.get(0).getHostname(), "test");
+ }
+
+ @Test
+ @Ignore // IGNORED FOR 1710 MERGE TO ONAP
+ public void pserverActualTest() throws JsonParseException, JsonMappingException, IOException, NoSuchAlgorithmException {
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7", UUID.randomUUID().toString());
+ assertEquals("", list.size(), 0);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java index cfa61c2799..2272f31685 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/AAIValidatorTest.java @@ -39,61 +39,61 @@ import org.onap.aai.domain.yang.Pserver; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.class) public class AAIValidatorTest { + + @Mock + protected AAIRestClient client; + String vnfName = "testVnf"; + String uuid = "UUID"; + AAIValidatorImpl validator; + + @Before + public void init(){ + validator = new AAIValidatorImpl(); + validator.setClient(client); + } + + public List<Pserver> getPservers(boolean locked){ + Pserver pserver = new Pserver(); + pserver.setInMaint(locked); + List<Pserver> pservers = new ArrayList<Pserver>(); + pservers.add(pserver); + return pservers; + } + + public GenericVnf createGenericVnfs(boolean locked){ + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setInMaint(locked); + + return genericVnf; + } - @Mock - protected AAIRestClient client; - String vnfName = "testVnf"; - String uuid = "UUID"; - AAIValidatorImpl validator; + @Test + public void test_IsPhysicalServerLocked_True() throws IOException{ + when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(true)); + boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); + assertEquals(true, locked); + } + + @Test + public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException { + when(client.getPhysicalServerByVnfId(vnfName,uuid)).thenReturn(getPservers(false)); + boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); + assertEquals(false, locked); + } + + @Test + public void test_IsVNFLocked_False() throws Exception{ + when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(false)); + boolean locked = validator.isVNFLocked(vnfName, uuid); + assertEquals(false, locked); + } - @Before - public void init() { - validator = new AAIValidatorImpl(); - validator.setClient(client); - } - - public List<Pserver> getPservers(boolean locked) { - Pserver pserver = new Pserver(); - pserver.setInMaint(locked); - List<Pserver> pservers = new ArrayList<Pserver>(); - pservers.add(pserver); - return pservers; - } - - public GenericVnf createGenericVnfs(boolean locked) { - GenericVnf genericVnf = new GenericVnf(); - genericVnf.setInMaint(locked); - - return genericVnf; - } - - @Test - public void test_IsPhysicalServerLocked_True() throws IOException { - when(client.getPhysicalServerByVnfId(vnfName, uuid)).thenReturn(getPservers(true)); - boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); - assertEquals(true, locked); - } - - @Test - public void test_IsPhysicalServerLocked_False() throws JsonParseException, JsonMappingException, UnsupportedEncodingException, IOException { - when(client.getPhysicalServerByVnfId(vnfName, uuid)).thenReturn(getPservers(false)); - boolean locked = validator.isPhysicalServerLocked(vnfName, uuid); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_False() throws Exception { - when(client.getVnfByName(vnfName, uuid)).thenReturn(createGenericVnfs(false)); - boolean locked = validator.isVNFLocked(vnfName, uuid); - assertEquals(false, locked); - } - - @Test - public void test_IsVNFLocked_True() throws Exception { - when(client.getVnfByName(vnfName, uuid)).thenReturn(createGenericVnfs(true)); - boolean locked = validator.isVNFLocked(vnfName, uuid); - assertEquals(true, locked); - } + @Test + public void test_IsVNFLocked_True() throws Exception{ + when(client.getVnfByName(vnfName,uuid)).thenReturn(createGenericVnfs(true)); + boolean locked = validator.isVNFLocked(vnfName, uuid); + assertEquals(true,locked ); + } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java index c20e54c9a5..09c2ab5c30 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/aai/EntitiesTest.java @@ -30,12 +30,12 @@ import com.openpojo.validation.test.impl.SetterTester; public class EntitiesTest { - private String packageName = "org.openecomp.mso.client.aai.entities"; + private String packageName = "org.openecomp.mso.client.aai.entities"; - @Test - public void validate() { - Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule()) - .with(new SetterTester(), new GetterTester()).build(); - validator.validate(packageName); - } + @Test + public void validate() { + Validator validator = ValidatorBuilder.create().with(new SetterMustExistRule(), new GetterMustExistRule()) + .with(new SetterTester(), new GetterTester()).build(); + validator.validate(packageName); + } } |