You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2021/04/15 10:13:16 UTC
[brooklyn-server] 01/03: test for description containing multi-line
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 5d06cf02235f12d1349551ff2eb5553c39000f94
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Apr 12 18:58:21 2021 +0100
test for description containing multi-line
---
.../CatalogYamlEntityOsgiTypeRegistryTest.java | 27 +++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityOsgiTypeRegistryTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityOsgiTypeRegistryTest.java
index 679c18a..7aa4a6a 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityOsgiTypeRegistryTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityOsgiTypeRegistryTest.java
@@ -27,6 +27,7 @@ import org.apache.brooklyn.entity.stock.BasicEntity;
import org.apache.brooklyn.test.Asserts;
import org.apache.brooklyn.util.collections.CollectionFunctionals;
import org.apache.brooklyn.util.osgi.VersionedName;
+import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
import org.apache.brooklyn.util.yaml.Yamls;
import org.testng.annotations.Test;
@@ -185,7 +186,31 @@ public class CatalogYamlEntityOsgiTypeRegistryTest extends CatalogYamlEntityTest
deleteCatalogRegisteredType(symbolicName);
}
-
+
+ @Test
+ public void testAddCatalogItemWithNewLinesInTagAndDescription() throws Exception {
+ String symbolicName = "my.catalog.app.id.load";
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + symbolicName,
+ " version: " + TEST_VERSION,
+ " description: \"new-\\nline\"",
+ " tags:",
+ " - description.md: |",
+ " Line 1",
+ " Line **2**",
+ " itemType: entity",
+ " item: " + BasicEntity.class.getName());
+
+ RegisteredType item = mgmt().getTypeRegistry().get(symbolicName, TEST_VERSION);
+ Asserts.assertEquals(item.getDescription(), "new-\nline");
+ Object docTag = item.getTags().stream().filter(x -> x instanceof Map && ((Map) x).containsKey("description.md")).findFirst().orElse(null);
+ Asserts.assertEquals(((Map) docTag).get("description.md"), "Line 1\nLine **2**\n");
+
+ deleteCatalogRegisteredType(symbolicName);
+ }
+
+
// also runs many other tests from super, here using the osgi/type-registry appraoch
@Test