[VID-6] Initial rebase push

Change-Id: I9077be9663754d9b22f77c6a7b3109b361b39346
Signed-off-by: jimmydot <jf2512@att.com>
diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java
new file mode 100755
index 0000000..ed06994
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java
@@ -0,0 +1,606 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.ecomp.vid.selenium;

+

+import org.testng.annotations.AfterClass;

+import org.testng.annotations.AfterMethod;

+import org.testng.annotations.AfterSuite;

+import org.testng.annotations.BeforeClass;

+import org.testng.annotations.BeforeMethod;

+import org.testng.annotations.BeforeSuite;

+import org.testng.annotations.BeforeTest;

+import org.testng.annotations.Test;

+

+

+import org.openqa.selenium.By;

+import org.openqa.selenium.WebDriver;

+import org.openqa.selenium.WebElement;

+import org.openqa.selenium.firefox.FirefoxDriver;

+import org.openqa.selenium.ie.InternetExplorerDriver;

+import org.openqa.selenium.support.ui.Select;

+

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.util.List;

+import java.util.Properties;

+import java.util.concurrent.TimeUnit;

+import org.apache.log4j.Logger;

+import org.testng.Assert;

+import org.testng.asserts.*;

+

+/**

+ * The Class FirstClass.

+ */

+public class FirstClass {

+	

+		/** The login button. */

+		WebElement loginButton;

+		

+		/** The eg. */

+		String eg;

+		

+		/** The login. */

+		WebElement login;

+		

+		/** The pwd. */

+		WebElement pwd;

+		

+		/** The log. */

+		Logger log;

+		

+		/** The errormessage. */

+		WebElement errormessage;

+		

+					

+		/** The driver. */

+		WebDriver driver=new FirefoxDriver();

+		

+		

+		

+		/** The config prop. */

+		private final Properties configProp = new Properties();

+		

+		

+		/**

+		 * Instantiates a new first class.

+		 */

+		private  FirstClass() {

+			// TODO Auto-generated constructor stub

+			//

+			try{

+			//	InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties");

+			//FileInputStream input1 = new FileInputStream("objectmap.properties");

+				

+			InputStream input =new FileInputStream("objectconfig.properties");

+			System.out.println("Read all properties from file");

+			configProp.load(input);

+			System.out.println("Read all properties from file completed");

+			}

+			catch(IOException e) {

+				

+				e.printStackTrace();

+			}

+		}

+		

+		

+		/*

+		

+		

+		@BeforeClass

+		public void setUp() {

+			System.out.println("*******************");

+			System.out.println("launching IE browser");

+			System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe");

+			driver = new InternetExplorerDriver();

+			driver.findElement(By.className());

+			driver.manage().window().maximize();

+			

+

+			 login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']"));

+			 pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']"));

+			 loginButton = driver.findElement(By.id("loginBtn"));

+		}

+		

+		

+	*/

+		/**

+		 * Sets the up.

+		 */

+		// TODO Auto-generated method stub

+		@BeforeClass

+		public void setUp()

+		{

+			

+						

+			//WebDriver driver=new FirefoxDriver();

+			

+			log = Logger.getLogger(FirstClass.class.getName());

+		

+		

+		

+		// Get url

+		driver.get(configProp.getProperty("baseURL"));

+		driver.manage().window().maximize();

+		

+		

+		 login = driver.findElement(By.xpath(configProp.getProperty("login")));

+		 

+		 pwd = driver.findElement(By.xpath(configProp.getProperty("pwd")));

+		 loginButton = driver.findElement(By.id(configProp.getProperty("loginButton")));

+		}

+		

+		

+		/**

+		 * Empty username password.

+		 */

+		@Test(priority=1)

+		public void emptyUsernamePassword()

+		{

+		

+			

+		//User Name and Password field is empty

+		log.info("-----VID-11 TC-8----Username and password empty");

+		loginButton.click();

+		errormessage=driver.findElement(By.xpath("//*[@id='errorInfo']/span"));

+		String errmsg= errormessage.getText();

+		//System.out.println("Error message is"+errmsg);

+		//String expected = "Invaild username or password, Please try again";

+		

+		//Assert.assertEquals(errmsg,expected);

+

+		Boolean str = driver.getPageSource().contains("Invalid username or password, Please try again");

+		System.out.println(driver.getPageSource().contains("Invalid username or password, Please try again"));

+		

+		if(str==true)

+		{

+			log.info("Error message validated");

+			log.info("VID-11 TC-8 PASSED");

+			

+		}else

+			log.error("Failed validation");

+		

+		}

+

+

+		

+		/**

+		 * Invalid user name.

+		 */

+		@Test(priority=2)

+		public void invalidUserName()

+		{

+		

+		log.info("-----VID-11 TC-6----Invalid Username and Valid Password");

+		

+		

+		login.sendKeys("xxx");

+		pwd.sendKeys("abc123");

+		loginButton.click();

+		try {

+			Thread.sleep(5000);

+		} catch (InterruptedException e) {

+			// TODO Auto-generated catch block

+			e.printStackTrace();

+		}

+		

+		String errmsg= errormessage.getText();

+		String expected = "Invalid username or password, Please try again";

+		Assert.assertEquals(errmsg,expected);

+		//Boolean str1 = driver.getPageSource().contains("Invalid username or password, Please try again");

+		//System.out.print(str1);

+		

+		log.info("VID-11 TC-6 PASSED");

+				

+		}

+		

+		

+		/**

+		 * Invalid password.

+		 */

+		@Test(priority=3)

+		public void invalidPassword()

+		{

+		log.info("-----VID-11 TC-7----Valid Username and Invalid Password");

+		//  Valid user name and Invalid password.

+				login.clear();

+				pwd.clear();

+				login.sendKeys("testuser");

+				pwd.sendKeys("xxx");

+				loginButton.click();

+				driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+		

+				

+				String errmsg= errormessage.getText();

+				String expected = "Invalid username or password, Please try again";

+				Assert.assertEquals(errmsg,expected);

+				

+				//Boolean str2 = driver.getPageSource().contains("Invaild username or password, Please try again");

+				//System.out.print(str2);

+				

+				log.info("VID-11 TC-7 PASSED");

+		}

+		

+			

+		/**

+		 * Login successful.

+		 */

+		@Test(priority=4)

+		public void loginSuccessful()

+		{

+		log.info("-----VID-11 TC-1----Valid Username and Valid Password");

+		//Login with valid user name and password.

+		login.clear();

+		login.sendKeys("su");

+		pwd.clear();

+		pwd.sendKeys("fusion");

+		

+				

+		loginButton.click();

+		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+		

+		try {

+			Thread.sleep(6000);

+		} catch (InterruptedException e) {

+			// TODO Auto-generated catch block

+			e.printStackTrace();

+		}

+		Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));

+		log.info("VID-11 TC-1 PASSED");

+		

+		}

+		

+		

+		/**

+		 * Verify home page elements left pane.

+		 */

+		@Test(priority=5)

+		public void verifyHomePageElementsLeftPane()

+		

+		{

+			

+			

+			log.info("VID-10 TC 1 ");

+			//VID Home

+			log.info("VID 11 TC-2");

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[1]/a/span")).isDisplayed();

+			//Create New Service Instance

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[2]/a/span")).isDisplayed();

+			

+			//Browse Service Type

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[3]/a/span")).isDisplayed();

+			//View Log		

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[4]/a/span")).isDisplayed();

+			

+			//Profile

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span")).isDisplayed();

+			//Admin

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).isDisplayed();

+			//Logout

+			driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a/span")).isDisplayed();

+			

+			//Infrastructure Subscriber Name

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[1]/div/label")).isDisplayed();

+			//Infrastructure Subscriber Name Select Drop down

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")).isDisplayed();

+			//Infrastructure Service Type

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[1]/div/label")).isDisplayed();

+			//Infrastructure Service Type Select Drop down

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")).isDisplayed();

+			//Submit button 

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).isDisplayed();

+			

+			//Login Snippet Icon

+			driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).isDisplayed();

+			

+			

+			//String bodyText = driver.findElement(By.tagName("body")).getText();

+			//Assert.assertTrue("Text not found!", bodyText.contains("Search Existing Service Instances"));

+			//Assert.IsTrue(driver.getPageSource.Contains("Search Existing Service Instances"));

+			 

+			log.info("VID-12 TC-1");

+			Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));

+			Assert.assertTrue(driver.getPageSource().contains("Please search by the Subscriber name or Service Type from below:"));

+			log.info("VID-12 TC-1 PASSED");

+			log.info("VID-10 TC 1 PASSED");

+			log.info("VID-11 TC-2 PASSED");

+		}

+		

+		

+		/**

+		 * Disabled submit button.

+		 */

+		@Test(priority=6)

+		public void disabledSubmitButton()

+		{

+			log.info("VID-12 TC-13");

+			//Assert submit button disabled.

+			Assert.assertFalse(driver.findElement(By.xpath(configProp.getProperty("submitButton"))).isEnabled());

+			log.info("VID-12 TC-13 PASSED");

+

+		} 

+		

+		/**

+		 * Default list box value.

+		 */

+		@Test(priority=7)

+		public void defaultListBoxValue()

+		{

+			log.info("VID-12 TC-2");

+			

+			

+			//WebElement subscribername =driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"));

+			

+			Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))));

+			Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))));

+			

+			

+			WebElement ielement=iSelect.getFirstSelectedOption();

+			WebElement oelement=oSelect.getFirstSelectedOption();

+			String defaultsubscribername=oelement.getText();

+			String defaultservicetype=ielement.getText();

+			

+			Assert.assertEquals(defaultsubscribername,"Select Subscriber Name");

+			Assert.assertEquals(defaultservicetype,"Select Service Type");

+			

+		

+			

+			

+		//Verify Select Subscriber Name isDisplayed.

+		//driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select/option[1]")).isSelected();

+				

+		//Verify Select Service Type isDisplayed.	

+		//driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select/option[1]")).isSelected();

+			

+			

+			log.info("VID-12 TC-2 PASSED");

+

+		}

+

+

+		

+		/**

+		 * Select subscriber name drop down.

+		 *

+		 * @throws InterruptedException the interrupted exception

+		 */

+		@Test(priority=8)

+		public void selectSubscriberNameDropDown() throws InterruptedException

+		{

+			log.info("------------------VID-10 TC-2,VID-12 TC-11, VID-12 TC-9, VID 12 TC-10,VID-12 TC-6, VID 12 TC-5--------------------");

+			

+			

+			driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")));

+			

+			driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")));

+			Thread.sleep(5000);

+			

+			//Infrastructure Subscriber Name

+			Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))));

+			

+			List <WebElement> elementCount = oSelect.getOptions();

+			log.info("Select Element Count of Service Name");

+			System.out.println(elementCount.size());

+			

+			

+			//Verifying getInfrastructureSubscribersList

+			log.info("VID-29 TC-1");

+			Assert.assertTrue(elementCount.size()>0);

+			log.info("VID-29 TC-1 PASSED");

+			

+			oSelect.selectByIndex(2);

+			String selectedOption = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))).getFirstSelectedOption().getText();

+

+			System.out.println("Service Name selected is " +selectedOption);

+			log.info("VID-10 TC-2 PASSED");

+					

+			//Submit button is clicked

+			driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click();

+			

+			

+			//Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();

+			//Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:"))

+			

+			

+			//Verify whether the page header is displayed "Global Customer ID"

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed();

+			Assert.assertTrue(driver.getPageSource().contains("Global Customer ID"));

+			Assert.assertTrue(driver.getPageSource().contains("Subscriber Name"));

+			Assert.assertTrue(driver.getPageSource().contains("Service Type"));

+			Assert.assertTrue(driver.getPageSource().contains("Service Instance ID"));

+			

+			log.info("VID-12 TC-5 PASSED");

+			log.info("VID-12 TC-11 PASSED");

+			

+			WebElement serviceinstancetable =driver.findElement(By.xpath("//table[@class='tablesorter tablesorter-default ng-isolate-scope']"));

+			

+			List<WebElement> rows_table = serviceinstancetable.findElements(By.tagName("tr"));

+			  //To calculate no of rows In table.

+			  int rows_count = rows_table.size();

+			  

+			  //Loop will execute till the last row of table.

+			  for (int row=0; row<rows_count; row++){

+			   //To locate columns(cells) of that specific row.

+			   List<WebElement> Columns_row = rows_table.get(row).findElements(By.tagName("td"));

+			   //To calculate no of columns(cells) In that specific row.

+			   int columns_count = Columns_row.size();

+			   //System.out.println("Number of cells In Row "+row+" are "+columns_count);

+			   

+			   //Loop will execute till the last cell of that specific row.

+			   for (int column=0; column<columns_count; column++){

+			    //To retrieve text from that specific cell.

+			    String celtext = Columns_row.get(column).getText();

+			    //System.out.println("Cell Value Of row number "+row+" and column number "+column+" Is "+celtext);

+			   

+			    

+			    

+			    //log.info("Testing Get column and row value");

+			    List <WebElement> exx= rows_table.get(1).findElements(By.tagName("td"));

+			     eg=Columns_row.get(2).getText();

+			   // System.out.println("Cell value of row 1 and column 2 is" +eg);

+			   }

+			  }

+		

+			  

+			

+			

+			//Verify View/Edit isDisplayed and Click

+			

+			driver.findElement(By.xpath("//a[@alt='View/Edit']")).isDisplayed();

+			

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/tbody/tr[1]/td[1]/div/a")).click();

+			

+			log.info("User clicked View/Edit");

+			

+			//Verify the Subscriber Name displayed.	

+			String header= driver.findElement(By.xpath("//h1[@class='heading1 ng-binding']")).getText();

+			//System.out.println(header);

+			

+			

+			if(header.contains(eg))

+			{

+				System.out.println("Header contains the subscriber name");

+			}else

+				System.out.println("Header does not contain the subscriber name");

+			

+			

+			

+			Assert.assertTrue(driver.getPageSource().contains("PerfTest Subscriber00020021"));

+			log.info("VID-12 TC-6 PASSED");

+			

+			

+				

+			driver.navigate().back();

+			//Cancel button isDisplayed

+			driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).isDisplayed();

+			log.info("VID-12 TC-9 PASSED");

+			

+			//Cancel button is clicked

+			driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).click();

+			log.info("Cancel button is clicked");

+			

+			//Verifying VID Home page is displayed

+			Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));

+			log.info("VID-12 TC-10 PASSED");

+			

+			   }

+		

+		

+		/**

+		 * Refresh subscriber name.

+		 */

+		@Test(priority=9)

+		public void refreshSubscriberName()

+		{

+			log.info("VID-10 TC-4");

+			

+			

+			driver.findElement(By.xpath(configProp.getProperty("refreshButtonSubscriberName"))).isDisplayed();

+			

+			log.info("VID-10 TC-4 PASSED");

+			

+			

+		}

+

+		

+		/**

+		 * Select subscriber type drop down.

+		 *

+		 * @throws InterruptedException the interrupted exception

+		 */

+		@Test(priority=9)

+		public void selectSubscriberTypeDropDown() throws InterruptedException

+		{

+			Thread.sleep(5000);

+			log.info("------------------VID-10 TC-3, VID-12 TC-12,--------------------");

+			//Infrastructure Subscriber Type

+			Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))));

+			

+			List <WebElement> ielementCount = iSelect.getOptions();

+			log.info("Select Element Count of Service type");

+			System.out.println(ielementCount.size());

+			iSelect.selectByIndex(1);

+			

+			log.info("VID-10 TC-3 PASSED");

+			

+						

+			//Submit button is clicked

+			driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click();

+			

+			//Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();

+			//Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:"))

+			log.info("Page Header: Selected Subscriber's Service Instance Details");

+			

+			

+			//Verify whether the page header is displayed "Global Customer ID"

+			driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed();

+			

+			//Assert.assertTrue(driver.getPageSource().contains("Global Customer ID"));

+			log.info("Table is displayed");

+			

+			log.info("VID-12 TC-12 PASSED");

+			

+		}

+		

+		

+		

+		/**

+		 * Logout under profile.

+		 */

+		@Test(priority=10)

+		public void logoutUnderProfile()

+		{

+			

+			log.info("-----------VID-11 TC-5---------------------");

+			//driver.findElement(By.partialLinkText("Click here to login")).click();

+			//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+			

+		

+			driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).click();			

+			driver.findElement(By.xpath(".//*[@id='reg-logout-div']/a")).click();

+			//Validate that the user has logged out of VID. Displays "Portal"

+			Assert.assertTrue(driver.getPageSource().contains("Portal"));

+			

+			log.info("VID-11 TC-5 PASSED");

+			

+		}

+

+		

+		

+		/**

+		 * Tear down.

+		 */

+		@AfterClass

+		public void tearDown()

+		{

+			driver.close();

+		

+		}

+		

+		

+		

+	}

+

+

+	

+

diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java
new file mode 100755
index 0000000..66ea075
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java
@@ -0,0 +1,242 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.ecomp.vid.selenium;

+

+import java.io.FileInputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.util.List;

+import java.util.Properties;

+import java.util.concurrent.TimeUnit;

+

+import org.apache.log4j.Logger;

+import org.openqa.selenium.By;

+import org.openqa.selenium.WebDriver;

+import org.openqa.selenium.WebElement;

+import org.openqa.selenium.firefox.FirefoxDriver;

+import org.openqa.selenium.support.ui.Select;

+import org.testng.Assert;

+import org.testng.annotations.BeforeTest;

+import org.testng.annotations.Test;

+

+/**

+ * The Class LogOutLeftPane.

+ */

+@Test(enabled=true)

+public class LogOutLeftPane {

+

+	/** The login button. */

+	WebElement loginButton;

+	

+	/** The login. */

+	WebElement login;

+	

+	/** The pwd. */

+	WebElement pwd;

+	

+	/** The log. */

+	Logger log;

+	

+	/** The errormessage. */

+	WebElement errormessage;

+	

+	/** The driver. */

+	WebDriver driver=new FirefoxDriver();

+	

+	

+	/** The config prop. */

+	private final Properties configProp = new Properties();

+	

+	

+	/**

+	 * Instantiates a new log out left pane.

+	 */

+	private  LogOutLeftPane() {

+		// TODO Auto-generated constructor stub

+		//

+		try{

+		//	InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties");

+		//FileInputStream input1 = new FileInputStream("objectmap.properties");

+			

+		InputStream input =new FileInputStream("objectconfig.properties");

+		System.out.println("Read all properties from file");

+		configProp.load(input);

+		System.out.println("Read all properties from file completed");

+		}

+		catch(IOException e) {

+			

+			e.printStackTrace();

+		}

+	}

+	

+	

+	   

+	   

+	/**

+	 * Do before test.

+	 */

+	// TODO Auto-generated method stub

+	@BeforeTest

+	public void doBeforeTest()

+	{

+		//WebDriver driver=new FirefoxDriver();

+		

+		log = Logger.getLogger(LogOutLeftPane.class.getName());

+	

+	

+	

+	// Get url

+	driver.get("http://vid.onap.org:9080/vid/login_external.htm");

+	driver.manage().window().maximize();

+	

+	

+	 login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']"));

+	 pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']"));

+	 loginButton = driver.findElement(By.id("loginBtn"));

+	}

+	

+	

+	/**

+	 * Expand collapse panel.

+	 *

+	 * @throws InterruptedException the interrupted exception

+	 */

+	@Test(priority=1)

+	public void expandCollapsePanel() throws InterruptedException

+	{

+

+		

+		

+		login.clear();

+		login.sendKeys("su");

+		pwd.clear();

+		pwd.sendKeys("fusion");

+		//driver.findElement(By.partialLinkText("Click here to login")).click();

+		//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+		

+		loginButton.click();

+		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+		

+		

+		log.info("Clicking Profile link from left pane");

+		Thread.sleep(3000);

+		System.out.println("properties file details --->"+configProp.getProperty("profilelink"));

+		driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click();

+		Thread.sleep(3000);

+		

+		//Verify whether the sub panel is displayed

+		//To verify the following :Search import from webphone and Self 

+		driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed();

+		log.info("Expand and collapse passed for Profile link");

+		

+		//For Admin

+		//Verify expand and collapse working for ADMIN

+		log.info("Clicking Admin link from left pane");

+		driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click();

+		//To verify the following: Roles, Roles Functions, Usages

+		driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed();

+		

+	

+		log.info("Expand and collapse passed for ADMIN link");

+

+		log.info("VID-11 TC-3 PASSED");

+		

+	}

+	

+	

+	/**

+	 * Drop down list.

+	 *

+	 * @throws InterruptedException the interrupted exception

+	 */

+	@Test(priority=2)

+	public void dropDownList() throws InterruptedException

+	{

+		//VID-12 TC-3

+		log.info("VID-12 TC-3");

+		//driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"));

+		

+		//driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"));

+		Thread.sleep(5000);

+		

+		//Infrastructure Subscriber Name

+		Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")));

+		Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")));

+		

+		List <WebElement> elementCount = oSelect.getOptions();

+		log.info("Subscriber Name Drop Down");

+		System.out.println(elementCount.size());

+		oSelect.selectByIndex(1);

+		log.info("Subscriber name selected");

+		//String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText();

+		

+		

+		List <WebElement> count = iSelect.getOptions();

+		log.info("Subscriber type drop down");

+		System.out.println(count.size());

+		oSelect.selectByIndex(1);

+		log.info("Subscriber type selected");

+		

+

+				

+		//Submit button is clicked

+		driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click();

+		

+		

+		//Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"

+		driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();

+		log.info("VID-12 TC-3 PASSED");

+	}

+	

+	

+	

+	

+	/**

+	 * Logout left pane.

+	 */

+	@Test(priority=3)

+	public void logoutLeftPane()

+	{

+		//To Verify if the logout link redirects to Login page when clicked.

+		

+		

+		/*log.info("----------------VID-11 TC-4----------------");

+		login.clear();

+		login.sendKeys("testuser");

+		pwd.clear();

+		pwd.sendKeys("abc123");

+		//driver.findElement(By.partialLinkText("Click here to login")).click();

+		//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

+		

+		loginButton.click();

+		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/

+		log.info("----------------VID-11 TC-4----------------");

+		driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click();

+		//Validate that the user has logged out of VID. Displays "Portal"

+		Assert.assertTrue(driver.getPageSource().contains("Portal"));

+		

+		log.info("VID 11 TC-4 PASSED");

+		

+		driver.close();

+		

+	}

+	

+}

diff --git a/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java b/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java
new file mode 100755
index 0000000..64d72ab
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java
@@ -0,0 +1,176 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.fusion.core;

+

+import java.io.IOException;

+

+import org.junit.Before;

+import org.junit.runner.RunWith;

+import org.springframework.beans.factory.annotation.Autowired;

+import org.springframework.context.annotation.Bean;

+import org.springframework.context.annotation.ComponentScan;

+import org.springframework.context.annotation.Configuration;

+import org.springframework.context.annotation.Profile;

+import org.springframework.test.context.ActiveProfiles;

+import org.springframework.test.context.ContextConfiguration;

+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;

+import org.springframework.test.context.web.WebAppConfiguration;

+import org.springframework.test.web.servlet.MockMvc;

+import org.springframework.test.web.servlet.setup.MockMvcBuilders;

+import org.springframework.web.context.WebApplicationContext;

+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

+

+import org.openecomp.portalsdk.core.conf.AppConfig;

+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;

+import org.openecomp.portalsdk.core.util.SystemProperties;

+import org.openecomp.portalsdk.core.util.CacheManager;

+

+/**

+ * 

+ * 

+ * 

+ * In order to write a unit test, 

+ * 1. inherit this class - See SanityTest.java

+ * 2. place the "war" folder on your test class's classpath

+ * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path

+ *    but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath  

+ *    -Dcontainer.classpath="classpath:"

+ *

+ */

+

+@RunWith(SpringJUnit4ClassRunner.class)

+@WebAppConfiguration

+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})

+@ActiveProfiles(value="test")

+public class MockApplicationContextTestSuite {

+		

+	    /** The wac. */

+    	@Autowired

+	    public WebApplicationContext wac;

+

+	    /** The mock mvc. */

+    	private MockMvc mockMvc;

+

+	    /**

+    	 * Setup.

+    	 */

+    	@Before

+	    public void setup() {

+	    	if(mockMvc == null) {

+	    		this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();

+	    		

+	    	}

+	    }

+	    

+	    /**

+    	 * Gets the bean.

+    	 *

+    	 * @param name the name

+    	 * @return the bean

+    	 */

+    	public Object getBean(String name) {

+			return this.wac.getBean(name);

+		}

+

+

+		/**

+		 * Gets the mock mvc.

+		 *

+		 * @return the mock mvc

+		 */

+		public MockMvc getMockMvc() {

+			return mockMvc;

+		}

+

+		/**

+		 * Sets the mock mvc.

+		 *

+		 * @param mockMvc the new mock mvc

+		 */

+		public void setMockMvc(MockMvc mockMvc) {

+			this.mockMvc = mockMvc;

+		}

+		

+		/**

+		 * Gets the web application context.

+		 *

+		 * @return the web application context

+		 */

+		public WebApplicationContext getWebApplicationContext() {

+			return wac;

+		}

+		

+		

+		

+		

+}

+		

+

+		@Configuration

+		@ComponentScan(basePackages = "org.openecomp", 

+				 excludeFilters = {

+								 	// the following source configurations should not be scanned; instead of using Exclusion filter, we can use the @Profile annotation to exclude them

+									// see AppConfig class

+									//@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.*AppConfig*")//,

+								 	//@ComponentScan.Filter(type = FilterType.REGEX, pattern = org.openecomp.*.*AppConfig*")

+								  }

+		    	)

+		@Profile("test")

+		class MockAppConfig extends AppConfig {

+			

+			@Bean 

+		    public SystemProperties systemProperties(){

+		    	return new MockSystemProperties();

+		    }

+			

+			@Bean

+		    public AbstractCacheManager cacheManager() {

+		        return new CacheManager() {

+		        	

+		        	public void configure() throws IOException {

+		        		 

+		        	}

+		        };

+		    }

+			

+			protected String[] tileDefinitions() {

+				return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};

+			}

+			

+			 @Override

+			public void addInterceptors(InterceptorRegistry registry) {

+			    //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());

+			    //registry.addInterceptor(resourceInterceptor());

+			}

+			 

+			 public static class MockSystemProperties extends SystemProperties {

+					

+					public MockSystemProperties() {

+					}

+					

+				}

+					

+		}

+		

+		

+

+

diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java
new file mode 100755
index 0000000..8c00c3b
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java
@@ -0,0 +1,48 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.fusionapp.controller;

+

+import org.junit.Assert;

+import org.junit.Test;

+import org.springframework.test.web.servlet.ResultActions;

+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;

+

+import org.openecomp.fusion.core.MockApplicationContextTestSuite;

+

+/**

+ * The Class NetMapTest.

+ */

+public class NetMapTest extends MockApplicationContextTestSuite {

+	

+	/**

+	 * Test get net map.

+	 *

+	 * @throws Exception the exception

+	 */

+	@Test

+	public void testGetNetMap() throws Exception {

+		ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/net_map"));

+		//Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass());

+		Assert.assertEquals("net_map_int",ra.andReturn().getModelAndView().getModel().get("frame_int"));

+	}

+	

+

+}

diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java
new file mode 100755
index 0000000..43370c7
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java
@@ -0,0 +1,69 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.fusionapp.service;

+

+import java.util.List;

+

+import org.junit.Assert;

+import org.junit.Test;

+import org.springframework.beans.factory.annotation.Autowired;

+

+import org.openecomp.fusion.core.MockApplicationContextTestSuite;

+import org.openecomp.portalsdk.core.domain.Profile;

+import org.openecomp.portalsdk.core.domain.User;

+import org.openecomp.portalsdk.core.service.ProfileService;

+import org.openecomp.portalsdk.core.service.UserProfileService;

+

+

+/**

+ * The Class ProfileServiceTest.

+ */

+public class ProfileServiceTest extends MockApplicationContextTestSuite {

+	

+	/** The service. */

+	@Autowired

+	ProfileService service;

+	

+	/** The user profile service. */

+	@Autowired

+	UserProfileService userProfileService;

+	

+	/**

+	 * Test find all.

+	 */

+	@Test

+	public void testFindAll() {

+		

+		List<Profile> profiles = service.findAll();

+		Assert.assertTrue(profiles.size() > 0);

+	}

+

+	/**

+	 * Test find all active.

+	 */

+	@Test

+	public void testFindAllActive() {

+				

+		List<User> users = userProfileService.findAllActive();

+		List<User> activeUsers = userProfileService.findAllActive();

+		Assert.assertTrue(users.size() - activeUsers.size() >= 0);

+	}

+}

diff --git a/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java
new file mode 100755
index 0000000..08fd9f5
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java
@@ -0,0 +1,45 @@
+/*-

+ * ============LICENSE_START=======================================================

+ * VID

+ * ================================================================================

+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.

+ * ================================================================================

+ * Licensed under the Apache License, Version 2.0 (the "License");

+ * you may not use this file except in compliance with the License.

+ * You may obtain a copy of the License at

+ * 

+ *      http://www.apache.org/licenses/LICENSE-2.0

+ * 

+ * Unless required by applicable law or agreed to in writing, software

+ * distributed under the License is distributed on an "AS IS" BASIS,

+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+ * See the License for the specific language governing permissions and

+ * limitations under the License.

+ * ============LICENSE_END=========================================================

+ */

+

+package org.openecomp.src.main.java.org.vid.dao;

+

+import java.io.IOException;

+import java.sql.SQLException;

+

+import org.junit.Test;

+

+import org.openecomp.vid.dao.FnAppDoaImpl;

+

+public class FnAppDoaImplTest {

+	

+	@Test

+	public void testGetconnection() throws ClassNotFoundException, IOException, SQLException{

+		FnAppDoaImpl impl=new FnAppDoaImpl();

+		impl.getConnection(null,null,null, null);

+		

+	}

+	

+	@Test

+	public void testProfileCount() throws ClassNotFoundException, IOException, SQLException{

+		FnAppDoaImpl impl=new FnAppDoaImpl();

+		impl.getProfileCount(null,null,null, null);	

+	}

+

+}

diff --git a/vid-app-common/src/test/resources/objectconfig.properties b/vid-app-common/src/test/resources/objectconfig.properties
new file mode 100755
index 0000000..312e5bc
--- /dev/null
+++ b/vid-app-common/src/test/resources/objectconfig.properties
@@ -0,0 +1,16 @@
+baseURL=http://vid.onap.org:9080/vid/login_external.htm

+

+

+

+login=//input[@class='fn-ebz-text ng-pristine ng-valid']

+pwd=//input[@class='span3 ng-pristine ng-valid']

+loginButton=loginBtn

+

+

+profilelink=html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span

+refreshButtonSubscriberName=//img[@src='static/fusion/images/refresh.jpg']

+

+subscriberNameDropDown=.//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select

+serviceTypeDropDown=.//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select

+submitButton=.//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button

+