List of usage examples for org.springframework.http MediaType parseMediaType
public static MediaType parseMediaType(String mediaType)
From source file:org.apache.metron.rest.controller.PcapControllerIntegrationTest.java
@Test public void testRawDownload() throws Exception { String pcapFileContents = "pcap file contents"; FileUtils.write(new File("./target/pcapFile"), pcapFileContents, "UTF8"); MockPcapJob mockPcapJob = (MockPcapJob) wac.getBean("mockPcapJob"); mockPcapJob.setStatus(new JobStatus().withJobId("jobId").withState(JobStatus.State.RUNNING)); this.mockMvc//from www . j a v a 2 s.co m .perform(post(pcapUrl + "/fixed").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(fixedJson)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.jobId").value("jobId")).andExpect(jsonPath("$.jobStatus").value("RUNNING")); Pageable<Path> pageable = new PcapPages(Arrays.asList(new Path("./target/pcapFile"))); mockPcapJob.setIsDone(true); mockPcapJob.setPageable(pageable); this.mockMvc.perform(get(pcapUrl + "/jobId/raw?page=1").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(header().string("Content-Disposition", "attachment; filename=\"pcap_jobId_1.pcap\"")) .andExpect(header().string("Content-Length", Integer.toString(pcapFileContents.length()))) .andExpect(content().contentType(MediaType.parseMediaType("application/octet-stream"))) .andExpect(content().bytes(pcapFileContents.getBytes())); this.mockMvc .perform(get(pcapUrl + "/jobId/raw?page=1&fileName=pcapFile.pcap").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(header().string("Content-Disposition", "attachment; filename=\"pcapFile.pcap\"")) .andExpect(header().string("Content-Length", Integer.toString(pcapFileContents.length()))) .andExpect(content().contentType(MediaType.parseMediaType("application/octet-stream"))) .andExpect(content().bytes(pcapFileContents.getBytes())); this.mockMvc.perform(get(pcapUrl + "/jobId/raw?page=2").with(httpBasic(user, password))) .andExpect(status().isNotFound()); }
From source file:org.apache.metron.rest.controller.PcapControllerIntegrationTest.java
@Test public void testGetFixedFilterConfiguration() throws Exception { MockPcapJob mockPcapJob = (MockPcapJob) wac.getBean("mockPcapJob"); mockPcapJob.setStatus(new JobStatus().withJobId("jobId").withState(JobStatus.State.RUNNING)); this.mockMvc//w ww .j a va2s .c o m .perform(post(pcapUrl + "/fixed").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(fixedJson)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.jobId").value("jobId")).andExpect(jsonPath("$.jobStatus").value("RUNNING")); this.mockMvc.perform(get(pcapUrl + "/jobId/config").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.basePath").value("/base/path")) .andExpect(jsonPath("$.finalOutputPath").value("/final/output/path")) .andExpect(jsonPath("$.startTimeMs").value(10)).andExpect(jsonPath("$.endTimeMs").value(20)) .andExpect(jsonPath("$.numReducers").value(2)) .andExpect(jsonPath("$.ipSrcAddr").value("192.168.1.2")) .andExpect(jsonPath("$.ipDstAddr").value("192.168.1.1")) .andExpect(jsonPath("$.ipSrcPort").value("2000")).andExpect(jsonPath("$.ipDstPort").value("1000")) .andExpect(jsonPath("$.protocol").value("TCP")) .andExpect(jsonPath("$.packetFilter").value("filter")) .andExpect(jsonPath("$.includeReverse").value("true")); }
From source file:org.apache.metron.rest.controller.PcapControllerIntegrationTest.java
@Test public void testGetQueryFilterConfiguration() throws Exception { MockPcapJob mockPcapJob = (MockPcapJob) wac.getBean("mockPcapJob"); mockPcapJob.setStatus(new JobStatus().withJobId("jobId").withState(JobStatus.State.RUNNING)); this.mockMvc/*from ww w. j a va 2s.c om*/ .perform(post(pcapUrl + "/query").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(queryJson)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.jobId").value("jobId")).andExpect(jsonPath("$.jobStatus").value("RUNNING")); this.mockMvc.perform(get(pcapUrl + "/jobId/config").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.basePath").value("/base/path")) .andExpect(jsonPath("$.finalOutputPath").value("/final/output/path")) .andExpect(jsonPath("$.startTimeMs").value(10)).andExpect(jsonPath("$.endTimeMs").value(20)) .andExpect(jsonPath("$.numReducers").value(2)).andExpect(jsonPath("$.query").value("query")); }
From source file:org.apache.metron.rest.controller.SensorParserConfigControllerIntegrationTest.java
@Test public void testSecurity() throws Exception { this.mockMvc/* w ww . ja v a 2s . c o m*/ .perform(post(sensorParserConfigUrl).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(squidJson)) .andExpect(status().isUnauthorized()); this.mockMvc.perform(get(sensorParserConfigUrl + "/squidTest")).andExpect(status().isUnauthorized()); this.mockMvc.perform(get(sensorParserConfigUrl)).andExpect(status().isUnauthorized()); this.mockMvc.perform(delete(sensorParserConfigUrl + "/squidTest").with(csrf())) .andExpect(status().isUnauthorized()); }
From source file:org.apache.metron.rest.controller.SensorParserConfigControllerIntegrationTest.java
@Test public void test() throws Exception { cleanFileSystem();//from w w w . j ava 2 s . co m this.sensorParserConfigService.delete("broTest"); this.sensorParserConfigService.delete("squidTest"); this.mockMvc .perform(post(sensorParserConfigUrl).with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(squidJson)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.parserClassName").value("org.apache.metron.parsers.GrokParser")) .andExpect(jsonPath("$.sensorTopic").value("squidTest")) .andExpect(jsonPath("$.parserConfig.grokPath").value("target/patterns/squidTest")) .andExpect(jsonPath("$.parserConfig.patternLabel").value("SQUIDTEST")) .andExpect(jsonPath("$.parserConfig.timestampField").value("timestamp")) .andExpect(jsonPath("$.fieldTransformations[0].transformation").value("STELLAR")) .andExpect(jsonPath("$.fieldTransformations[0].output[0]").value("full_hostname")) .andExpect(jsonPath("$.fieldTransformations[0].output[1]").value("domain_without_subdomains")) .andExpect(jsonPath("$.fieldTransformations[0].config.full_hostname").value("URL_TO_HOST(url)")) .andExpect(jsonPath("$.fieldTransformations[0].config.domain_without_subdomains") .value("DOMAIN_REMOVE_SUBDOMAINS(full_hostname)")); this.mockMvc.perform(get(sensorParserConfigUrl + "/squidTest").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.parserClassName").value("org.apache.metron.parsers.GrokParser")) .andExpect(jsonPath("$.sensorTopic").value("squidTest")) .andExpect(jsonPath("$.parserConfig.grokPath").value("target/patterns/squidTest")) .andExpect(jsonPath("$.parserConfig.patternLabel").value("SQUIDTEST")) .andExpect(jsonPath("$.parserConfig.timestampField").value("timestamp")) .andExpect(jsonPath("$.fieldTransformations[0].transformation").value("STELLAR")) .andExpect(jsonPath("$.fieldTransformations[0].output[0]").value("full_hostname")) .andExpect(jsonPath("$.fieldTransformations[0].output[1]").value("domain_without_subdomains")) .andExpect(jsonPath("$.fieldTransformations[0].config.full_hostname").value("URL_TO_HOST(url)")) .andExpect(jsonPath("$.fieldTransformations[0].config.domain_without_subdomains") .value("DOMAIN_REMOVE_SUBDOMAINS(full_hostname)")); this.mockMvc.perform(get(sensorParserConfigUrl).with(httpBasic(user, password))).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$[?(@.parserClassName == 'org.apache.metron.parsers.GrokParser' &&" + "@.sensorTopic == 'squidTest' &&" + "@.parserConfig.grokPath == 'target/patterns/squidTest' &&" + "@.parserConfig.patternLabel == 'SQUIDTEST' &&" + "@.parserConfig.timestampField == 'timestamp' &&" + "@.fieldTransformations[0].transformation == 'STELLAR' &&" + "@.fieldTransformations[0].output[0] == 'full_hostname' &&" + "@.fieldTransformations[0].output[1] == 'domain_without_subdomains' &&" + "@.fieldTransformations[0].config.full_hostname == 'URL_TO_HOST(url)' &&" + "@.fieldTransformations[0].config.domain_without_subdomains == 'DOMAIN_REMOVE_SUBDOMAINS(full_hostname)')]") .exists()); this.mockMvc .perform(post(sensorParserConfigUrl).with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(broJson)) .andExpect(status().isCreated()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.parserClassName").value("org.apache.metron.parsers.bro.BasicBroParser")) .andExpect(jsonPath("$.sensorTopic").value("broTest")) .andExpect(jsonPath("$.parserConfig").isEmpty()); this.mockMvc .perform(post(sensorParserConfigUrl).with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")).content(broJson)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.parserClassName").value("org.apache.metron.parsers.bro.BasicBroParser")) .andExpect(jsonPath("$.sensorTopic").value("broTest")) .andExpect(jsonPath("$.parserConfig").isEmpty()); this.mockMvc.perform(get(sensorParserConfigUrl).with(httpBasic(user, password))).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$[?(@.parserClassName == 'org.apache.metron.parsers.GrokParser' &&" + "@.sensorTopic == 'squidTest' &&" + "@.parserConfig.grokPath == 'target/patterns/squidTest' &&" + "@.parserConfig.patternLabel == 'SQUIDTEST' &&" + "@.parserConfig.timestampField == 'timestamp' &&" + "@.fieldTransformations[0].transformation == 'STELLAR' &&" + "@.fieldTransformations[0].output[0] == 'full_hostname' &&" + "@.fieldTransformations[0].output[1] == 'domain_without_subdomains' &&" + "@.fieldTransformations[0].config.full_hostname == 'URL_TO_HOST(url)' &&" + "@.fieldTransformations[0].config.domain_without_subdomains == 'DOMAIN_REMOVE_SUBDOMAINS(full_hostname)')]") .exists()) .andExpect(jsonPath("$[?(@.parserClassName == 'org.apache.metron.parsers.bro.BasicBroParser' && " + "@.sensorTopic == 'broTest')]").exists()); this.mockMvc .perform(delete(sensorParserConfigUrl + "/squidTest").with(httpBasic(user, password)).with(csrf())) .andExpect(status().isOk()); this.mockMvc.perform(get(sensorParserConfigUrl + "/squidTest").with(httpBasic(user, password))) .andExpect(status().isNotFound()); this.mockMvc .perform(delete(sensorParserConfigUrl + "/squidTest").with(httpBasic(user, password)).with(csrf())) .andExpect(status().isNotFound()); this.mockMvc.perform(get(sensorParserConfigUrl).with(httpBasic(user, password))).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$[?(@.sensorTopic == 'squidTest')]").doesNotExist()) .andExpect(jsonPath("$[?(@.sensorTopic == 'broTest')]").exists()); this.mockMvc .perform(delete(sensorParserConfigUrl + "/broTest").with(httpBasic(user, password)).with(csrf())) .andExpect(status().isOk()); this.mockMvc .perform(delete(sensorParserConfigUrl + "/broTest").with(httpBasic(user, password)).with(csrf())) .andExpect(status().isNotFound()); this.mockMvc.perform(get(sensorParserConfigUrl).with(httpBasic(user, password))).andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$[?(@.sensorTopic == 'squidTest')]").doesNotExist()) .andExpect(jsonPath("$[?(@.sensorTopic == 'broTest')]").doesNotExist()); this.mockMvc.perform(get(sensorParserConfigUrl + "/list/available").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.Bro").value("org.apache.metron.parsers.bro.BasicBroParser")) .andExpect(jsonPath("$.Grok").value("org.apache.metron.parsers.GrokParser")); this.mockMvc.perform(get(sensorParserConfigUrl + "/reload/available").with(httpBasic(user, password))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.Bro").value("org.apache.metron.parsers.bro.BasicBroParser")) .andExpect(jsonPath("$.Grok").value("org.apache.metron.parsers.GrokParser")); this.mockMvc .perform(post(sensorParserConfigUrl + "/parseMessage").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")) .content(parseRequest)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.elapsed").value(415)).andExpect(jsonPath("$.code").value(200)) .andExpect(jsonPath("$.ip_dst_addr").value("207.109.73.154")) .andExpect(jsonPath("$.method").value("GET")).andExpect(jsonPath("$.bytes").value(337891)) .andExpect(jsonPath("$.action").value("TCP_MISS")) .andExpect(jsonPath("$.ip_src_addr").value("127.0.0.1")) .andExpect(jsonPath("$.url").value("http://www.aliexpress.com/af/shoes.html?")) .andExpect(jsonPath("$.timestamp").value(1467011157401L)); this.mockMvc .perform(post(sensorParserConfigUrl + "/parseMessage").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")) .content(missingConfigParseRequest)) .andExpect(status().isInternalServerError()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.responseCode").value(500)) .andExpect(jsonPath("$.message").value("SensorParserConfig is missing from ParseMessageRequest")); this.mockMvc .perform(post(sensorParserConfigUrl + "/parseMessage").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")) .content(missingClassParseRequest)) .andExpect(status().isInternalServerError()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.responseCode").value(500)) .andExpect(jsonPath("$.message").value("SensorParserConfig must have a parserClassName")); this.mockMvc .perform(post(sensorParserConfigUrl + "/parseMessage").with(httpBasic(user, password)).with(csrf()) .contentType(MediaType.parseMediaType("application/json;charset=UTF-8")) .content(badClassParseRequest)) .andExpect(status().isInternalServerError()) .andExpect(content().contentType(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(jsonPath("$.responseCode").value(500)) .andExpect(jsonPath("$.message").value("java.lang.ClassNotFoundException: badClass")); this.sensorParserConfigService.delete("broTest"); this.sensorParserConfigService.delete("squidTest"); }
From source file:org.apache.rave.portal.web.controller.MessageBundleController.java
public MessageBundleController() { clientMessagesCache = new HashMap<Locale, String>(); acceptHeaderLocaleResolver = new AcceptHeaderLocaleResolver(); clientMessagesResponseHeaders = new HttpHeaders(); // set the common response headers that will be used by the getClientMessages response clientMessagesResponseHeaders.setCacheControl("max-age=" + CLIENT_MESSAGE_BUNDLE_CACHE_CONTROL_MAX_AGE); clientMessagesResponseHeaders.setContentType(MediaType.parseMediaType(JAVASCRIPT_CONTENT_TYPE)); Locale.setDefault(Locale.ENGLISH); }
From source file:org.beadle.framework.view.ReturnTypeViewResolver.java
private View getBestView(List<View> candidateViews, List<MediaType> requestedMediaTypes, RequestAttributes attrs) {// w w w .j a v a2 s . c o m HttpServletRequest request = ((ServletRequestAttributes) attrs).getRequest(); for (View candidateView : candidateViews) { if (StringUtils.hasText(candidateView.getContentType())) { ModelAndView mv = (ModelAndView) request.getAttribute("ModelAndView"); //message... Object result = mv.getModelMap().get("message"); MediaType candidateContentType = MediaType.parseMediaType(candidateView.getContentType()); if (result == null && candidateContentType.isCompatibleWith(MediaType.TEXT_HTML)) { if (logger.isDebugEnabled()) { logger.debug("Returning [" + candidateView + "] based on requested media type '" + candidateContentType + "'"); } attrs.setAttribute(View.SELECTED_CONTENT_TYPE, candidateContentType, RequestAttributes.SCOPE_REQUEST); return candidateView; } else if (result != null && candidateContentType.isCompatibleWith(MediaType.APPLICATION_JSON)) { if (logger.isDebugEnabled()) { logger.debug("Returning [" + candidateView + "] based on requested media type '" + candidateContentType + "'"); } attrs.setAttribute(View.SELECTED_CONTENT_TYPE, candidateContentType, RequestAttributes.SCOPE_REQUEST); return candidateView; } } } return null; }
From source file:org.cbioportal.weblegacy.ApiControllerTest.java
@Test @Ignore/*from w ww .ja va 2 s . co m*/ public void cancerTypeDataTest1() throws Exception { List<DBCancerType> mockResponse = new ArrayList<DBCancerType>(); DBCancerType item1 = new DBCancerType(); item1.id = "nmzl"; item1.name = "Nodal Marginal Zone Lymphoma"; item1.color = "LimeGreen"; DBCancerType item2 = new DBCancerType(); item2.id = "tcca"; item2.name = "Choriocarcinoma"; item2.color = "Red"; mockResponse.add(item1); mockResponse.add(item2); Mockito.when(cancerTypeMapperLegacyMock.getAllCancerTypes()).thenReturn(mockResponse); this.mockMvc .perform(MockMvcRequestBuilders.get("/cancertypes") .accept(MediaType.parseMediaType("application/json;charset=UTF-8"))) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect( MockMvcResultMatchers.content().contentTypeCompatibleWith("application/json;charset=UTF-8")) .andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath("$[0].id").value("nmzl")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].name").value("Nodal Marginal Zone Lymphoma")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].color").value("LimeGreen")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].id").value("tcca")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].name").value("Choriocarcinoma")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].color").value("Red")); }
From source file:org.cbioportal.weblegacy.ApiControllerTest.java
@Test @Ignore/*ww w . j av a2 s . c om*/ public void cancerTypeDataTest2() throws Exception { List<DBCancerType> mockResponse = new ArrayList<DBCancerType>(); DBCancerType item1 = new DBCancerType(); item1.id = "nmzl"; item1.name = "Nodal Marginal Zone Lymphoma"; item1.color = "LimeGreen"; DBCancerType item2 = new DBCancerType(); item2.id = "tcca"; item2.name = "Choriocarcinoma"; item2.color = "Red"; mockResponse.add(item1); mockResponse.add(item2); List<String> args = new ArrayList<String>(2); args.add("nmzl"); args.add("tcca"); Mockito.when(cancerTypeMapperLegacyMock.getCancerTypes(org.mockito.Matchers.anyListOf(String.class))) .thenReturn(mockResponse); this.mockMvc .perform(MockMvcRequestBuilders.get("/cancertypes") .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .param("cancer_type_ids", "nmzl,tcca")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect( MockMvcResultMatchers.content().contentTypeCompatibleWith("application/json;charset=UTF-8")) .andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.hasSize(2))) .andExpect(MockMvcResultMatchers.jsonPath("$[0].id").value("nmzl")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].name").value("Nodal Marginal Zone Lymphoma")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].color").value("LimeGreen")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].id").value("tcca")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].name").value("Choriocarcinoma")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].color").value("Red")); }
From source file:org.cbioportal.weblegacy.ApiControllerTest.java
@Ignore @Test/*from w ww .j av a 2 s . c o m*/ public void geneticProfileDataTest1() throws Exception { List<Mutation> mockResponse = getGeneticprofiledataQuery1ServiceMock(); List<DBGeneticProfile> ctMockResponse = getGeneticProfileQuery1ServiceMock(); Mockito.when( geneticProfileMapperLegacyMock.getGeneticProfiles(org.mockito.Matchers.anyListOf(String.class))) .thenReturn(ctMockResponse); Mockito.when(mutationMapperLegacy.getMutationsDetailed(org.mockito.Matchers.anyListOf(String.class), org.mockito.Matchers.anyListOf(String.class), org.mockito.Matchers.anyListOf(String.class), org.mockito.Matchers.anyString())).thenReturn(mockResponse); this.mockMvc.perform(MockMvcRequestBuilders.get("/geneticprofiledata") .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .param("genetic_profile_ids", "brca_tcga_mutations").param("genes", "AKT1,TGFBR1") .param("sample_ids", "TCGA-AC-A23H-01,TCGA-AR-A2LE-01,TCGA-GM-A3NW-01,TCGA-AN-A0XR-01,TCGA-AO-A12D-01,TCGA-BH-A0B5-01") .param("sample_list_id", "brca_tcga_all")).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect( MockMvcResultMatchers.content().contentTypeCompatibleWith("application/json;charset=UTF-8")) .andExpect(MockMvcResultMatchers.jsonPath("$", Matchers.hasSize(6))) .andExpect(MockMvcResultMatchers.jsonPath("$[0].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].sample_list_id").value("brca_tcga_all")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].genetic_profile_id").value("brca_tcga_mutations")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].study_id").value("brca_tcga")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].sequencing_center").value("genome.wustl.edu")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].mutation_status").value("Somatic")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].mutation_type").value("Missense_Mutation")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].validation_status").value("Untested")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].reference_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].variant_read_count_tumor").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].reference_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].variant_read_count_normal").value("-1")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].entrez_gene_id").value("207")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].hugo_gene_symbol").value("AKT1")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].sample_id").value("TCGA-AN-A0XR-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].amino_acid_change").value("L52R")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].functional_impact_score").value("M")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].xvar_link") .value("getma.org/?cm=var&var=hg19,14,105246445,A,C&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].xvar_link_pdb") .value("getma.org/pdb.php?prot=AKT1_HUMAN&from=6&to=108&var=L52R")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=AKT1_HUMAN&rb=6&re=108&var=L52R")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].chr").value("14")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].start_position").value("105246445")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].end_position").value("105246445")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].protein_start_position").value("52")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].protein_end_position").value("52")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].reference_allele").value("A")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].variant_allele").value("C")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].entrez_gene_id").value("207")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].hugo_gene_symbol").value("AKT1")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].sample_id").value("TCGA-GM-A3NW-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].amino_acid_change").value("V4L")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].functional_impact_score").value("N")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].xvar_link") .value("getma.org/?cm=var&var=hg19,14,105258971,C,G&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].xvar_link_pdb") .value("getma.org/pdb.php?prot=AKT1_HUMAN&from=1&to=5&var=V4L")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=AKT1_HUMAN&rb=1&re=35&var=V4L")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].chr").value("14")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].start_position").value("105258971")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].end_position").value("105258971")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].protein_start_position").value("4")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].protein_end_position").value("4")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].reference_allele").value("C")) .andExpect(MockMvcResultMatchers.jsonPath("$[1].variant_allele").value("G")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].entrez_gene_id").value("7046")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].hugo_gene_symbol").value("TGFBR1")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].sample_id").value("TCGA-AO-A12D-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].amino_acid_change").value("E228V")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].functional_impact_score").value("N")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].xvar_link") .value("getma.org/?cm=var&var=hg19,9,101900249,A,T&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].xvar_link_pdb") .value("getma.org/pdb.php?prot=TGFR1_HUMAN&from=205&to=492&var=E228V")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=TGFR1_HUMAN&rb=205&re=492&var=E228V")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].chr").value("9")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].start_position").value("101900249")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].end_position").value("101900249")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].protein_start_position").value("228")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].protein_end_position").value("228")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].reference_allele").value("A")) .andExpect(MockMvcResultMatchers.jsonPath("$[2].variant_allele").value("T")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].entrez_gene_id").value("7046")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].hugo_gene_symbol").value("TGFBR1")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].sample_id").value("TCGA-BH-A0B5-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].amino_acid_change").value("F396L")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].functional_impact_score").value("M")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].xvar_link") .value("getma.org/?cm=var&var=hg19,9,101908824,C,G&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].xvar_link_pdb") .value("getma.org/pdb.php?prot=TGFR1_HUMAN&from=205&to=492&var=F396L")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=TGFR1_HUMAN&rb=205&re=492&var=F396L")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].chr").value("9")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].start_position").value("101908824")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].end_position").value("101908824")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].protein_start_position").value("396")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].protein_end_position").value("396")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].reference_allele").value("C")) .andExpect(MockMvcResultMatchers.jsonPath("$[3].variant_allele").value("G")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].entrez_gene_id").value("7046")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].hugo_gene_symbol").value("TGFBR1")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].sample_id").value("TCGA-AR-A2LE-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].amino_acid_change").value("R80Q")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].functional_impact_score").value("L")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].xvar_link") .value("getma.org/?cm=var&var=hg19,9,101891278,G,A&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].xvar_link_pdb") .value("getma.org/pdb.php?prot=TGFR1_HUMAN&from=34&to=114&var=R80Q")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=TGFR1_HUMAN&rb=34&re=114&var=R80Q")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].chr").value("9")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].start_position").value("101891278")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].end_position").value("101891278")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].protein_start_position").value("80")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].protein_end_position").value("80")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].reference_allele").value("G")) .andExpect(MockMvcResultMatchers.jsonPath("$[4].variant_allele").value("A")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].entrez_gene_id").value("7046")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].hugo_gene_symbol").value("TGFBR1")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].sample_id").value("TCGA-AC-A23H-01")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].amino_acid_change").value("D400Y")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].functional_impact_score").value("H")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].xvar_link") .value("getma.org/?cm=var&var=hg19,9,101908834,G,T&fts=all")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].xvar_link_pdb") .value("getma.org/pdb.php?prot=TGFR1_HUMAN&from=205&to=492&var=D400Y")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].xvar_link_msa") .value("getma.org/?cm=msa&ty=f&p=TGFR1_HUMAN&rb=205&re=492&var=D400Y")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].chr").value("9")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].start_position").value("101908834")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].end_position").value("101908834")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].protein_start_position").value("400")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].protein_end_position").value("400")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].reference_allele").value("G")) .andExpect(MockMvcResultMatchers.jsonPath("$[5].variant_allele").value("T")) .andExpect(MockMvcResultMatchers.jsonPath("$[0].mutation_event_id").doesNotExist()) .andExpect(MockMvcResultMatchers.jsonPath("$[1].mutation_event_id").doesNotExist()) .andExpect(MockMvcResultMatchers.jsonPath("$[2].mutation_event_id").doesNotExist()) .andExpect(MockMvcResultMatchers.jsonPath("$[3].mutation_event_id").doesNotExist()) .andExpect(MockMvcResultMatchers.jsonPath("$[4].mutation_event_id").doesNotExist()) .andExpect(MockMvcResultMatchers.jsonPath("$[5].mutation_event_id").doesNotExist()); }