From 327b17ab250b4c17cf3f91f5e4cd9bffd89f3d1e Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Wed, 7 Mar 2018 18:17:22 -0800 Subject: Reduce log noise/warnings format to conventions Reduce build log warnings by formatting tests to ONAP code conventions (removing tabs etc.) Issue-ID: SO-368 Change-Id: I48c6d359b83617aebeb79db4e30c1d72d31f7eec Signed-off-by: Marcus G K Williams --- .../org/openecomp/mso/cloud/CloudConfigTest.java | 3 ++ .../org/openecomp/mso/cloud/CloudIdentityTest.java | 42 +++++++++--------- .../authentication/AuthenticationMethodTest.java | 51 +++++++++++----------- .../mso/cloud/servertype/NewServerTypeUtils.java | 14 +++--- .../mso/cloud/servertype/ServerTypeTest.java | 22 +++++----- 5 files changed, 68 insertions(+), 64 deletions(-) (limited to 'adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud') diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java index 1c2501e8e4..b213bbd90b 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudConfigTest.java @@ -27,10 +27,13 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.Optional; + import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; + import java.util.Map; + import org.openecomp.mso.openstack.exceptions.MsoCloudIdentityNotFound; public class CloudConfigTest { diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java index eef45b7164..0033be80fd 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/CloudIdentityTest.java @@ -29,36 +29,36 @@ import org.junit.Test; public class CloudIdentityTest { @Test - public final void testCloudIdentity () { - CloudIdentity id = new CloudIdentity (); - id.setAdminTenant ("AdminTenant"); - id.setId ("id"); + public final void testCloudIdentity() { + CloudIdentity id = new CloudIdentity(); + id.setAdminTenant("AdminTenant"); + id.setId("id"); // id.setKeystoneUrl ("keystone"); - id.setIdentityUrl ("keystone"); - id.setMemberRole ("member"); - id.setMsoId ("msoId"); - id.setMsoPass (CloudIdentity.encryptPassword ("password")); - id.setTenantMetadata (true); + id.setIdentityUrl("keystone"); + id.setMemberRole("member"); + id.setMsoId("msoId"); + id.setMsoPass(CloudIdentity.encryptPassword("password")); + id.setTenantMetadata(true); id.setIdentityServerType(null); id.setIdentityAuthenticationType(null); - - assertTrue (id.getAdminTenant ().equals ("AdminTenant")); - assertTrue (id.getId ().equals ("id")); + + assertTrue(id.getAdminTenant().equals("AdminTenant")); + assertTrue(id.getId().equals("id")); // assertTrue (id.getKeystoneUrl ().equals ("keystone")); - assertTrue (id.getMemberRole ().equals ("member")); - assertTrue (id.getMsoId ().equals ("msoId")); - assertTrue (id.getMsoPass ().equals ("password")); - assertTrue (id.hasTenantMetadata ()); + assertTrue(id.getMemberRole().equals("member")); + assertTrue(id.getMsoId().equals("msoId")); + assertTrue(id.getMsoPass().equals("password")); + assertTrue(id.hasTenantMetadata()); // assertTrue (id.toString ().contains ("keystone")); assertTrue(id.toString().contains("null")); } @Test - public final void testEncryption () { - String encrypted = CloudIdentity.encryptPassword ("password"); - assertTrue (encrypted != null); - assertTrue (!encrypted.equals ("password")); + public final void testEncryption() { + String encrypted = CloudIdentity.encryptPassword("password"); + assertTrue(encrypted != null); + assertTrue(!encrypted.equals("password")); } - + } diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java index b6c1c7373f..08a8c3b9cd 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/authentication/AuthenticationMethodTest.java @@ -35,34 +35,33 @@ import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication; * A few JUnit tests to evaluate the new factory that manages authentication * types and their associated wrapper classes. Here it is assumed that core types * only are tested. - * */ public class AuthenticationMethodTest { - /** - * - */ - public AuthenticationMethodTest() { - // TODO Auto-generated constructor stub - } + /** + * + */ + public AuthenticationMethodTest() { + // TODO Auto-generated constructor stub + } + + @Test + public void testCustomRackspaceAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("test"); + Authentication auth = ci.getAuthentication(); + assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); + } - @Test - public void testCustomRackspaceAuthFromCloudIdentity() { - CloudIdentity ci = new CloudIdentity(); - ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); - ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); - ci.setMsoId("test"); - Authentication auth = ci.getAuthentication(); - assertTrue(RackspaceAuthentication.class.equals(auth.getClass())); - } - - @Test - public void testCoreUsernamePasswordAuthFromCloudIdentity() { - CloudIdentity ci = new CloudIdentity(); - ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD); - ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); - ci.setMsoId("someuser"); - Authentication auth = ci.getAuthentication(); - assertTrue(UsernamePassword.class.equals(auth.getClass())); - } + @Test + public void testCoreUsernamePasswordAuthFromCloudIdentity() { + CloudIdentity ci = new CloudIdentity(); + ci.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.USERNAME_PASSWORD); + ci.setMsoPass("FD205490A48D48475607C36B9AD902BF"); + ci.setMsoId("someuser"); + Authentication auth = ci.getAuthentication(); + assertTrue(UsernamePassword.class.equals(auth.getClass())); + } } diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java index aaa732c9a3..94a224d5e3 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/NewServerTypeUtils.java @@ -31,14 +31,14 @@ import org.openecomp.mso.openstack.utils.MsoTenantUtils; public class NewServerTypeUtils extends MsoTenantUtils { - /** - * @param msoPropID - */ - public NewServerTypeUtils(String msoPropID) { - super(msoPropID); - } + /** + * @param msoPropID + */ + public NewServerTypeUtils(String msoPropID) { + super(msoPropID); + } - @Override + @Override public String createTenant(String tenantName, String cloudSiteId, Map metadata, boolean backout) throws MsoException { // TODO Auto-generated method stub diff --git a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java index 4aaf379512..df853426ad 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/openecomp/mso/cloud/servertype/ServerTypeTest.java @@ -39,20 +39,20 @@ public class ServerTypeTest { IdentityServerTypeAbstract keystoneServerType = IdentityServerType.valueOf("KEYSTONE"); assertNotNull(keystoneServerType); } - + @Test public void testNewServerType() { IdentityServerTypeAbstract customServerType = null; try { customServerType = new IdentityServerType("NewServerType", NewServerTypeUtils.class); - + } catch (IllegalArgumentException e) { fail("An exception should not be raised when we register a new server type for the first time"); } finally { System.out.println(IdentityServerType.values().toString()); assertEquals(customServerType, IdentityServerType.valueOf("NewServerType")); } - + // Create it a second time IdentityServerTypeAbstract customServerType2 = null; try { @@ -60,23 +60,25 @@ public class ServerTypeTest { fail("An exception should be raised as server type does not exist"); } catch (IllegalArgumentException e) { // Fail silently -- it simply indicates we already registered it - customServerType2 = IdentityServerType.valueOf("NewServerType"); + customServerType2 = IdentityServerType.valueOf("NewServerType"); } finally { System.out.println(IdentityServerType.values().toString()); assertEquals(customServerType2, IdentityServerType.valueOf("NewServerType")); } - + // Check the KeystoneURL for this custom TenantUtils CloudIdentity cloudIdentity = new CloudIdentity(); cloudIdentity.setIdentityUrl("LocalIdentity"); cloudIdentity.setIdentityAuthenticationType(CloudIdentity.IdentityAuthenticationType.RACKSPACE_APIKEY); - cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType.valueOf("NewServerType")); + cloudIdentity.setIdentityServerType((CloudIdentity.IdentityServerType) CloudIdentity.IdentityServerType. + valueOf("NewServerType")); String regionId = "RegionA"; String msoPropID = "12345"; try { - assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl()); - } catch (MsoException e) { - fail("No MSO Exception should have occured here"); - } + assertEquals(cloudIdentity.getKeystoneUrl(regionId, msoPropID), msoPropID + ":" + regionId + + ":NewServerTypeKeystoneURL/" + cloudIdentity.getIdentityUrl()); + } catch (MsoException e) { + fail("No MSO Exception should have occured here"); + } } } -- cgit 1.2.3-korg