CompanyTemplate extends AbstractTemplate implements CompanyOperations { public Companies search(String keywords) { JsonNode node = restOperations.getForObject(COMPANY_SEARCH_URL, JsonNode.class, keywords); try { return objectMapper.reader(new TypeReference<Companies>(){}).readValue(node.path("companies")); } catch (Exception e) { throw new RuntimeException(e); } } CompanyTemplate(RestOperations RestOperations, ObjectMapper objectMapper); Company getCompany(int id); Company getCompanyByUniversalName(String name); List<Company> getCompaniesByEmailDomain(String domain); Companies search(String keywords); List<Company> getFollowing(); List<Company> getSuggestionsToFollow(); void startFollowingCompany(int id); void stopFollowingCompany(int id); Products getProducts(int companyId, int start, int count); static final String BASE_URL; static final String COMPANY_FIELDS; static final String COMPANY_URL; static final String COMPANY_SEARCH_URL; static final String COMPANY_FOLLOW_URL; static final String COMPANY_FOLLOW_START_STOP_URL; static final String COMPANY_SUGGESTIONS_TO_FOLLOW; static final String PRODUCT_FIELDS; static final String PRODUCTS_URL; }
@Test public void search() { mockServer.expect(requestTo(CompanyTemplate.COMPANY_SEARCH_URL.replaceFirst("\\{keywords\\}", "spring%20j2ee") + "&oauth2_access_token=ACCESS_TOKEN")).andExpect(method(GET)) .andRespond(withSuccess(new ClassPathResource("company_search.json", getClass()), MediaType.APPLICATION_JSON)); Companies result = linkedIn.companyOperations().search("spring j2ee"); assertEquals(10, result.getCount()); assertEquals(0, result.getStart()); assertEquals(88, result.getTotal()); assertEquals(10, result.getCompanies().size()); Company company = result.getCompanies().get(0); assertEquals("", company.getBlogRssUrl()); assertEquals("P", company.getCompanyType().getCode()); assertEquals("Privately Held", company.getCompanyType().getName()); assertEquals("Rain Concert Technologies (P) Ltd, is a leading provider of Web-Mobile-Electronics convergent solutions and has capabilities that span across various domains, applications and technologies. Very strong Web-Mobile convergent solutions are at its best with Rain Concert.\r\nOur spectrum of solutions range from High End Web Application Development, Rich Internet Applications, iphone/ipad Applications, e-Governance solutions, Social Networking Applications, Online Learning Management Systems, Web Casting Applications, Web Based CRM & ERP Solutions, Collaborative Video Sharing Platforms, e-Commerce Applications, Online Auction & e-Commerce Portals, to development of Games for Web & Mobile, Enterprise domain solutions. \r\nThe company has a Regional Office in Delhi and has set up offices in Saudi, Dubai and soon to launch its office in Bahrain and has strategic partners in USA, Bahrain and UAE. Aarthika Technologies, the subsidiary of Rain Concert has a strong presence in the online sales platform and continues to maintain its position as a Top Rated Company. \r\n\r\n\r\nTechnology Expertise\r\n\r\nRich Internet Applications\r\n\r\nInteractive 3D\r\nAs3, Flash, Flex\r\nAdobe AIR, Paper Vision 3D\r\nFlash Media Server\r\nWowsa Server\r\n\r\nMobile \r\n\r\nIphone, ipad,\r\nAndroid, BlackBerry, J2Me, Symbian\r\n\r\nWeb \r\n\r\nPHP, Ruby on Rail, Perl, .Net,\r\nJ2EE, Hibernete, Spring\r\nMySQl, MSSQL, Oracle\r\n\r\nElectronics\r\n\r\nUtility Electronics\r\nHigh-end Security Products\r\nConvergent Applications", company.getDescription()); assertEquals("aarthikaindia.com", company.getEmailDomains().get(0)); assertEquals("D", company.getEmployeeCountRange().getCode()); assertEquals("51-200", company.getEmployeeCountRange().getName()); assertEquals(2006, company.getFoundedYear()); assertEquals(202421, company.getId()); assertEquals("Information Technology and Services", company.getIndustry()); assertEquals(1, company.getLocations().size()); assertEquals("Trivandrum", company.getLocations().get(0).getAddress().getCity()); assertEquals("695010", company.getLocations().get(0).getAddress().getPostalCode()); assertEquals("Thejaswini", company.getLocations().get(0).getAddress().getStreet1()); assertEquals("Rain Concert Technologies (P) Ltd. / Aarthika Technologies", company.getName()); assertEquals(166, company.getNumFollowers()); assertEquals(7, company.getSpecialties().size()); assertEquals("Web Application Development", company.getSpecialties().get(0)); assertEquals("OPR", company.getStatus().getCode()); assertEquals("Operating", company.getStatus().getName()); assertEquals("", company.getTwitterId()); assertEquals("rain-concert-technologies-p-ltd.-aarthika-technologies", company.getUniversalName()); assertEquals("www.rainconcert.in", company.getWebsiteUrl()); }