package com.nisum.myteam.controllertest;

import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.nisum.myteam.controller.EmployeeController;
import com.nisum.myteam.model.Account;
import com.nisum.myteam.model.Designation;
import com.nisum.myteam.model.Domain;
import com.nisum.myteam.model.Employee;
import com.nisum.myteam.model.EmployeeLocation;
import com.nisum.myteam.model.MasterData;
import com.nisum.myteam.model.OrgLocation;
import com.nisum.myteam.model.Shift;
import com.nisum.myteam.model.Skill;
import com.nisum.myteam.service.IEmployeeRoleService;
import com.nisum.myteam.service.IEmployeeService;
import com.nisum.myteam.service.impl.DesignationService;
import com.nisum.myteam.service.impl.EmployeeLocationService;
import com.nisum.myteam.service.impl.MasterDataService;
import com.nisum.myteam.service.impl.OrgLocationService;
import com.nisum.myteam.service.impl.ShiftService;
import com.nisum.myteam.service.impl.SkillService;

public class EmployeeControllerTest {

	@Mock
	IEmployeeService employeeService;

	@Mock
	IEmployeeRoleService roleMappingService;

	@InjectMocks
	EmployeeController employeeController;
	
	@InjectMocks 
	EmployeeLocationService empLocationService;
	
	@InjectMocks 
	ShiftService shiftService;
	
	@InjectMocks 
	DesignationService designationService;
	
	@InjectMocks 
	SkillService skillService;
	
	@InjectMocks 
	OrgLocationService orgLocationService;

	@InjectMocks 
	MasterDataService masterDataService;
	
	private MockMvc mockMvc;

	@Before
	public void setup() {
		MockitoAnnotations.initMocks(this);
		mockMvc = MockMvcBuilders.standaloneSetup(employeeController).build();
	}

	@Test
	public void testgetEmployeeRoleAsAdmin() throws Exception {
		Employee employeesRole = new Employee("5b307d7e708ef705c4ca64d8", "16694", "Mahesh Deekonda",
				"mdeekonda@nisum.com", "Admin", "Senior software engineer", null, null, "Support", "Hyderabad", null,
				null, null, null, "ACI - Support", "Active", null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23),
				"Male", null, new Date(2020 - 01 - 01), null, new Date(2018 - 01 - 01), new Date(2018 - 02 - 15),
				new Date(2018 - 02 - 15), null, "Mahesh", "Mahesh");
		;
		when(employeeService.getEmployeeByEmaillId("mdeekonda@nisum.com")).thenReturn(employeesRole);
		mockMvc.perform(get("/user/employee").param("emailId", "mdeekonda@nisum.com"))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getEmployeeByEmaillId("mdeekonda@nisum.com");
	}

	@Test
	public void testgetEmployeeRoleAsEmp() throws Exception {
		Employee employeesRole = new Employee("5b307d7e708ef705c4ca64d8", "16694", "Mahesh Deekonda",
				"mdeekonda@nisum.com", "Employee", "Senior software engineer", null, null, "Support", "Hyderabad", null,
				null, null, null, "ACI - Support", "Active", null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23),
				"Male", null, new Date(2020 - 01 - 01), null, new Date(2018 - 01 - 01), new Date(2018 - 02 - 15),
				new Date(2018 - 02 - 15), null, "Mahesh", "Mahesh");
		when(employeeService.getEmployeeByEmaillId("mdeekonda@nisum.com")).thenReturn(employeesRole);
		when(roleMappingService.getEmployeeRole(employeesRole.getEmployeeId())).thenReturn("Delivery Lead");
		mockMvc.perform(get("/user/employee").param("emailId", "mdeekonda@nisum.com"))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getEmployeeByEmaillId("mdeekonda@nisum.com");
		verify(roleMappingService).getEmployeeRole("16694");
	}

	@Test
	public void testassigingEmployeeRole() throws Exception {
		Employee employeeRole = new Employee("5976ef15874c902c98b8a05d", null, null, null, null, null, null,
				null, null, null, null, null, null, "user@nisum.com", null, null, null, new Date(2017 - 11 - 20),
				new Date(2107 - 12 - 23), null, null, null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		ObjectMapper mapper = new ObjectMapper();
		String jsonString = mapper.writeValueAsString(employeeRole);
		when(employeeService.createEmployee(anyObject(), anyObject())).thenReturn(employeeRole);
		mockMvc.perform(post("/user/assignEmployeeRole").param("empId", "16999")
				.contentType(MediaType.APPLICATION_JSON_VALUE).content(jsonString))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).createEmployee(anyObject(), anyObject());
	}

	@Test
	public void testupdateEmployeeRole() throws Exception {
		Employee employeeRole2 = new Employee("5976ef15874c902c98b8a05d", null, null, null, null, null, null,
				null, null, null, null, null, null, "user@nisum.com", null, null, null, new Date(2017 - 11 - 20),
				new Date(2107 - 12 - 23), null, null, null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		ObjectMapper mapper = new ObjectMapper();
		String jsonString = mapper.writeValueAsString(employeeRole2);
		when(employeeService.updateEmployee(anyObject(), anyObject())).thenReturn(employeeRole2);
		mockMvc.perform(post("/user/updateEmployeeRole").param("empId", "16999")
				.contentType(MediaType.APPLICATION_JSON_VALUE).content(jsonString))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).updateEmployee(anyObject(), anyObject());
	}

	@Test
	public void testdeleteEmployee() throws Exception {
		mockMvc.perform(delete("/user/deleteEmployee").param("empId", "16127"))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).deleteEmployee("16127");
	}

	@Test
	public void testgetUserRoles() throws Exception {
		List<Employee> employeesRole3 = CreateUserRoles();
		when(employeeService.getActiveEmployees()).thenReturn(employeesRole3);
		mockMvc.perform(get("/user/getUserRoles").contentType(MediaType.APPLICATION_JSON_VALUE))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getActiveEmployees();
	}

	@Test
	public void testgetEmployeeRoleData() throws Exception {
		Employee employeesRole = new Employee("5b307d7e708ef705c4ca64d8", "16694", "Mahesh Deekonda",
				"mdeekonda@nisum.com", "Admin", "Senior software engineer", null, null, "Support", "Hyderabad", null,
				null, null, null, "ACI - Support", "Active", null, new Date(2017 - 11 - 20), new Date(2107 - 12 - 23),
				"Male", null, new Date(2020 - 01 - 01), null, new Date(2018 - 01 - 01), new Date(2018 - 02 - 15),
				new Date(2018 - 02 - 15), null, "Mahesh", "Mahesh");
		when(employeeService.getEmployeeById("16694")).thenReturn(employeesRole);
		mockMvc.perform(
				get("/user/getEmployeeRoleData").param("empId", "16694").contentType(MediaType.APPLICATION_JSON_VALUE))
				.andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$.employeeId", is("16694")))
				.andDo(print());
		verify(employeeService).getEmployeeById("16694");
	}

	@Test
	public void testgetEmployeeLocations() throws Exception {

		List<EmployeeLocation> empLocList = new ArrayList<EmployeeLocation>();
		EmployeeLocation empLocation = new EmployeeLocation(new ObjectId("5b307d7d708ef705c4ca59c4"),
				"16090", "Dharmendra Kumar Jampana", "Hyderabad", new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), true);
		empLocList.add(empLocation);
		when(empLocationService.getEmployeeLocations("16090")).thenReturn(empLocList);
		mockMvc.perform(get("/user/getEmployeeLocations").param("employeeId", "16090")
				.contentType(MediaType.APPLICATION_JSON_VALUE)).andExpect(MockMvcResultMatchers.status().isOk());

		verify(empLocationService).getEmployeeLocations("16090");
	}

	@Test
	public void testgetEmployeeRoleDataForEmailIdSearch() throws Exception {
		Employee employeesRole = new Employee("5b307d7d708ef705c4ca5c90", "16209", "Mahesh Kumar Gutam",
				"dummy@nisum.com", "Employee", "Software Engineer", null, null, "Sell", "Hyderabad", null, null, null,
				null, "APPS", "Active", "Full Time", new Date(2017 - 11 - 20), new Date(2107 - 12 - 23), "Male", null,
				null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01), new Date(2018 - 02 - 15),
				new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		when(employeeService.getEmployeeRoleDataForSearchCriteria("dummy@nisum.com", "emailId")).thenReturn(employeesRole);
		mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria").param("searchId", "dummy@nisum.com")
				.param("searchAttribute", "emailId").contentType(MediaType.APPLICATION_JSON_VALUE))
				.andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$.employeeId", is("16209")))
				.andDo(print());
		verify(employeeService).getEmployeeRoleDataForSearchCriteria("dummy@nisum.com", "emailId");
	}

	@Test
	public void testgetEmployeeRoleDataForEmployeeNameSearch() throws Exception {
		Employee employeesRole = new Employee("5b307d7d708ef705c4ca5c90", "16209", "Mahesh Kumar Gutam",
				"dummy@nisum.com", "Employee", "Software Engineer", null, null, "Sell", "Hyderabad", null, null, null,
				null, "APPS", "Active", "Full Time", new Date(2017 - 11 - 20), new Date(2107 - 12 - 23), "Male", null,
				null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01), new Date(2018 - 02 - 15),
				new Date(2018 - 02 - 15), "Mahesh", "Mahesh");

		when(employeeService.getEmployeeRoleDataForSearchCriteria("Mahesh Kumar Gutam", "employeeName"))
				.thenReturn(employeesRole);
		mockMvc.perform(get("/user/getEmployeeRoleDataForSearchCriteria").param("searchId", "Mahesh Kumar Gutam")
				.param("searchAttribute", "employeeName").contentType(MediaType.APPLICATION_JSON_VALUE))
				.andExpect(MockMvcResultMatchers.status().isOk()).andExpect(jsonPath("$.employeeId", is("16209")))
				.andDo(print());
		verify(employeeService).getEmployeeRoleDataForSearchCriteria("Mahesh Kumar Gutam", "employeeName");
	}

	@Test
	public void testGetEmployeeDetailsForAutocomplete() throws Exception {
		List<String> details = new ArrayList<>();
		details.add("16294");
		details.add("Ashwin Kumar");
		details.add("kashwin@nisum.com");
		details.add("16209");
		details.add("Mahesh Kumar Gutam");
		details.add("mgutam@nisum.com");
		details.add("16143");
		details.add("Ajay");
		details.add("ajayS@nisum.com");
		details.add("16207");
		details.add("Sumith Kumar Lambu");
		details.add("slambu@nisum.com");
		details.add("16111");
		details.add("Mahesh Mudrakolu");
		details.add("mmahesh@nisum.com");
		when(employeeService.getEmployeeDetailsForAutocomplete()).thenReturn(details);
		mockMvc.perform(get("/user/getEmployeeDetailsForAutocomplete").contentType(MediaType.APPLICATION_JSON_VALUE))
				.andExpect(MockMvcResultMatchers.status().isOk()).andDo(print());
		verify(employeeService).getEmployeeDetailsForAutocomplete();
	}

	@Test
	public void testgetManagers() throws Exception {
		List<Employee> employeesRole4 = CreateUserRoles();
		System.out.println(employeesRole4);
		when(employeeService.getActiveEmployees()).thenReturn(employeesRole4);
		mockMvc.perform(get("/user/getManagers")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getActiveEmployees();
	}

	@Test
	public void testgetAllShifts() throws Exception {
		List<Shift> shifts = CreateShifts();
		when(shiftService.getAllShifts()).thenReturn(shifts);
		mockMvc.perform(get("/user/getAllShifts")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(shiftService).getAllShifts();
	}

	@Test
	public void testgetAllDesignations() throws Exception {
		List<Designation> designation = CreateDesignations();
		when(designationService.getAllDesignations()).thenReturn(designation);
		mockMvc.perform(get("/user/getAllDesignations")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(designationService).getAllDesignations();
	}

	@Test
	public void testgetTechnologies() throws Exception {
		List<Skill> skills = CreateSkill();
		System.out.println(skills);
		when(skillService.getTechnologies()).thenReturn(skills);
		mockMvc.perform(get("/user/getSkills")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(skillService).getTechnologies();
	}

	@Test
	public void testgetLocations() throws Exception {
		when(orgLocationService.getLocations()).thenReturn(locations());
		mockMvc.perform(get("/user/getLocations")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(orgLocationService, atLeastOnce()).getLocations();
	}

	@Test
	public void testupdateProfile() throws Exception {
		Employee employeeRole = new Employee("5976ef15874c902c98b8a05d", null, null, null, null, null, null,
				null, null, null, null, null, null, "user@nisum.com", null, null, null, new Date(2017 - 11 - 20),
				new Date(2107 - 12 - 23), null, null, null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		System.out.println(employeeRole);
		ObjectMapper mapper = new ObjectMapper();
		String jsonString = mapper.writeValueAsString(employeeRole);
		System.out.println(jsonString);
		when(employeeService.updateProfile(anyObject())).thenReturn(employeeRole);
		mockMvc.perform(post("/user/updateProfile").contentType(MediaType.APPLICATION_JSON_VALUE).content(jsonString))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).updateProfile(anyObject());
	}

	@Test
	public void getAccounts() throws Exception {
		List<Account> account = CreateAccount();
		System.out.println(account);
		when(employeeService.getAccounts()).thenReturn(account);
		mockMvc.perform(get("/user/getAccounts")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getAccounts();
	}

	@Test
	public void testGetMasterData() throws Exception {
		List<MasterData> masterDataMap = masterData();
		when(masterDataService.getMasterData()).thenReturn(masterDataMap);
		mockMvc.perform(get("/user/getMasterData")).andExpect(MockMvcResultMatchers.status().isOk());
		verify(masterDataService).getMasterData();
	}

	@Test
	public void testGetEmployeeByStatus() throws Exception {
		List<Employee> empRolesList = employeeRoles();
		when(employeeService.getEmployeesByStatus("Active")).thenReturn(empRolesList);
		mockMvc.perform(get("/user/getEmployeeByStatus").param("status", "Active"))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getEmployeesByStatus("Active");
	}

//	@Test
//	public void testgetdomains() throws Exception {
//
//		when(employeeService.getDomains("Acc001")).thenReturn(domains());
//		mockMvc.perform(get("/user/getDomains").param("accountId", "Acc001"))
//				.andExpect(MockMvcResultMatchers.status().isOk());
//		verify(employeeService).getDomains("Acc001");
//
//	}

	@Test
	public void testgetDeliveryLeads() throws Exception {

		HashMap<String, String> dl1 = new HashMap<String, String>();
		dl1.put("employeeName", "Madhuri Bayyagari");
		dl1.put("employeeId", "16620");

		HashMap<String, String> dl2 = new HashMap<String, String>();
		dl2.put("employeeName", "Sridhar Swamy Perumbaduri");
		dl2.put("employeeId", "16630");

		List<HashMap<String, String>> dlList = new ArrayList<HashMap<String, String>>();

		dlList.add(dl1);
		dlList.add(dl2);

		when(employeeService.getDeliveryLeads("DOM001")).thenReturn(dlList);
		mockMvc.perform(get("/user/getDeliveryLeads").param("domainId", "DOM001"))
				.andExpect(MockMvcResultMatchers.status().isOk());
		verify(employeeService).getDeliveryLeads("DOM001");

	}

	private List<Account> CreateAccount() {
		List<Account> data = new ArrayList<>();

		Account account1 = new Account();
		//account1.setId(new ObjectId("5976ef15874c902c98b8a05d"));
		account1.setAccountId("01");
		account1.setAccountName("GAP");
		account1.setAccountProjectSequence(1);
		account1.setStatus("Active");
		data.add(account1);

		Account account2 = new Account();
		//account2.setId(new ObjectId("2476ef15874c902c98b8a05d"));
		account2.setAccountId("02");
		account2.setAccountName("MACYS");
		account2.setAccountProjectSequence(2);
		account2.setStatus("Non-Active");
		data.add(account2);
		return data;

	}

	private List<Skill> CreateSkill() {
		List<Skill> data = new ArrayList<>();

		Skill skills1 = new Skill();
		skills1.setId(new ObjectId("5976ef15874c902c98b8a05d"));
		skills1.setSkillId("01");
		skills1.setSkillName("Java");
		skills1.setActiveStatus("Active");
		data.add(skills1);

		Skill skills2 = new Skill();
		skills2.setId(new ObjectId("2476ef15874c902c98b8a05d"));
		skills2.setSkillId("02");
		skills2.setSkillName("Big Data");
		skills2.setActiveStatus("Active");
		data.add(skills2);
		return data;

	}

	private List<Designation> CreateDesignations() {
		List<Designation> data = new ArrayList<>();

		Designation desig1 = new Designation();
		desig1.setId(new ObjectId("5976ef15874c902c98b8a05d"));
		desig1.setDesignationId("01");
		desig1.setDesignationName("Manager");
		desig1.setActiveStatus("Active");
		data.add(desig1);

		Designation desig2 = new Designation();
		desig2.setId(new ObjectId("2476ef15874c902c98b8a05d"));
		desig2.setDesignationId("02");
		desig2.setDesignationName("Employee");
		desig2.setActiveStatus("Active");
		data.add(desig2);
		return data;
	}

	private List<Shift> CreateShifts() {
		List<Shift> data = new ArrayList<>();

		Shift shift1 = new Shift();
		shift1.setId(new ObjectId("5976ef15874c902c98b8a05d"));
		shift1.setShiftId("01");
		shift1.setShiftName("Morning Shift");
		shift1.setActiveStatus("Active");
		data.add(shift1);

		Shift shift2 = new Shift();
		shift2.setId(new ObjectId("2476ef15874c902c98b8a05d"));
		shift2.setShiftId("02");
		shift2.setShiftName("Night Shift");
		shift2.setActiveStatus("Active");
		data.add(shift2);
		return data;
	}

	private List<Employee> CreateUserRoles() {
		List<Employee> data = new ArrayList<>();

		Employee data1 = new Employee();
		data1.setId("3976ef15874c902c98b8a05d");
		data1.setEmployeeId("16101");
		data1.setEmployeeName("Abc");
		data1.setEmailId("user1@nisum.com");
		data1.setRole("HR");
		data1.setDesignation("Human Resource Manager");
		data1.setShift("09:00-06:00");
		data1.setBaseTechnology("Spring");
		data1.setTechnologyKnown("Jmeter");
		data1.setMobileNumber("9978567809");
		data1.setAlternateMobileNumber("7789092345");
		data1.setPersonalEmailId("user1@gmail.com");
		data1.setCreatedOn(new Date(2017 - 11 - 21));
		data1.setLastModifiedOn(new Date(2017 - 12 - 22));

		Employee data2 = new Employee();
		data2.setId("4976ef15874c902c98b8a05d");
		data2.setEmployeeId("16102");
		data2.setEmployeeName("Xyz");
		data2.setEmailId("user2@nisum.com");
		data2.setRole("Manager");
		data2.setDesignation("Senior Software Engineer");
		data2.setShift("03:00-12:00");
		data2.setBaseTechnology("Hibernate");
		data2.setTechnologyKnown("EJB");
		data2.setMobileNumber("9989087671");
		data2.setAlternateMobileNumber("9999786756");
		data2.setPersonalEmailId("user2@gmail.com");
		data2.setCreatedOn(new Date(2017 - 11 - 23));
		data2.setLastModifiedOn(new Date(2017 - 12 - 22));

		data.add(data1);
		data.add(data2);

		return data;
	}

	private List<MasterData> masterData() {
		List<MasterData> masterDataList = new ArrayList<MasterData>();
		MasterData md1 = new MasterData();
		md1.setActiveStatus(true);
		md1.setId(new ObjectId("5af31b08ed59fba43518ed84"));
		md1.setMasterDataId("1");
		md1.setMasterDataName("Java");
		md1.setMasterDataType("skills");
		md1.setComments(null);

		MasterData md2 = new MasterData();
		md2.setActiveStatus(true);
		md2.setId(new ObjectId("5af32e8fed59fba43518ed88"));
		md2.setMasterDataId("1");
		md2.setMasterDataName("Full Time");
		md2.setMasterDataType("EmpType");
		md2.setComments(null);

		masterDataList.add(md1);
		masterDataList.add(md2);

		return masterDataList;
	}

	private List<Employee> employeeRoles() {

		List<Employee> employeeRoles = new ArrayList<Employee>();
		Employee employeesRole1 = new Employee("5b307d7d708ef705c4ca5c90", null, null, null, null, null, null,
				null, null, null, null, null, null, "dummy@nisum.com", null, null, null, new Date(2017 - 11 - 20),
				new Date(2107 - 12 - 23), null, null, null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		Employee employeesRole2 = new Employee("5976ef15874c902c98b8a05d", null, null, null, null, null, null,
				null, null, null, null, null, null, "user@nisum.com", null, null, null, new Date(2017 - 11 - 20),
				new Date(2107 - 12 - 23), null, null, null, null, new Date(2020 - 01 - 01), new Date(2018 - 01 - 01),
				new Date(2018 - 02 - 15), new Date(2018 - 02 - 15), "Mahesh", "Mahesh");
		employeeRoles.add(employeesRole1);
		employeeRoles.add(employeesRole2);
		return employeeRoles;
	}

	private List<OrgLocation> locations() {
		List<OrgLocation> empLocation = new ArrayList<OrgLocation>();

		OrgLocation l1 = new OrgLocation(new ObjectId("5b307c9c927173017882543b"), "IN_HYD", "Hyderabad Appstek Building",
				"India", "Telangana", "Hyderabad", true, "testing");
		OrgLocation l2 = new OrgLocation(new ObjectId("5b307c9c927173017882543a"), "NY_SF", "Pleasonton Gap Office", "USA",
				"CA", "SanFransisco", true, "testing");
		empLocation.add(l1);
		empLocation.add(l2);
		return empLocation;
	}

	private List<Domain> domains() {
		List<String> dl1 = new ArrayList<String>();
		dl1.add("16120");
		dl1.add("16121");

		List<String> dl2 = new ArrayList<String>();
		dl2.add("16122");
		dl2.add("16123");

		List<Domain> domains = new ArrayList<Domain>();

		Domain d1 = new Domain( "DOM001", "Customer", "Acc001", "Active",
				dl1);
		Domain d2 = new Domain( "DOM005", "rajesh", "Acc001", "Active", dl2);

		domains.add(d1);
		domains.add(d2);
		return domains;
	}

}
