use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader in project azure-tools-for-java by Microsoft.
the class AzureSdkLibraryService method loadSpringSDKEntities.
public static List<AzureSdkServiceEntity> loadSpringSDKEntities(final URL destination) {
try {
final ObjectReader reader = YML_MAPPER.readerFor(AzureSdkServiceEntity.class);
final MappingIterator<AzureSdkServiceEntity> data = reader.readValues(destination);
return data.readAll();
} catch (final IOException e) {
log.warn(String.format("failed to load Azure SDK list from \"%s\"", destination.toString()), e);
}
return Collections.emptyList();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader in project azure-tools-for-java by Microsoft.
the class AzureSdkLibraryService method loadAzureSDKWhitelist.
@Cacheable("sdk/packages/whitelist")
@AzureOperation(name = "sdk.load_meta_data.whitelist", type = AzureOperation.Type.TASK)
private static Set<String> loadAzureSDKWhitelist() {
try {
final URL destination = AzureSdkLibraryService.class.getResource(SDK_ALLOW_LIST_CSV);
final ObjectReader reader = CSV_MAPPER.readerFor(AzureSdkAllowListEntity.class).with(CsvSchema.emptySchema().withHeader());
final MappingIterator<AzureSdkAllowListEntity> data = reader.readValues(destination);
return data.readAll().stream().filter(e -> StringUtils.isNoneBlank(e.getArtifactId(), e.getGroupId())).map(AzureSdkAllowListEntity::getPackageName).collect(Collectors.toSet());
} catch (final IOException e) {
log.warn(String.format("failed to load Azure SDK allow list from \"%s\"", SDK_ALLOW_LIST_CSV), e);
}
return Collections.emptySet();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader in project azure-tools-for-java by Microsoft.
the class AzureSdkLibraryService method loadAzureSDKEntities.
public static List<AzureJavaSdkEntity> loadAzureSDKEntities(final URL destination) {
try {
final ObjectReader reader = CSV_MAPPER.readerFor(AzureJavaSdkEntity.class).with(CsvSchema.emptySchema().withHeader());
final MappingIterator<AzureJavaSdkEntity> data = reader.readValues(destination);
return data.readAll().stream().filter(e -> StringUtils.isNoneBlank(e.getArtifactId(), e.getGroupId())).collect(Collectors.toList());
} catch (final IOException e) {
log.warn(String.format("failed to load Azure SDK list from \"%s\"", destination.toString()), e);
}
return Collections.emptyList();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader in project pinpoint by naver.
the class ObjectMapperIT method testReadValue.
@Test
public void testReadValue() throws Exception {
String json_str = "{\"name\" : \"Jackson\"}";
byte[] json_b = json_str.getBytes(UTF_8);
mapper.readValue(json_str, __POJO.class);
mapper.readValue(json_b, __POJO.class);
ObjectReader reader = mapper.reader(__POJO.class);
reader.readValue(json_str);
reader.readValue(json_b);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method mapperReadValueString = ObjectMapper.class.getMethod("readValue", String.class, Class.class);
Method mapperReadValueBytes = ObjectMapper.class.getMethod("readValue", byte[].class, Class.class);
Method readerReadValueString = ObjectReader.class.getMethod("readValue", String.class);
Method readerReadValueBytes = ObjectReader.class.getMethod("readValue", byte[].class);
verifier.verifyTrace(event(SERVICE_TYPE, mapperReadValueString, annotation(ANNOTATION_KEY, json_str.length())));
verifier.verifyTrace(event(SERVICE_TYPE, mapperReadValueBytes, annotation(ANNOTATION_KEY, json_b.length)));
verifier.verifyTrace(event(SERVICE_TYPE, readerReadValueString, annotation(ANNOTATION_KEY, json_str.length())));
verifier.verifyTrace(event(SERVICE_TYPE, readerReadValueBytes, annotation(ANNOTATION_KEY, json_b.length)));
verifier.verifyTraceCount(0);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectReader in project pinpoint by naver.
the class ObjectReaderJDK7IT method testReadValue.
@Test
public void testReadValue() throws Exception {
String json_str = "{\"name\" : \"Jackson\"}";
byte[] json_b = json_str.getBytes(UTF_8);
@SuppressWarnings("deprecation") ObjectReader reader = mapper.reader(__POJO.class);
__POJO pojo = reader.readValue(json_str);
pojo = reader.readValue(json_b);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
Method readval1 = ObjectReader.class.getMethod("readValue", String.class);
Method readval2 = ObjectReader.class.getMethod("readValue", byte[].class);
verifier.verifyTrace(event("JACKSON", readval1, Expectations.annotation("jackson.json.length", json_str.length())));
verifier.verifyTrace(event("JACKSON", readval2, Expectations.annotation("jackson.json.length", json_b.length)));
verifier.verifyTraceCount(0);
}
Aggregations