gpt4 book ai didi

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

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

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

YamlReader.readWithDependencies介绍

暂无

代码示例

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

@Test
public void appWithAppNameConfigured() throws Exception {
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/pizzaApp.yaml"));
  // THEN
  Map<String, Object> map = (Map<String, Object>) result.getResult();
  assertNotNull("pizzaApp", map.get("name"));
}

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

@Test
public void generateEmptyApp() throws Exception {
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, String> map = (Map<String, String>) result.getResult();
  assertEquals("Pizzas", map.get("label"));
  assertEquals("info.magnolia.ui.contentapp.ContentApp", map.get("appClass"));
}

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

@Test
public void appWithoutAppNameConfiguredUsesContentTypeNameAsAppName() throws Exception {
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/pizzaAppWithoutAppName.yaml"));
  // THEN
  Map<String, Object> map = (Map<String, Object>) result.getResult();
  assertNotNull("pizza", map.get("name"));
}

代码示例来源: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.ui/magnolia-ui-framework-compatibility

@Test
public void overrideAppToChangeOrderViewsAndColumns() throws Exception {
  // GIVEN
  // Register override syntax
  yamlReader.registerCustomConstruct(OverrideSource.TAG, new OverrideSource(null));
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/pizzaAppOverrideOrder.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/browser/workbench/contentViews").keySet(),
      Matchers.contains("list", "tree"));
  assertThat(nestedMapGet(result.getResult(), "subApps/browser/workbench/contentViews/tree/columns").keySet(),
      Matchers.contains("path", "name"));
}

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

@Test
public void detailSubAppIsGeneratedBasedOnModelNodeType() throws Exception {
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, Object> nodeType = nestedMapGet(result.getResult(), "subApps/detail/editor/nodeType");
  assertNotNull(nodeType.get("name"));
  Map<String, Object> contentConnector = nestedMapGet(result.getResult(), "subApps/detail/contentConnector");
  assertNotNull(contentConnector.get("workspace"));
}

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

@Test
public void mgnlContentDetailSubAppIsGeneratedIfModelDoesNotHaveNodeType() throws Exception {
  // GIVEN
  modelDefinition.setNodeType(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, Object> nodeType = nestedMapGet(result.getResult(), "subApps/detail/editor/nodeType");
  assertEquals(NodeTypes.Content.NAME, nodeType.get("name"));
  Map<String, Object> contentConnector = nestedMapGet(result.getResult(), "subApps/detail/contentConnector");
  assertNotNull(contentConnector.get("workspace"));
}

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

@Test
public void nameFieldIsGenerated() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/simpleModelApp.yaml", "!with-type:simpleModel");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/simpleModelApp.yaml"));
  // THEN
  assertEquals(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields").keySet().iterator().next(), "name");
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/name"),
      allOf(
          hasEntry("name", "name"),
          hasEntry("type", "String"),
          hasEntry("fieldType", "text")
      )
  );
}

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

@Test
public void generateSelfReferenceLinkFields() throws Exception {
  // GIVEN apps may have a different name than the content-type they use
  tempFileSystemResourceOrigin.addResource("apps/thinkDifferent.yaml", "!with-type:referenceLinkFields");
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/thinkDifferent.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/lowerCamelCase"), allOf(
      hasEntry("fieldType", "link"),
      hasEntry("appName", "self")
  ));
}

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

@Test
public void detailSubAppIsNotGeneratedIfModelDoesNotHaveProperties() throws Exception {
  // GIVEN
  modelDefinition.setProperties(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, Object> detailSubApp = nestedMapGet(result.getResult(), "subApps/detail");
  assertNull(detailSubApp);
}

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

@Test
public void detailSubAppIsNotGeneratedIsGeneratedIfNoModelIsProvided() throws Exception {
  // GIVEN
  contentTypeDefinition.setModel(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  Map<String, Object> detailSubApp = nestedMapGet(result.getResult(), "subApps/detail");
  assertNull(detailSubApp);
}

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

@Test
public void generateLazyPrefixedCtReferences() throws Exception {
  // GIVEN apps may have a different name than the content-type they use
  tempFileSystemResourceOrigin.addResource("apps/thinkDifferent.yaml", "!with-type:crossReference");
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/thinkDifferent.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/crossReference"), allOf(
      hasEntry("fieldType", "link"),
      hasEntry("appName", "ct:pizza"),
      hasEntry("targetWorkspace", "config")
  ));
}

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

@Test
public void browserSubAppShowsNoActionIfModelDoesNotHaveProperties() throws Exception {
  // GIVEN
  modelDefinition.setProperties(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  assertThatBrowserDoesNotHaveActions(result);
  assertActionBarHasAvailability(result, NODE_TYPE);
  assertContentViews(result);
  assertContentConnectorHasNodeType(result, NODE_TYPE);
}

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

@Test
public void browserSubAppShowsMgnlContentAndNoActionsIfNoModelIsProvided() throws Exception {
  // GIVEN
  contentTypeDefinition.setModel(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  assertThatBrowserDoesNotHaveActions(result);
  assertActionBarHasAvailability(result, NodeTypes.Content.NAME);
  assertContentViews(result);
  assertContentConnectorHasNodeType(result, NodeTypes.Content.NAME);
}

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

@Test
public void subModelNodeTypeDefaultsToMgnlContentNode() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/simpleModelApp.yaml", "!with-type:simpleModel");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/simpleModelApp.yaml"));
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address"),
      hasEntry("nodeType", NodeTypes.ContentNode.NAME)
  );
}

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

@Test
public void browserSubAppShowsMgnContentAndItsActionsIfModelDoesNotHaveNodeType() throws Exception {
  // GIVEN
  modelDefinition.setNodeType(null);
  // WHEN
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath(APP_PATH));
  // THEN
  assertThatBrowserAppHasActions(result, NodeTypes.Content.NAME);
  assertActionBarHasAvailability(result, NodeTypes.Content.NAME);
  assertContentViews(result);
  assertThat(nestedMapGet(result.getResult(), "subApps/browser/contentConnector/nodeTypes").keySet(),
      hasItems(NodeTypes.Folder.NAME, NodeTypes.Content.NAME));
}

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

@Test
public void i18nOnMultiValueField() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/i18nOnMultiValueFieldApp.yaml", "!with-type:i18nOnMultiValueField");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/i18nOnMultiValueFieldApp.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address"),
      hasEntry("i18n", true)
  );
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address/field/fields/street"),
      hasEntry("i18n", false)
  );
}

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

@Test
public void i18nOnCompositeField() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/i18nOnCompositeFieldApp.yaml", "!with-type:i18nOnCompositeField");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/i18nOnCompositeFieldApp.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address"),
      hasEntry("i18n", true)
  );
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address/fields/street"),
      hasEntry("i18n", false)
  );
}

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

@Test
public void i18nOnCompositeFieldAndItsSubField() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/i18nOnCompositeFieldAndItsSubFieldApp.yaml", "!with-type:i18nOnCompositeFieldAndItsSubField");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/i18nOnCompositeFieldAndItsSubFieldApp.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address"),
      hasEntry("i18n", true)
  );
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address/fields/street"),
      hasEntry("i18n", true)
  );
}

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

@Test
public void i18nOnBothMultiFieldAndItsSubField() throws Exception {
  // WHEN
  tempFileSystemResourceOrigin.addResource("apps/i18nOnMultiValueFieldAndItsSubFieldApp.yaml", "!with-type:i18nOnMultiValueFieldAndItsSubField");
  YamlConversionResult result = yamlReader.readWithDependencies(resourceOrigin.getByPath("apps/i18nOnMultiValueFieldAndItsSubFieldApp.yaml"));
  // THEN
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address"),
      hasEntry("i18n", true)
  );
  assertThat(nestedMapGet(result.getResult(), "subApps/detail/editor/form/tabs/default/fields/address/field/fields/street"),
      hasEntry("i18n", true)
  );
}

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