gpt4 book ai didi

info.magnolia.config.source.yaml.YamlReader.()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-17 00:13:31 27 4
gpt4 key购买 nike

本文整理了Java中info.magnolia.config.source.yaml.YamlReader.<init>()方法的一些代码示例,展示了YamlReader.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlReader.<init>()方法的具体详情如下:
包路径:info.magnolia.config.source.yaml.YamlReader
类名称:YamlReader
方法名:<init>

YamlReader.<init>介绍

暂无

代码示例

代码示例来源:origin: info.magnolia.core/magnolia-configuration

public YamlDefinitionDecorator(
    YamlDefinitionDecoratorMetadata metadata,
    DefinitionReferenceIdResolver referenceIdResolver,
    Resource decoratorYamlFile,
    Map2BeanTransformer map2BeanTransformer,
    MagnoliaConfigurationProperties magnoliaConfigurationProperties) {
  this.yamlFile = decoratorYamlFile;
  this.magnoliaConfigurationProperties = magnoliaConfigurationProperties;
  this.yamlReader = new YamlReader();
  this.metadata = metadata;
  this.referenceIdResolver = referenceIdResolver;
  this.map2BeanTransformer = map2BeanTransformer;
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

private Map<String, Object> load(Resource rp) throws IOException {
  final YamlReader yamlReader = new YamlReader();
  return yamlReader.readToMap(rp);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

private YamlConfigurationSource<DummyThing> newDummyYamlSource(String pathPattern, DummyRegistry registry, ResourceOrigin resourceOrigin) throws IOException {
  return new YamlConfigurationSource<>(resourceOrigin, map2BeanTransformer, registry, Pattern.compile(pathPattern), new YamlReader(), magnoliaConfigurationProperties.get(), mock(ModuleRegistry.class));
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Before
public void setUp() throws Exception {
  final ModuleRegistry moduleRegistry = mock(ModuleRegistry.class);
  when(moduleRegistry.getModuleNames()).thenReturn(Sets.newHashSet("info/magnolia/config/source/yaml/samples/decorators/fooModule"));
  this.registry = new DummyRegistry();
  this.resourceOrigin.mountClasspathLocation("info/magnolia/config/source/yaml/samples/decorators", "/foo/decoration");
  MagnoliaConfigurationProperties magnoliaProperties = mock(MagnoliaConfigurationProperties.class);
  YamlConfigurationSource<DummyThing> yamlSource =
      new YamlConfigurationSource<>(mock(ResourceOrigin.class),
          map2BeanTransformer,
          registry,
          Pattern.compile("/(fooModule)/(.*)\\.yaml"),
          new YamlReader(),
          magnoliaProperties,
          mock(ModuleRegistry.class));
  yamlSource.start();
  yamlSource.loadAndRegister(singleResource(foo, "/fooModule/a.yaml", getResource(DEFINITION_RESOURCE).openStream()));
  this.definitionReference = new DefaultDefinitionReference("fooModule", "a", "a");
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Before
public void setup() throws Exception {
  // TODO This isn't nice, is it ? Depending on YamlReader to do its thing, here. But it's so convenient ...
  final InputStream in = getClass().getResourceAsStream("../yaml/samples/withListAndMap.yaml");
  assertNotNull(in);
  map = new YamlReader().readToMap(DummyResourceOrigin.singleResource(foo, "/blah.txt", in));
  assertTrue(map instanceof LinkedHashMap);
  raw = new DefinitionRawViewMapWrapper(map);
  assertThat(raw.properties(), hasSize(9));
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void readerGetsClosed() throws Exception {
  // GIVEN
  final YamlReader yamlReader = new YamlReader();
  final MonitoringReader reader = new MonitoringReader(new StringReader("hello"));
  // WHEN
  final DummyResource dummyResource = newDummyResource("/foo.txt", reader);
  try {
    yamlReader.readNoCast(dummyResource);
  } finally {
    // THEN Just want to make sure we do close the reader... and we do. all good.
    assertTrue(reader.isClosed());
  }
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Test
public void appIsNotGeneratedWhenContentTypeIsNotFound() throws Exception {
  // GIVEN
  ContentTypeRegistry contentTypeRegistry = mock(ContentTypeRegistry.class);
  yamlReader = new YamlReader();
  AppWithContentType appWithContentType = new AppWithContentType(contentTypeRegistry, appDescriptorRegistry, yamlReader, resourceOrigin);
  yamlReader.registerCustomMultiConstruct(AppWithContentType.TAG_PREFIX, appWithContentType);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, String> map = (Map<String, String>) result.getResult();
  assertTrue(map.isEmpty());
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void withCustomMultiConstruct() throws Exception {
  // GIVEN
  YamlReader yamlReader = new YamlReader();
  Construct construct = new DummyConstruct();
  String fileContent = "!tag-prefix:test\nHave a nice day!";
  InputStream stream = new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8));
  Resource resource = DummyResourceOrigin.singleResource(foo, "/anything.yaml", stream);
  // WHEN
  new YamlConfigurationSourceBuilder(null, null, yamlReader, null, null).withCustomMultiConstruct("!tag-prefix:", construct);
  // THEN
  String contentToAssert = (String) yamlReader.read(resource);
  assertEquals("Have a nice day!", contentToAssert);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void withCustomConstruct() throws Exception {
  // GIVEN
  YamlReader yamlReader = new YamlReader();
  Construct construct = new DummyConstruct();
  String fileContent = "!tag\nHave a wonderful day!";
  InputStream stream = new ByteArrayInputStream(fileContent.getBytes(StandardCharsets.UTF_8));
  Resource resource = DummyResourceOrigin.singleResource(foo, "/anything.yaml", stream);
  // WHEN
  new YamlConfigurationSourceBuilder(null, null, yamlReader, null, null).withCustomConstruct("!tag", construct);
  // THEN
  String contentToAssert = (String) yamlReader.read(resource);
  assertEquals("Have a wonderful day!", contentToAssert);
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Test
public void mapOfSimpleTypesWithNonStringKeys() throws Exception {
  final InputStream in = getClass().getResourceAsStream("../yaml/samples/withMapDigitKeys.yaml");
  map = new YamlReader().readToMap(DummyResourceOrigin.singleResource(foo, "/blah.txt", in));
  raw = new DefinitionRawViewMapWrapper(map);
  final DefinitionRawView.Property p = raw.properties().get(1);
  assertNotNull(p);
  final DefinitionRawView m = assertSubBean(p, "someOtherStrings");
  assertThat(m.properties(), allOf(
      is(not(nullValue())),
      hasSize(6)
  ));
  assertSimple(m, 0, "d0", "d-zero");
  assertSimple(m, 1, "0", "Key ZERO");
  assertSimple(m, 2, "00", "zero-zero");
  assertSimple(m, 3, "01", "zero-one");
  assertSimple(m, 4, "1", "Key ONE");
  assertSimple(m, 5, "2", "Key TWO");
}

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

@Before
public void setUp() throws Exception {
  tempFileSystemResourceOrigin.mountClasspathLocation("fooModule", "");
  resourceOrigin = tempFileSystemResourceOrigin.get();
  ComponentsTestUtil.setImplementation(ContentTypeDefinition.class, ConfiguredContentTypeDefinition.class);
  ComponentsTestUtil.setImplementation(DataSourceDefinition.class, ConfiguredJcrDataSourceDefinition.class);
  ComponentsTestUtil.setImplementation(ModelDefinition.class, ConfiguredJcrModelDefinition.class);
  ComponentsTestUtil.setImplementation(SubModelDefinition.class, ConfiguredJcrSubModelDefinition.class);
  ComponentsTestUtil.setImplementation(PropertyDefinition.class, ConfiguredPropertyDefinition.class);
  moduleRegistry = mock(ModuleRegistry.class);
  appDescriptorRegistry = mock(AppDescriptorRegistry.class);
  eventBus = mock(EventBus.class);
  contentTypeRegistry = new ContentTypeRegistry(moduleRegistry, eventBus);
  yamlReader = new YamlReader();
  AppWithContentType appWithContentType = new AppWithContentType(contentTypeRegistry, appDescriptorRegistry, yamlReader, resourceOrigin);
  yamlReader.registerCustomMultiConstruct(AppWithContentType.TAG_PREFIX, appWithContentType);
  map2BeanTransformer = new Map2BeanTransformer(Components.getComponentProvider(), new TypeMappingImpl(), new PreConfiguredBeanUtils(), new BeanTypeResolver());
  magnoliaProperties = mock(MagnoliaConfigurationProperties.class);
  YamlConfigurationSource<ContentTypeDefinition> contentTypesYamlSource =
      new YamlConfigurationSource<>(resourceOrigin,
          map2BeanTransformer,
          contentTypeRegistry,
          Pattern.compile("/contentTypes/(.*)\\.yaml"),
          new YamlReader(),
          magnoliaProperties,
          moduleRegistry);
  contentTypesYamlSource.start();
  contentTypeDefinition = (ConfiguredContentTypeDefinition) contentTypeRegistry.getProvider("pizza").get();
  modelDefinition = (ConfiguredJcrModelDefinition) contentTypeDefinition.getModel();
}

代码示例来源:origin: info.magnolia.core/magnolia-configuration

@Before
public void setUp() throws Exception {
  Map2BeanTransformer map2BeanTransformer = new Map2BeanTransformer(new MockComponentProvider(), new TypeMappingImpl(), new PreConfiguredBeanUtils());
  YamlReader yamlReader = new YamlReader();
  dummyRegistry = new DummyRegistry();
  ModuleRegistry moduleRegistry = mock(ModuleRegistry.class);

代码示例来源:origin: info.magnolia.core/magnolia-configuration

registry,
Pattern.compile("/(fooModule)/(.*)\\.yaml"),
new YamlReader(),
magnoliaConfigurationProperties.get(),
moduleRegistry);

代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility

i18n = mock(SimpleTranslator.class);
yamlReader = new YamlReader();

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com