com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider Java Examples
The following examples show how to use
com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestUtils.java From chipster with MIT License | 6 votes |
public static ResourceConfig getResourceConfig() { ResourceConfig rc = new ResourceConfig() /* * Disable auto discovery so that we can decide what we want to register and * what not. Don't register JacksonFeature, because it will register * JacksonMappingExceptionMapper, which annoyingly swallows response's * JsonMappingExceptions. Register directly the JacksonJaxbJsonProvider which is * enough for the actual JSON conversion (see the code of JacksonFeature). */ .property(CommonProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true).register(JacksonJaxbJsonProvider.class) // .register(JavaTimeObjectMapperProvider.class) // // register all exception mappers // .packages(NotFoundExceptionMapper.class.getPackage().getName()) // // enable the RolesAllowed annotation // .register(RolesAllowedDynamicFeature.class) .register(JsonPrettyPrintQueryParamContainerResponseFilter.class); return rc; }
Example #2
Source File: JacksonFeature.java From micro-server with Apache License 2.0 | 6 votes |
@Override public boolean configure(final FeatureContext context) { PluginLoader.INSTANCE.plugins.get().stream() .filter(module -> module.jacksonFeatureProperties()!=null) .map(Plugin::jacksonFeatureProperties) .map(fn->fn.apply(context)) .forEach(map -> { addAll(map,context); }); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(JacksonUtil.getMapper()); context.register(provider, new Class[]{MessageBodyReader.class, MessageBodyWriter.class}); return true; }
Example #3
Source File: UploadArtifactsTest.java From archiva with Apache License 2.0 | 6 votes |
private FileUploadService getUploadService() { FileUploadService service = JAXRSClientFactory.create(getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/", FileUploadService.class, Collections.singletonList(new JacksonJaxbJsonProvider())); log.debug("Service class {}", service.getClass().getName()); WebClient.client(service).header("Authorization", authorizationHeader); WebClient.client(service).header("Referer", "http://localhost:" + getServerPort()); WebClient.client(service).header("Referer", "http://localhost"); WebClient.getConfig(service).getRequestContext().put(Message.MAINTAIN_SESSION, true); WebClient.getConfig(service).getRequestContext().put(Message.EXCEPTION_MESSAGE_CAUSE_ENABLED, true); WebClient.getConfig(service).getRequestContext().put(Message.FAULT_STACKTRACE_ENABLED, true); WebClient.getConfig(service).getRequestContext().put(Message.PROPOGATE_EXCEPTION, true); WebClient.getConfig(service).getRequestContext().put("org.apache.cxf.transport.no_io_exceptions", true); // WebClient.client( service ). return service; }
Example #4
Source File: RuntimeInfoServiceTest.java From archiva with Apache License 2.0 | 6 votes |
@Test public void runtimeInfoService() throws Exception { RuntimeInfoService service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaUiServices/", RuntimeInfoService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client(service).header("Referer","http://localhost"); ApplicationRuntimeInfo applicationRuntimeInfo = service.getApplicationRuntimeInfo( "en" ); assertEquals( System.getProperty( "expectedVersion" ), applicationRuntimeInfo.getVersion() ); assertFalse( applicationRuntimeInfo.isJavascriptLog() ); assertTrue( applicationRuntimeInfo.isLogMissingI18n() ); }
Example #5
Source File: RowResourceBase.java From hbase with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUpBeforeClass() throws Exception { conf = TEST_UTIL.getConfiguration(); TEST_UTIL.startMiniCluster(3); REST_TEST_UTIL.startServletContainer(conf); context = JAXBContext.newInstance( CellModel.class, CellSetModel.class, RowModel.class); xmlMarshaller = context.createMarshaller(); xmlUnmarshaller = context.createUnmarshaller(); jsonMapper = new JacksonJaxbJsonProvider() .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())); }
Example #6
Source File: TestTableScan.java From hbase with Apache License 2.0 | 6 votes |
@Test public void testScanningUnknownColumnJson() throws IOException { // Test scanning particular columns with limit. StringBuilder builder = new StringBuilder(); builder.append("/*"); builder.append("?"); builder.append(Constants.SCAN_COLUMN + "=a:test"); Response response = client.get("/" + TABLE + builder.toString(), Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); CellSetModel model = mapper.readValue(response.getStream(), CellSetModel.class); int count = TestScannerResource.countCellSet(model); assertEquals(0, count); }
Example #7
Source File: AbstractDownloadTest.java From archiva with Apache License 2.0 | 6 votes |
protected RoleManagementService getRoleManagementService( String authzHeader ) { RoleManagementService service = JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/", RoleManagementService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Referer", "http://localhost:" + port ); // for debuging purpose WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L ); if ( authzHeader != null ) { WebClient.client( service ).header( "Authorization", authzHeader ); } return service; }
Example #8
Source File: AbstractDownloadTest.java From archiva with Apache License 2.0 | 6 votes |
protected UserService getUserService( String authzHeader ) { UserService service = JAXRSClientFactory.create( "http://localhost:" + port + "/" + getRestServicesPath() + "/redbackServices/", UserService.class, Collections.singletonList( new JacksonJaxbJsonProvider() ) ); WebClient.client( service ).header( "Referer", "http://localhost:" + port ); // for debuging purpose WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 3000000L ); if ( authzHeader != null ) { WebClient.client( service ).header( "Authorization", authzHeader ); } return service; }
Example #9
Source File: TestNamespacesInstanceResource.java From hbase with Apache License 2.0 | 6 votes |
@BeforeClass public static void setUpBeforeClass() throws Exception { conf = TEST_UTIL.getConfiguration(); TEST_UTIL.startMiniCluster(); REST_TEST_UTIL.startServletContainer(conf); client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort())); testNamespacesInstanceModel = new TestNamespacesInstanceModel(); context = JAXBContext.newInstance(NamespacesInstanceModel.class, TableListModel.class); jsonMapper = new JacksonJaxbJsonProvider() .locateMapper(NamespacesInstanceModel.class, MediaType.APPLICATION_JSON_TYPE); NAMESPACE1_PROPS.put("key1", "value1"); NAMESPACE2_PROPS.put("key2a", "value2a"); NAMESPACE2_PROPS.put("key2b", "value2b"); NAMESPACE3_PROPS.put("key3", "value3"); NAMESPACE4_PROPS.put("key4a", "value4a"); NAMESPACE4_PROPS.put("key4b", "value4b"); }
Example #10
Source File: TestMultiMaster.java From dremio-oss with Apache License 2.0 | 6 votes |
private static Client newClient() { JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); ObjectMapper objectMapper = JSONUtil.prettyMapper(); JSONUtil.registerStorageTypes(objectMapper, DremioTest.CLASSPATH_SCAN_RESULT, ConnectionReader.of(DremioTest.CLASSPATH_SCAN_RESULT, DremioTest.DEFAULT_SABOT_CONFIG)); objectMapper.registerModule( new SimpleModule() .addDeserializer(JobDataFragment.class, new JsonDeserializer<JobDataFragment>() { @Override public JobDataFragment deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { return jsonParser.readValueAs(DataPOJO.class); } } ) ); provider.setMapper(objectMapper); return ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build(); }
Example #11
Source File: TestMasterDown.java From dremio-oss with Apache License 2.0 | 6 votes |
private static void initMasterClient() { JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); ObjectMapper objectMapper = JSONUtil.prettyMapper(); JSONUtil.registerStorageTypes(objectMapper, DremioTest.CLASSPATH_SCAN_RESULT, ConnectionReader.of(DremioTest.CLASSPATH_SCAN_RESULT, DremioTest.DEFAULT_SABOT_CONFIG)); objectMapper.registerModule( new SimpleModule() .addDeserializer(JobDataFragment.class, new JsonDeserializer<JobDataFragment>() { @Override public JobDataFragment deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { return jsonParser.readValueAs(DataPOJO.class); } } ) ); provider.setMapper(objectMapper); masterClient = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build(); WebTarget rootTarget = masterClient.target("http://localhost:" + masterDremioDaemon.getWebServer().getPort()); masterApiV2 = rootTarget.path(API_LOCATION); }
Example #12
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 6 votes |
protected ArchivaAdministrationService getArchivaAdministrationService() { ArchivaAdministrationService service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", ArchivaAdministrationService.class, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).header( "Authorization", authorizationHeader ); WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); return service; }
Example #13
Source File: TestMultiRowResource.java From hbase with Apache License 2.0 | 6 votes |
@Test public void testMultiCellGetJSONNotFound() throws IOException { String row_5_url = "/" + TABLE + "/" + ROW_1 + "/" + COLUMN_1; StringBuilder path = new StringBuilder(); path.append("/"); path.append(TABLE); path.append("/multiget/?row="); path.append(ROW_1); path.append("&row="); path.append(ROW_2); client.post(row_5_url, Constants.MIMETYPE_BINARY, Bytes.toBytes(VALUE_1), extraHdr); Response response = client.get(path.toString(), Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); CellSetModel cellSet = (CellSetModel) mapper.readValue(response.getBody(), CellSetModel.class); assertEquals(1, cellSet.getRows().size()); assertEquals(ROW_1, Bytes.toString(cellSet.getRows().get(0).getKey())); assertEquals(VALUE_1, Bytes.toString(cellSet.getRows().get(0).getCells().get(0).getValue())); client.delete(row_5_url, extraHdr); }
Example #14
Source File: TestUIServer.java From dremio-oss with Apache License 2.0 | 6 votes |
@BeforeClass public static void init() throws Exception { try (TimedBlock b = Timer.time("TestUIServer.@BeforeClass")) { dremioDaemon = DACDaemon.newDremioDaemon( DACConfig .newDebugConfig(DremioTest.DEFAULT_SABOT_CONFIG) .autoPort(true) .allowTestApis(true) .writePath(folder.getRoot().getAbsolutePath()) .clusterMode(ClusterMode.LOCAL) .serveUI(true), DremioTest.CLASSPATH_SCAN_RESULT); dremioDaemon.init(); JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(JSONUtil.prettyMapper()); client = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build(); rootTarget = client.target("http://localhost:" + dremioDaemon.getWebServer().getPort()); } }
Example #15
Source File: WebClient.java From dremio-oss with Apache License 2.0 | 6 votes |
private WebTarget getWebClient( DACConfig dacConfig) throws IOException, GeneralSecurityException { final JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(JSONUtil.prettyMapper()); ClientBuilder clientBuilder = ClientBuilder.newBuilder() .register(provider) .register(MultiPartFeature.class); if (dacConfig.webSSLEnabled()) { this.setTrustStore(clientBuilder, dacConfig); } final Client client = clientBuilder.build(); return client.target(format("%s://%s:%d", dacConfig.webSSLEnabled() ? "https" : "http", dacConfig.thisNode, dacConfig.getHttpPort())).path("apiv2"); }
Example #16
Source File: TestMasterDown.java From dremio-oss with Apache License 2.0 | 6 votes |
private static void initClient() { JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); ObjectMapper objectMapper = JSONUtil.prettyMapper(); JSONUtil.registerStorageTypes(objectMapper, DremioTest.CLASSPATH_SCAN_RESULT, ConnectionReader.of(DremioTest.CLASSPATH_SCAN_RESULT, DremioTest.DEFAULT_SABOT_CONFIG)); objectMapper.registerModule( new SimpleModule() .addDeserializer(JobDataFragment.class, new JsonDeserializer<JobDataFragment>() { @Override public JobDataFragment deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { return jsonParser.readValueAs(DataPOJO.class); } } ) ); provider.setMapper(objectMapper); client = ClientBuilder.newBuilder().register(provider).register(MultiPartFeature.class).build(); WebTarget rootTarget = client.target("http://localhost:" + currentDremioDaemon.getWebServer().getPort()); currentApiV2 = rootTarget.path(API_LOCATION); }
Example #17
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 6 votes |
protected CommonServices getCommonServices( String authzHeader ) { CommonServices service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", CommonServices.class, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); if ( authzHeader != null ) { WebClient.client( service ).header( "Authorization", authzHeader ); } WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); return service; }
Example #18
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 6 votes |
protected SearchService getSearchService( String authzHeader ) { // START SNIPPET: cxf-searchservice-creation SearchService service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", SearchService.class, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); // to add authentification if ( authzHeader != null ) { WebClient.client( service ).header( "Authorization", authzHeader ); } // Set the Referer header to your archiva server url WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); // to configure read timeout WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); // if you want to use json as exchange format xml is supported too WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); return service; // END SNIPPET: cxf-searchservice-creation }
Example #19
Source File: RowResourceBase.java From hbase with Apache License 2.0 | 5 votes |
protected static void checkValueJSON(String table, String row, String column, String value) throws IOException { Response response = getValueJson(table, row, column); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider().locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class); RowModel rowModel = cellSet.getRows().get(0); CellModel cell = rowModel.getCells().get(0); assertEquals(Bytes.toString(cell.getColumn()), column); assertEquals(Bytes.toString(cell.getValue()), value); }
Example #20
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 5 votes |
protected ProxyConnectorService getProxyConnectorService() { ProxyConnectorService service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", ProxyConnectorService.class, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); return service; }
Example #21
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 5 votes |
protected <T> T getService( Class<T> clazz, String authzHeader ) { T service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", clazz, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); if ( authzHeader != null ) { WebClient.client( service ).header( "Authorization", authzHeader ); } WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 100000000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); return service; }
Example #22
Source File: AbstractArchivaRestTest.java From archiva with Apache License 2.0 | 5 votes |
protected NetworkProxyService getNetworkProxyService() { NetworkProxyService service = JAXRSClientFactory.create( getBaseUrl() + "/" + getRestServicesPath() + "/archivaServices/", NetworkProxyService.class, Arrays.asList( new JacksonJaxbJsonProvider( ), new JacksonJaxbXMLProvider( ) ) ); WebClient.client( service ).header( "Authorization", authorizationHeader ); WebClient.client(service).header("Referer","http://localhost:"+getServerPort()); WebClient.getConfig( service ).getHttpConduit().getClient().setReceiveTimeout( 300000 ); WebClient.client( service ).accept( MediaType.APPLICATION_JSON_TYPE ); WebClient.client( service ).type( MediaType.APPLICATION_JSON_TYPE ); return service; }
Example #23
Source File: TestModelBase.java From hbase with Apache License 2.0 | 5 votes |
protected TestModelBase(Class<?> clazz) throws Exception { super(); this.clazz = clazz; context = new JAXBContextResolver().getContext(clazz); mapper = new JacksonJaxbJsonProvider().locateMapper(clazz, MediaType.APPLICATION_JSON_TYPE); }
Example #24
Source File: BookServer20.java From cxf with Apache License 2.0 | 5 votes |
protected void run() { Bus bus = BusFactory.getDefaultBus(); setBus(bus); JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean(); sf.setBus(bus); sf.setResourceClasses(BookStore.class); List<Object> providers = new ArrayList<>(); providers.add(new PreMatchContainerRequestFilter2()); providers.add(new PreMatchContainerRequestFilter()); providers.add(new PostMatchContainerResponseFilter()); providers.add((Feature) context -> { context.register(new PostMatchContainerResponseFilter3()); return true; }); providers.add(new PostMatchContainerResponseFilter2()); providers.add(new CustomReaderBoundInterceptor()); providers.add(new CustomReaderInterceptor()); providers.add(new CustomWriterInterceptor()); providers.add(new CustomDynamicFeature()); providers.add(new PostMatchContainerRequestFilter()); providers.add(new FaultyContainerRequestFilter()); providers.add(new PreMatchReplaceStreamOrAddress()); providers.add(new ServerTestFeature()); providers.add(new JacksonJaxbJsonProvider()); providers.add(new IOExceptionMapper()); sf.setApplication(new Application()); sf.setProviders(providers); sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true)); sf.setAddress("http://localhost:" + PORT + "/"); server = sf.create(); BusFactory.setDefaultBus(null); BusFactory.setThreadDefaultBus(null); }
Example #25
Source File: RestPlugin.java From seed with Mozilla Public License 2.0 | 5 votes |
private void addJacksonProviders(Collection<Class<?>> providers) { providers.add(JsonMappingExceptionMapper.class); providers.add(JsonParseExceptionMapper.class); if (Classes.optional("javax.xml.bind.JAXBElement").isPresent()) { LOGGER.debug("JSON/XML support is enabled"); providers.add(JacksonJaxbJsonProvider.class); } else { LOGGER.debug("JSON support is enabled"); providers.add(JacksonJsonProvider.class); } }
Example #26
Source File: RowResourceBase.java From hbase with Apache License 2.0 | 5 votes |
protected static void checkIncrementValueJSON(String table, String row, String column, long value) throws IOException { Response response = getValueJson(table, row, column); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider() .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); CellSetModel cellSet = mapper.readValue(response.getBody(), CellSetModel.class); RowModel rowModel = cellSet.getRows().get(0); CellModel cell = rowModel.getCells().get(0); assertEquals(Bytes.toString(cell.getColumn()), column); assertEquals(Bytes.toLong(cell.getValue()), value); }
Example #27
Source File: ShopifySdk.java From shopify-sdk with Apache License 2.0 | 5 votes |
private static Client buildClient() { final ObjectMapper mapper = ShopifySdkObjectMapper.buildMapper(); final JacksonJaxbJsonProvider provider = new JacksonJaxbJsonProvider(); provider.setMapper(mapper); return ClientBuilder.newClient().register(JacksonFeature.class).register(provider); }
Example #28
Source File: TestTableScan.java From hbase with Apache License 2.0 | 5 votes |
@Test public void testColumnWithEmptyQualifier() throws IOException { // Test scanning with empty qualifier StringBuilder builder = new StringBuilder(); builder.append("/*"); builder.append("?"); builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_EMPTY); Response response = client.get("/" + TABLE + builder.toString(), Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider() .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); CellSetModel model = mapper.readValue(response.getStream(), CellSetModel.class); int count = TestScannerResource.countCellSet(model); assertEquals(expectedRows3, count); checkRowsNotNull(model); RowModel startRow = model.getRows().get(0); assertEquals("aaa", Bytes.toString(startRow.getKey())); assertEquals(1, startRow.getCells().size()); // Test scanning with empty qualifier and normal qualifier builder = new StringBuilder(); builder.append("/*"); builder.append("?"); builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_1); builder.append("&"); builder.append(Constants.SCAN_COLUMN + "=" + COLUMN_EMPTY); response = client.get("/" + TABLE + builder.toString(), Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); mapper = new JacksonJaxbJsonProvider() .locateMapper(CellSetModel.class, MediaType.APPLICATION_JSON_TYPE); model = mapper.readValue(response.getStream(), CellSetModel.class); count = TestScannerResource.countCellSet(model); assertEquals(expectedRows1 + expectedRows3, count); checkRowsNotNull(model); }
Example #29
Source File: TestVersionResource.java From hbase with Apache License 2.0 | 5 votes |
@Test public void testGetStorageClusterVersionJSON() throws IOException { Response response = client.get("/version/cluster", Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider() .locateMapper(StorageClusterVersionModel.class, MediaType.APPLICATION_JSON_TYPE); StorageClusterVersionModel clusterVersionModel = mapper.readValue(response.getBody(), StorageClusterVersionModel.class); assertNotNull(clusterVersionModel); assertNotNull(clusterVersionModel.getVersion()); LOG.info("success retrieving storage cluster version as JSON"); }
Example #30
Source File: TestVersionResource.java From hbase with Apache License 2.0 | 5 votes |
@Test public void testGetStargateVersionJSON() throws IOException { Response response = client.get("/version", Constants.MIMETYPE_JSON); assertEquals(200, response.getCode()); assertEquals(Constants.MIMETYPE_JSON, response.getHeader("content-type")); ObjectMapper mapper = new JacksonJaxbJsonProvider() .locateMapper(VersionModel.class, MediaType.APPLICATION_JSON_TYPE); VersionModel model = mapper.readValue(response.getBody(), VersionModel.class); validate(model); LOG.info("success retrieving Stargate version as JSON"); }