diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.clirr-jenkins-ignore.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.clirr-jenkins-ignore.xml new file mode 100644 index 0000000000000000000000000000000000000000..2bfa1a887573cd337ec387d9fb14af2edcbf17bf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.clirr-jenkins-ignore.xml @@ -0,0 +1,20 @@ + + + + ** + 5000 + ** + + + + ** + 7012 + * + + + + ** + 7013 + * + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.gitignore b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d4e8132a12f8c24783e62d0d740eb078b9e16a0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/.gitignore @@ -0,0 +1,20 @@ +.idea +target +.classpath +.project +.settings +build.properties +bin +.metadata +transaction.log +nbactions*.xml +nb-configuration.xml +/webapps/fox-platform-tasklist/server-work +dependency-reduced-pom.xml +faces-config.NavData +dependency-reduced-pom.xml +*.iml +*.sublime-project +*.sublime-workspace +*.swp + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/README.md b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/README.md new file mode 100644 index 0000000000000000000000000000000000000000..316bc82b0e3b0d73ac55f0144c36dfc9c2a24a49 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/README.md @@ -0,0 +1,80 @@ +camunda-spin +============ + +

+ Home | + Documentation | + Forum | + Issues | + License | + Contribute +

+ +Library for simple XML and JSON processing on the JVM (Java Virtual Machine), targeting Java and +JVM-based scripting languages such as Groovy, JRuby, Jython, Javascript and Java Expression +Language. + +# Why Spin? + +Spin is useful when you need to work with complex, text-based data formats (such as XML or JSON) +without mapping to Java Objects. + +Spin provides a comprehensible fluent API for working with different data formats through +lightweight wrapper objects: + +Given the following XML document as `String` or `InputStream`: + +```xml + + + Jonny P + Bobby G + Mary T + +``` + +It can directly be worked on with Spin: + +```java +import static org.camunda.spin.Spin.*; + +// get id of first customer +XML( xmlInput ).childElements("customer") + .get(0) + .attr("id") + .value(); + +// create new customer +SpinXmlTreeElement kate = XML( "" ) + .attr("id", "0004") + .append( XML("Kate S") ); + +// append to existing list +XML( xmlInput ).append(kate); + +// query by Id: +XML( xmlInput ).xPath("/customers/customer[@id='0002']").element(); +``` + + +# FAQ + +## Why should I use Spin instead of the Java DOM API? + +Java provides a built-in Dom API along with a Parser. Spin provides a lightweight Wrapper around +the Dom API which makes it easier to work with than the Dom API. You can access the underlying Dom object +at any time by unwrapping it: + +```java +Element e = XML( xmlSource ).childElement("customer").unwrap(); +``` + + +# Contributing + +Have a look at our [contribution guide](https://github.com/camunda/camunda-bpm-platform/blob/master/CONTRIBUTING.md) for how to contribute to this repository. + + +# License: + +The source files in this repository are made available under the [Apache License Version 2.0](../LICENSE). diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/bom/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/bom/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..cab3e0af0e6ed7a9ffc3ec81414f97ca4fd90866 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/bom/pom.xml @@ -0,0 +1,91 @@ + + 4.0.0 + + + + org.camunda.bpm + camunda-root + 7.24.0-SNAPSHOT + ../../pom.xml + + + org.camunda.spin + camunda-spin-bom + camunda spin - bom + 7.24.0-SNAPSHOT + pom + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + + + + org.camunda.spin + camunda-spin-core + ${project.version} + + + + org.camunda.spin + camunda-spin-core + test-jar + ${project.version} + + + + org.camunda.spin + camunda-spin-dataformat-all + ${project.version} + + + + org.camunda.spin + camunda-spin-dataformat-json-jackson + + + org.camunda.spin + camunda-spin-dataformat-xml-dom + + + jakarta.xml.bind + jakarta.xml.bind-api + + + com.sun.xml.bind + jaxb-impl + + + + + + org.camunda.spin + camunda-spin-dataformat-json-jackson + ${project.version} + + + + org.camunda.spin + camunda-spin-dataformat-xml-dom + ${project.version} + + + + org.camunda.spin + camunda-spin-dataformat-xml-dom-jakarta + ${project.version} + + + + + + https://github.com/camunda/camunda-bpm-platform + scm:git:git@github.com:camunda/camunda-bpm-platform.git + scm:git:git@github.com:camunda/camunda-bpm-platform.git + HEAD + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..b2713865047c80e5b00382b85fdbf722ac408e17 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/pom.xml @@ -0,0 +1,269 @@ + + 4.0.0 + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + org.camunda.spin + camunda-spin-root + 7.24.0-SNAPSHOT + + + camunda-spin-core + camunda Spin - core + + + + + org.camunda.commons + camunda-commons-logging + + + + org.camunda.commons + camunda-commons-utils + + + + junit + junit + provided + + + + org.assertj + assertj-core + test + + + + org.apache.groovy + groovy-jsr223 + test + + + + org.python + jython + test + + + + org.jruby + jruby-complete + test + + + + org.graalvm.js + js + test + + + + org.graalvm.js + js-scriptengine + test + + + + + ch.qos.logback + logback-classic + test + + + + net.javacrumbs.json-unit + json-unit-fluent + test + + + + org.powermock + powermock-module-junit4 + test + + + org.powermock + powermock-api-mockito2 + test + + + + + + + disable-javascript-tests + + (,1.8) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -XX:PermSize=128m + + **/javascript/** + + + + + + + + + jdk-9-and-onwards + + [9,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -XX:PermSize=128m + + **/DataFormatLoadingTest.java + + + + + + + + jdk-15-and-onwards + + [15,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*NashornTest.java + + + + + + + + + jdk-16-and-onwards + + [16,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -XX:MetaspaceSize=128m + + + **/*NashornTest.java + + + + + + + + + + check-api-compatibility + + (,) + + + + + org.codehaus.mojo + clirr-maven-plugin + 2.8 + + ${spin.version.old} + true + + org/camunda/spin/impl/** + + + + + all + verify + + check-no-fork + + + ${project.build.directory}/clirr-all.txt + false + false + + + + restrictive + verify + + check-no-fork + + + ${project.build.directory}/clirr-restrictive.txt + true + ../.clirr-jenkins-ignore.xml + + + + + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + + org.junit*;resolution:=optional, + * + + + + + + bundle-manifest + process-classes + + manifest + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DataFormats.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DataFormats.java new file mode 100644 index 0000000000000000000000000000000000000000..52241d61223808ffb4f328cf88339caeab353b6c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DataFormats.java @@ -0,0 +1,236 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.ServiceLoader; +import java.util.Set; + +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.impl.logging.SpinLogger; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.camunda.spin.spi.DataFormatProvider; +import org.camunda.spin.xml.SpinXmlElement; + +/** + * Provides access to all builtin data formats. + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public class DataFormats { + + private static SpinCoreLogger LOG = SpinLogger.CORE_LOGGER; + + public static String JSON_DATAFORMAT_NAME = "application/json"; + + public static String XML_DATAFORMAT_NAME = "application/xml"; + + /** The global instance of the manager */ + static DataFormats INSTANCE = new DataFormats(); + + /** + * Provides the global instance of the DataFormats manager. + * @return the global instance. + */ + public static DataFormats getInstance() { + return INSTANCE; + } + + /** + * Returns the global xml data format that can be provided with + * configuration that applies to any Spin xml operation. + */ + @SuppressWarnings("unchecked") + public static DataFormat xml() { + return (DataFormat) getDataFormat(XML_DATAFORMAT_NAME); + } + + /** + * Returns the global json data format that can be provided with + * configuration that applies to any Spin json operation. + */ + @SuppressWarnings("unchecked") + public static DataFormat json() { + return (DataFormat) getDataFormat(JSON_DATAFORMAT_NAME); + } + + /** + * Returns the registered data format for the given name. + * + * @param dataFormatName the name of the data format + * @return the data format or null if non is registered for this name + */ + public static DataFormat> getDataFormat(String dataFormatName) { + return INSTANCE.getDataFormatByName(dataFormatName); + } + + /** + * @return a set of all registered data formats + */ + public static Set>> getAvailableDataFormats() { + return INSTANCE.getAllAvailableDataFormats(); + } + + // instance ///////////////////////////////////////////////////// + + protected Map> availableDataFormats; + + public Set>> getAllAvailableDataFormats() { + ensureDataformatsInitialized(); + return new HashSet<>(availableDataFormats.values()); + } + + public DataFormat> getDataFormatByName(String name) { + ensureDataformatsInitialized(); + return availableDataFormats.get(name); + } + + /** + * Detect all available dataformats on the classpath using a {@link ServiceLoader}. + */ + protected void ensureDataformatsInitialized() { + if(availableDataFormats == null) { + synchronized(DataFormats.class) { + if(availableDataFormats == null) { + registerDataFormats(null); + } + } + } + } + + public void registerDataFormats(ClassLoader classloader) { + registerDataFormats(classloader, Collections.EMPTY_LIST, Collections.EMPTY_MAP); + } + + public void registerDataFormats(ClassLoader classloader, + List configurators) { + registerDataFormats(classloader, configurators, Collections.EMPTY_MAP); + } + public void registerDataFormats(ClassLoader classloader, + List configurators, + Map configurationProperties) { + + Map> dataFormats = new HashMap<>(); + + if(classloader == null) { + classloader = DataFormats.class.getClassLoader(); + } + + // discover available custom dataformat providers on the classpath + registerCustomDataFormats(dataFormats, classloader, configurationProperties); + + // discover and apply data format configurators on the classpath + applyConfigurators(dataFormats, classloader, configurators); + + LOG.logDataFormats(dataFormats.values()); + + this.availableDataFormats = dataFormats; + } + + protected void registerCustomDataFormats(Map> dataFormats, ClassLoader classloader) { + registerCustomDataFormats(dataFormats, classloader, Collections.EMPTY_MAP); + } + + protected void registerCustomDataFormats(Map> dataFormats, + ClassLoader classloader, + Map configurationProperties) { + // use java.util.ServiceLoader to load custom DataFormatProvider instances on the classpath + ServiceLoader providerLoader = ServiceLoader.load(DataFormatProvider.class, classloader); + + for (DataFormatProvider provider : providerLoader) { + LOG.logDataFormatProvider(provider); + registerProvider(dataFormats, provider, configurationProperties); + } + } + + protected void registerProvider(Map> dataFormats, + DataFormatProvider provider) { + registerProvider(dataFormats, provider, Collections.EMPTY_MAP); + } + + protected void registerProvider(Map> dataFormats, + DataFormatProvider provider, + Map configurationProperties) { + + String dataFormatName = provider.getDataFormatName(); + + if(dataFormats.containsKey(dataFormatName)) { + throw LOG.multipleProvidersForDataformat(dataFormatName); + } + else { + DataFormat dataFormatInstance = provider.createInstance(configurationProperties); + dataFormats.put(dataFormatName, dataFormatInstance); + } + } + + @SuppressWarnings("rawtypes") + protected void applyConfigurators(Map> dataFormats, ClassLoader classloader) { + applyConfigurators(dataFormats, classloader, Collections.EMPTY_LIST); + } + + protected void applyConfigurators(Map> dataFormats, + ClassLoader classloader, + List dataFormatConfigurators) { + + ServiceLoader configuratorLoader = ServiceLoader.load(DataFormatConfigurator.class, classloader); + + // apply SPI configurators + for (DataFormatConfigurator configurator : configuratorLoader) { + LOG.logDataFormatConfigurator(configurator); + applyConfigurator(dataFormats, configurator); + } + + // apply additional, non-SPI, configurators + for (DataFormatConfigurator configurator : dataFormatConfigurators) { + LOG.logDataFormatConfigurator(configurator); + applyConfigurator(dataFormats, configurator); + } + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected void applyConfigurator(Map> dataFormats, DataFormatConfigurator configurator) { + for (DataFormat dataFormat : dataFormats.values()) { + if (configurator.getDataFormatClass().isAssignableFrom(dataFormat.getClass())) { + configurator.configure(dataFormat); + } + } + } + + public static void loadDataFormats() { + loadDataFormats(null); + } + + public static void loadDataFormats(ClassLoader classloader) { + INSTANCE.registerDataFormats(classloader); + } + + public static void loadDataFormats(ClassLoader classloader, List configurators) { + INSTANCE.registerDataFormats(classloader, configurators); + } + + public static void loadDataFormats(ClassLoader classloader, Map configurationProperties) { + INSTANCE.registerDataFormats(classloader, Collections.EMPTY_LIST, configurationProperties); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DeserializationTypeValidator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DeserializationTypeValidator.java new file mode 100644 index 0000000000000000000000000000000000000000..479eef4978b994eb75dc902ca55166a36afd17f1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/DeserializationTypeValidator.java @@ -0,0 +1,23 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +public interface DeserializationTypeValidator { + + boolean validate(String type); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/Spin.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/Spin.java new file mode 100644 index 0000000000000000000000000000000000000000..34c0cf34dd4a991134b5684c587266bcffce70d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/Spin.java @@ -0,0 +1,143 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import java.io.Writer; + +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.xml.SpinXmlElement; + +/** + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public abstract class Spin> { + + /** + * Creates a spin wrapper for a data input of a given data format. + * + * @param input the input to wrap + * @param format the data format of the input + * @return the spin wrapper for the input + * + * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null') + */ + public static > T S(Object input, DataFormat format) { + return SpinFactory.INSTANCE.createSpin(input, format); + } + + /** + * Creates a spin wrapper for a data input of a given data format. + * + * @param input the input to wrap + * @param dataFormatName the data format name of the input + * @return the spin wrapper for the input + * + * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null') + */ + public static > T S(Object input, String dataFormatName) { + return SpinFactory.INSTANCE.createSpin(input, dataFormatName); + } + + /** + * Creates a spin wrapper for a data input. The data format of the + * input is auto detected. + * + * @param input the input to wrap + * @return the spin wrapper for the input + * + * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null') + */ + public static > T S(Object input) { + return SpinFactory.INSTANCE.createSpin(input); + } + + /** + * Creates a spin wrapper for a data input. The data format of the + * input is assumed to be XML. + * + * @param input the input to wrap + * @return the spin wrapper for the input + * + * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null') + */ + public static SpinXmlElement XML(Object input) { + return SpinFactory.INSTANCE.createSpin(input, DataFormats.xml()); + } + + /** + * Creates a spin wrapper for a data input. The data format of the + * input is assumed to be JSON. + * + * @param input the input to wrap + * @return the spin wrapper for the input + * + * @throws IllegalArgumentException in case an argument of illegal type is provided (such as 'null') + */ + public static SpinJsonNode JSON(Object input) { + return SpinFactory.INSTANCE.createSpin(input, DataFormats.json()); + } + + /** + * Provides the name of the dataformat used by this spin. + * + * @return the name of the dataformat used by this Spin. + */ + public abstract String getDataFormatName(); + + /** + * Return the wrapped object. The return type of this method + * depends on the concrete data format. + * + * @return the object wrapped by this wrapper. + */ + public abstract Object unwrap(); + + /** + * Returns the wrapped object as string representation. + * + * @return the string representation + */ + public abstract String toString(); + + /** + * Writes the wrapped object to a existing writer. + * + * @param writer the writer to write to + */ + public abstract void writeToWriter(Writer writer); + + /** + * Maps the wrapped object to an instance of a java class. + * + * @param type the java class to map to + * @return the mapped object + */ + public abstract C mapTo(Class type); + + /** + * Maps the wrapped object to a java object. + * The object is determined based on the configuration string + * which is data format specific. + * + * @param type the class name to map to + * @return the mapped object + */ + public abstract C mapTo(String type); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinCollection.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinCollection.java new file mode 100644 index 0000000000000000000000000000000000000000..4615a0908522fc2c2847210816005e51edc5c774 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinCollection.java @@ -0,0 +1,28 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import java.util.Collection; + +/** + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public interface SpinCollection> extends Collection { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFactory.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..5f5ab72fc68d60c76720d136dc3b7d15f38ddc54 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFactory.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import org.camunda.spin.impl.SpinFactoryImpl; +import org.camunda.spin.spi.DataFormat; + +/** + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public abstract class SpinFactory { + + /** + * The singleton instance of the SpinFactory. + */ + public static SpinFactory INSTANCE = new SpinFactoryImpl(); + + public abstract > T createSpin(Object parameter); + + public abstract > T createSpin(Object parameter, DataFormat format); + + public abstract > T createSpin(Object parameter, String dataFormatName); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFileNotFoundException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFileNotFoundException.java new file mode 100644 index 0000000000000000000000000000000000000000..6a40c15cb60eb78e9bd28be5f5c72bac66c1302b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinFileNotFoundException.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import org.camunda.spin.SpinRuntimeException; + +/** + * @author Sebastian Menski + */ +public class SpinFileNotFoundException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinFileNotFoundException(String message) { + super(message); + } + + public SpinFileNotFoundException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinList.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinList.java new file mode 100644 index 0000000000000000000000000000000000000000..02fafe7b1cfe3e860ecbb479fc8af774775dc31f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinList.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import java.util.List; + +/** + * @author Sebastian Menski + */ +public interface SpinList> extends List { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinRuntimeException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinRuntimeException.java new file mode 100644 index 0000000000000000000000000000000000000000..f5c5604fba8dcb7786b65e841414ba595e7f200e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinRuntimeException.java @@ -0,0 +1,34 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +/** + * @author Sebastian Menski + */ +public class SpinRuntimeException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinRuntimeException(String message) { + super(message); + } + + public SpinRuntimeException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinScriptException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinScriptException.java new file mode 100644 index 0000000000000000000000000000000000000000..31de35a7d04b6e9872341f4c8475f76d736ee8ce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/SpinScriptException.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +/** + * @author Sebastian Menski + */ +public class SpinScriptException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinScriptException(String message) { + super(message); + } + + public SpinScriptException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinFactoryImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinFactoryImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..49003802b8e6ec705f1c7a1109b9e24f93f36783 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinFactoryImpl.java @@ -0,0 +1,171 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +import java.io.IOException; +import java.io.Reader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.Spin; +import org.camunda.spin.SpinFactory; +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.impl.util.RewindableReader; +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatMapper; +import org.camunda.spin.spi.DataFormatReader; +import org.camunda.spin.spi.SpinDataFormatException; + +/** + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public class SpinFactoryImpl extends SpinFactory { + + private static final SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER; + + private static final int READ_SIZE = 256; + + @SuppressWarnings("unchecked") + public > T createSpin(Object parameter) { + ensureNotNull("parameter", parameter); + + if (parameter instanceof String) { + return createSpinFromString((String) parameter); + + } else if (parameter instanceof Reader) { + return createSpinFromReader((Reader) parameter); + + } else if (parameter instanceof Spin) { + return createSpinFromSpin((T) parameter); + + } else { + throw LOG.unsupportedInputParameter(parameter.getClass()); + } + } + + @SuppressWarnings("unchecked") + public > T createSpin(Object parameter, DataFormat format) { + ensureNotNull("parameter", parameter); + ensureNotNull("format", format); + + if (parameter instanceof String) { + return createSpinFromString((String) parameter, format); + + } else if (parameter instanceof Reader) { + return createSpinFromReader((Reader) parameter, format); + + } else if (parameter instanceof Spin) { + return createSpinFromSpin((T) parameter, format); + + } else { + return createSpinFromObject(parameter, format); + } + } + + @SuppressWarnings("unchecked") + public > T createSpin(Object parameter, String dataFormatName) { + ensureNotNull("dataFormatName", dataFormatName); + + DataFormat dataFormat = (DataFormat) DataFormats.getDataFormat(dataFormatName); + + return createSpin(parameter, dataFormat); + } + + /** + * + * @throws SpinDataFormatException in case the parameter cannot be read using this data format + * @throws IllegalArgumentException in case the parameter is null or dd: + */ + public > T createSpinFromSpin(T parameter) { + ensureNotNull("parameter", parameter); + + return parameter; + } + + public > T createSpinFromString(String parameter) { + ensureNotNull("parameter", parameter); + + Reader input = SpinIoUtil.stringAsReader(parameter); + return createSpin(input); + } + + @SuppressWarnings("unchecked") + public > T createSpinFromReader(Reader parameter) { + ensureNotNull("parameter", parameter); + + RewindableReader rewindableReader = new RewindableReader(parameter, READ_SIZE); + + DataFormat matchingDataFormat = null; + for (DataFormat format : DataFormats.getAvailableDataFormats()) { + if (format.getReader().canRead(rewindableReader, rewindableReader.getRewindBufferSize())) { + matchingDataFormat = (DataFormat) format; + } + + try { + rewindableReader.rewind(); + } catch (IOException e) { + throw LOG.unableToReadFromReader(e); + } + + } + + if (matchingDataFormat == null) { + throw LOG.unrecognizableDataFormatException(); + } + + return createSpin(rewindableReader, matchingDataFormat); + } + + /** + * + * @throws SpinDataFormatException in case the parameter cannot be read using this data format + * @throws IllegalArgumentException in case the parameter is null or dd: + */ + public > T createSpinFromSpin(T parameter, DataFormat format) { + ensureNotNull("parameter", parameter); + + return parameter; + } + + public > T createSpinFromString(String parameter, DataFormat format) { + ensureNotNull("parameter", parameter); + + Reader input = SpinIoUtil.stringAsReader(parameter); + return createSpin(input, format); + } + + public > T createSpinFromReader(Reader parameter, DataFormat format) { + ensureNotNull("parameter", parameter); + + DataFormatReader reader = format.getReader(); + Object dataFormatInput = reader.readInput(parameter); + return format.createWrapperInstance(dataFormatInput); + } + + public > T createSpinFromObject(Object parameter, DataFormat format) { + ensureNotNull("parameter", parameter); + + DataFormatMapper mapper = format.getMapper(); + Object dataFormatInput = mapper.mapJavaToInternal(parameter); + + return format.createWrapperInstance(dataFormatInput); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinListImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinListImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..fe8248478aba9e2a828f164dd732178b5db2100a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/SpinListImpl.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl; + +import org.camunda.spin.Spin; +import org.camunda.spin.SpinList; + +import java.util.ArrayList; +import java.util.Collection; + +/** + * @author Sebastian Menski + */ +public class SpinListImpl> extends ArrayList implements SpinList { + + private static final long serialVersionUID = 1L; + + public SpinListImpl() { + super(); + } + + public SpinListImpl(int initialCapacity) { + super(initialCapacity); + } + + public SpinListImpl(Collection c) { + super(c); + } + + public SpinListImpl(Iterable iterable) { + super(); + for (E e : iterable) { + add(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinCoreLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinCoreLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..6fec7250bff5e184f94c26418ff249fb92e84cac --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinCoreLogger.java @@ -0,0 +1,107 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.logging; + +import java.io.IOException; +import java.util.Collection; + +import org.camunda.spin.SpinFileNotFoundException; +import org.camunda.spin.SpinRuntimeException; +import org.camunda.spin.SpinScriptException; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatConfigurator; +import org.camunda.spin.spi.DataFormatProvider; +import org.camunda.spin.spi.SpinDataFormatException; + + +/** + * The Logger for the core api. + * + * @author Daniel Meyer + * @author Sebastian Menski + * + */ +public class SpinCoreLogger extends SpinLogger { + + public IllegalArgumentException unsupportedInputParameter(Class parameterClass) { + return new IllegalArgumentException(exceptionMessage("001", "Unsupported input of type '{}'", parameterClass.getName())); + } + + public SpinFileNotFoundException fileNotFoundException(String filename, Throwable cause) { + return new SpinFileNotFoundException(exceptionMessage("002", "Unable to find file with path '{}'", filename), cause); + } + + public SpinFileNotFoundException fileNotFoundException(String filename) { + return fileNotFoundException(filename, null); + } + + public SpinRuntimeException unableToReadFromReader(Exception e) { + return new SpinRuntimeException(exceptionMessage("003", "Unable to read from reader"), e); + } + + public SpinDataFormatException unrecognizableDataFormatException() { + return new SpinDataFormatException(exceptionMessage("004", "No matching data format detected")); + } + + public SpinScriptException noScriptEnvFoundForLanguage(String scriptLanguage, String path) { + return new SpinScriptException(exceptionMessage("006", "No script script env found for script language '{}' at path '{}'", scriptLanguage, path)); + } + + public IOException unableToRewindReader() { + return new IOException(exceptionMessage("007", "Unable to rewind input stream: rewind buffering limit exceeded")); + } + + public SpinDataFormatException multipleProvidersForDataformat(String dataFormatName) { + return new SpinDataFormatException(exceptionMessage("008", "Multiple providers found for dataformat '{}'", dataFormatName)); + } + + public void logDataFormats(Collection> formats) { + if (isInfoEnabled()) { + for (DataFormat format : formats) { + logDataFormat(format); + } + } + } + + protected void logDataFormat(DataFormat dataFormat) { + logInfo("009", "Discovered Spin data format: {}[name = {}]", dataFormat.getClass().getName(), dataFormat.getName()); + } + + public void logDataFormatProvider(DataFormatProvider provider) { + if (isInfoEnabled()) { + logInfo("010", "Discovered Spin data format provider: {}[name = {}]", + provider.getClass().getName(), provider.getDataFormatName()); + } + } + + @SuppressWarnings("rawtypes") + public void logDataFormatConfigurator(DataFormatConfigurator configurator) { + if (isInfoEnabled()) { + logInfo("011", "Discovered Spin data format configurator: {}[dataformat = {}]", + configurator.getClass(), configurator.getDataFormatClass().getName()); + } + } + + + public SpinDataFormatException classNotFound(String classname, ClassNotFoundException cause) { + return new SpinDataFormatException(exceptionMessage("012", "Class {} not found ", classname), cause); + } + + public void tryLoadingClass(String classname, ClassLoader cl) { + logDebug("013", "Try loading class '{}' using classloader '{}'.", classname, cl); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..362947e33a11fe3754eede65fc508254be726738 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/logging/SpinLogger.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.logging; + +import org.camunda.commons.logging.BaseLogger; + +/** + * @author Daniel Meyer + * + */ +public abstract class SpinLogger extends BaseLogger { + + public static final String PROJECT_CODE = "SPIN"; + + public static final SpinCoreLogger CORE_LOGGER = BaseLogger.createLogger(SpinCoreLogger.class, PROJECT_CODE, "org.camunda.spin", "01"); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/RewindableReader.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/RewindableReader.java new file mode 100644 index 0000000000000000000000000000000000000000..33a223d2f8750a34bd6c17c9b2b5f5657167f679 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/RewindableReader.java @@ -0,0 +1,131 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.util; + +import java.io.IOException; +import java.io.PushbackReader; +import java.io.Reader; + +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.impl.logging.SpinLogger; + +/** + * Caches the initial characters that are read from the supplied {@link Reader} and + * allows to rewind these. As soon as more than size characters have been read, + * rewinding fails. + * + * @author Thorben Lindhauer + */ +public class RewindableReader extends Reader { + + private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER; + + protected PushbackReader wrappedReader; + + protected char[] buffer; + protected int pos; + protected boolean rewindable; + + public RewindableReader(Reader input, int size) { + this.wrappedReader = new PushbackReader(input, size); + this.buffer = new char[size]; + this.pos = 0; + this.rewindable = true; + } + + public int read(char[] cbuf, int off, int len) throws IOException { + int charactersRead = wrappedReader.read(cbuf, off, len); + + if (charactersRead > 0) { + if (rewindable && pos + charactersRead > buffer.length) { + rewindable = false; + } + + if (pos < buffer.length) { + int freeBufferSpace = buffer.length - pos; + int insertableCharacters = Math.min(charactersRead, freeBufferSpace); + System.arraycopy(cbuf, off, buffer, pos, insertableCharacters); + pos += insertableCharacters; + } + } + + return charactersRead; + } + + public int read() throws IOException { + int nextCharacter = wrappedReader.read(); + + if (nextCharacter != -1) { + if (pos < buffer.length) { + buffer[pos] = (char) nextCharacter; + pos++; + } else if (rewindable && pos >= buffer.length) { + rewindable = false; + } + } + + return nextCharacter; + } + + public void close() throws IOException { + wrappedReader.close(); + } + + public synchronized void mark(int readlimit) throws IOException { + wrappedReader.mark(readlimit); + } + + public boolean markSupported() { + return wrappedReader.markSupported(); + } + + public synchronized void reset() throws IOException { + wrappedReader.reset(); + } + + public long skip(long n) throws IOException { + return wrappedReader.skip(n); + } + + /** + * Rewinds the reader such that the initial characters are returned when invoking read(). + * + * Throws an exception if more than the buffering limit has already been read. + * @throws IOException + */ + public void rewind() throws IOException { + if (!rewindable) { + throw LOG.unableToRewindReader(); + } + + wrappedReader.unread(buffer, 0, pos); + pos = 0; + } + + public int getRewindBufferSize() { + return buffer.length; + } + + /** + * + * @return the number of characters that can still be read and rewound. + */ + public int getCurrentRewindableCapacity() { + return buffer.length - pos; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..ef742df3476ec22479a0fcb420b16460cd49bdc6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinIoUtil.java @@ -0,0 +1,139 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.util; + +import org.camunda.commons.utils.IoUtil; +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.impl.logging.SpinLogger; + +import java.io.*; +import java.nio.charset.Charset; + +/** + * @author Daniel Meyer + * + */ +public class SpinIoUtil extends IoUtil { + + public static final Charset ENCODING_CHARSET = Charset.forName("UTF-8"); + + private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER; + + /** + * Converts a {@link OutputStream} to an {@link InputStream} by coping the data directly. + * WARNING: Do not use for large data (>100MB). Only for testing purpose. + * + * @param outputStream the {@link OutputStream} to convert + * @return the resulting {@link InputStream} + */ + public static InputStream convertOutputStreamToInputStream(OutputStream outputStream) { + byte[] data = ((ByteArrayOutputStream) outputStream).toByteArray(); + return new ByteArrayInputStream(data); + } + + /** + * Convert an {@link InputStream} to a {@link String} + * + * @param inputStream the {@link InputStream} to convert + * @return the resulting {@link String} + * @throws IOException + */ + public static String getStringFromInputStream(InputStream inputStream) throws IOException { + return getStringFromInputStream(inputStream, true); + } + + /** + * Convert an {@link InputStream} to a {@link String} + * + * @param inputStream the {@link InputStream} to convert + * @param trim trigger if whitespaces are trimmed in the output + * @return the resulting {@link String} + * @throws IOException + */ + public static String getStringFromInputStream(InputStream inputStream, boolean trim) throws IOException { + BufferedReader bufferedReader = null; + StringBuilder stringBuilder = new StringBuilder(); + try { + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = bufferedReader.readLine()) != null) { + if (trim) { + stringBuilder.append(line.trim()); + } else { + stringBuilder.append(line).append("\n"); + } + } + } finally { + closeSilently(bufferedReader); + } + + return stringBuilder.toString(); + } + + /** + * Convert an {@link Reader} to a {@link String} + * + * @param reader the {@link Reader} to convert + * @return the resulting {@link String} + * @throws IOException + */ + public static String getStringFromReader(Reader reader) throws IOException { + return getStringFromReader(reader, true); + } + + /** + * Convert an {@link Reader} to a {@link String} + * + * @param reader the {@link Reader} to convert + * @param trim trigger if whitespaces are trimmed in the output + * @return the resulting {@link String} + * @throws IOException + */ + public static String getStringFromReader(Reader reader, boolean trim) throws IOException { + BufferedReader bufferedReader = null; + StringBuilder stringBuilder = new StringBuilder(); + try { + bufferedReader = new BufferedReader(reader); + String line; + while ((line = bufferedReader.readLine()) != null) { + if (trim) { + stringBuilder.append(line.trim()); + } else { + stringBuilder.append(line).append("\n"); + } + } + } finally { + closeSilently(bufferedReader); + } + + return stringBuilder.toString(); + } + + public static Reader classpathResourceAsReader(String fileName) { + try { + File classpathFile = getClasspathFile(fileName); + return new FileReader(classpathFile); + } catch (FileNotFoundException e) { + throw LOG.fileNotFoundException(fileName, e); + } + } + + public static Reader stringAsReader(String string) { + return new StringReader(string); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinReflectUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinReflectUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..677d5f606698437d0829c68abc35a2739d65020e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/impl/util/SpinReflectUtil.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.util; + +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.spi.DataFormat; + +/** + * @author Daniel Meyer + * + */ +public class SpinReflectUtil { + + private final static SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER; + + /** + * Used by dataformats if they need to load a class + * + * @param classname the name of the + * @param dataFormat + * @return + */ + public static Class loadClass(String classname, DataFormat dataFormat) { + + // first try context classoader + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if(cl != null) { + LOG.tryLoadingClass(classname, cl); + try { + return cl.loadClass(classname); + } + catch(Exception e) { + // ignore + } + } + + // else try the classloader which loaded the dataformat + cl = dataFormat.getClass().getClassLoader(); + try { + LOG.tryLoadingClass(classname, cl); + return cl.loadClass(classname); + } + catch (ClassNotFoundException e) { + throw LOG.classNotFound(classname, e); + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonDataFormatException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonDataFormatException.java new file mode 100644 index 0000000000000000000000000000000000000000..f25b93e041d7c9994e45e2ab9d6ecb210561a1cf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonDataFormatException.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.spi.SpinDataFormatException; + +public class SpinJsonDataFormatException extends SpinDataFormatException { + + public SpinJsonDataFormatException(String message) { + super(message); + } + + public SpinJsonDataFormatException(String message, Throwable cause) { + super(message, cause); + } + + private static final long serialVersionUID = 1L; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonException.java new file mode 100644 index 0000000000000000000000000000000000000000..0d66e4d6d8ba689b234b8e201eb82aa53ae8aee4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonException.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.SpinRuntimeException; + +/** + * @author Stefan Hentschel + */ +public class SpinJsonException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinJsonException(String message) { + super(message); + } + + public SpinJsonException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonNode.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonNode.java new file mode 100644 index 0000000000000000000000000000000000000000..58883022abc0a30b715a62532429c7a561335be7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonNode.java @@ -0,0 +1,352 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.Spin; +import org.camunda.spin.SpinList; +import org.camunda.spin.spi.SpinDataFormatException; + +import java.util.List; +import java.util.Map; + +/** + * A json node. + * + * @author Thorben Lindhauer + * @author Stefan Hentschel + */ +public abstract class SpinJsonNode extends Spin { + + /** + * Fetches the first index of the searched object in an array. + * + * @param searchObject Object for which the index should be searched. + * @return {@link Integer} index of searchObject. + * @throws SpinJsonException if the current node is not an array. + * @throws SpinJsonPropertyException if object is not found. + */ + public abstract Integer indexOf(Object searchObject); + + /** + * Fetches the last index of the searched object in an array. + * + * @param searchObject Object for which the index should be searched. + * @return {@link Integer} index of searchObject. + * @throws SpinJsonException if the current node is not an array. + * @throws SpinJsonPropertyException if object is not found. + */ + public abstract Integer lastIndexOf(Object searchObject); + + /** + * Returns {@code true} if the array contains the specified object. + * + * @param searchObject Object for which the array should be searched. + * @return {@code true} if the array contains the object. + * @throws SpinJsonException if the current node is not an array. + */ + public abstract boolean contains(Object searchObject); + + /** + * Check if this node is an object node. + * + * @return true if the node is an object, false otherwise + */ + public abstract boolean isObject(); + + /** + * Check if this node has a property with the given name. + * + * @param name the name of the property + * @return true if this node has a property with this name, false otherwise + */ + public abstract boolean hasProp(String name); + + /** + * Get the property of this node with the given name. + * + * @param name the name of the property + * @return {@link SpinJsonNode} representation of the property + */ + public abstract SpinJsonNode prop(String name); + + /** + * Set a new String property in this node. + * + * @param name the name of the new property + * @param newProperty the new String property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, String newProperty); + + /** + * Set a new Number property in this node. + * + * @param name the name of the new property + * @param newProperty the new Number property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, Number newProperty); + + /** + * Set a new int property in this node. + * + * @param name the name of the new property + * @param newProperty the new int property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, int newProperty); + + /** + * Set a new float property in this node. + * + * @param name the name of the new property + * @param newProperty the new float property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, float newProperty); + + /** + * Set a new long property in this node. + * + * @param name the name of the new property + * @param newProperty the new long property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, long newProperty); + + /** + * Set a new boolean property in this node. + * + * @param name the name of the new property + * @param newProperty the new boolean property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, boolean newProperty); + + /** + * Set a new Boolean property in this node. + * + * @param name the name of the new property + * @param newProperty the new Boolean property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, Boolean newProperty); + + /** + * Set a new List property in this node. + * + * @param name the name of the new property + * @param newProperty the new List property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, List newProperty); + + /** + * Set a new Map property in this node. + * + * @param name the name of the new property + * @param newProperty the new Map property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, Map newProperty); + + /** + * Set a new SpinJsonNode Object property in this node. + * + * @param name the name of the new property + * @param newProperty the new SpinJsonNode Object property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode prop(String name, SpinJsonNode newProperty); + + /** + * Remove a property of the given node by name. + * @param name name of the property + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode deleteProp(String name); + + /** + * Removes a number of properties by a given list of names. + * @param names list of names + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode deleteProp(List names); + + /** + * Appends a object to the end of the current array node + * @param property property which should be append + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode append(Object property); + + /** + * Appends an object at a specific point in an array + * + * @param index Index in current node where the new property should be appended. + * @param property Object which should be appended. + * @return {@link SpinJsonNode} representation of the current node. + * @throws IllegalArgumentException if index is out of bound. + */ + public abstract SpinJsonNode insertAt(int index, Object property); + + /** + * Inserts an object BEFORE an specific object in an array + * + * @param searchObject Object which is searched + * @param insertObject Object which will be inserted + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode insertBefore(Object searchObject, Object insertObject); + + /** + * Inserts an object AFTER an specific object in an array + * + * @param searchObject Object which is searched + * @param insertObject Object which will be inserted + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode insertAfter(Object searchObject, Object insertObject); + + /** + * Removes the first appearance of an object from the current array + * + * @param property object which should be deleted + * @return {@link SpinJsonNode} representation of the current node + */ + public abstract SpinJsonNode remove(Object property); + + /** + * Removes the last appearance of an object from the current array + * + * @param property object which should be deleted + * @return {@link SpinJsonNode} representation of the current node + * + */ + public abstract SpinJsonNode removeLast(Object property); + + /** + * removes an object at the specific index of the current array + * + * @param index Index of the array + * @return {@link SpinJsonNode} representation of the current node + * @throws IllegalArgumentException if index is out of bound. + */ + public abstract SpinJsonNode removeAt(int index); + + /** + * Check if this node is a boolean value. + * + * @return true if this node is a boolean value, false otherwise + */ + public abstract Boolean isBoolean(); + + /** + * Get this node as a boolean value. + * + * @return the boolean value of this node + * @throws SpinDataFormatException if this node is not a boolean value + */ + public abstract Boolean boolValue(); + + /** + * Check if this node is a number value. + * + * @return true if this node is a number value, false otherwise + */ + public abstract Boolean isNumber(); + + /** + * Get this node as a number value. + * + * @return the number value of this node + * @throws SpinDataFormatException if this node is not a number value + */ + public abstract Number numberValue(); + + /** + * Check if this node is a string value. + * + * @return true if this node is a string value, false otherwise + */ + public abstract Boolean isString(); + + /** + * Get this node as a string value. + * + * @return the string value of this node + * @throws SpinDataFormatException if this node is not a string value + */ + public abstract String stringValue(); + + /** + * Check if this node represents a null value. + * + * @return true if this node is a null value, false otherwise + */ + public abstract Boolean isNull(); + + /** + * Check if this node is a value. + * + * @return true if this node is a value, false otherwise + */ + public abstract Boolean isValue(); + + /** + * Gets the actual value of the node, in case it is a Boolean/String/Number/Null node. + * In that case a Java Boolean/String/Number or null is returned. + * + * @return the value of this node + * @throws SpinDataFormatException if this node is not a Boolean/String/Number/Nul value + */ + public abstract Object value(); + + /** + * Check if this node is a array value. + * + * @return true if this node is a array value, false otherwise + */ + public abstract Boolean isArray(); + + /** + * Get this node as list. + * If the current node is an array, this method returns a {@link SpinList} which contains copies of all + * JSON nodes contained in the current node. Changes to the the elements in the list will not propagate + * to the original nodes. + * + * @return the list value of this node + * @throws SpinDataFormatException if this node is not an array + */ + public abstract SpinList elements(); + + /** + * Get the field names of this node (i.e. the property names). + * + * @return the list of field names + * @throws SpinDataFormatException if this node is not a array value + */ + public abstract List fieldNames(); + + /** + * Creates a JsonPath query on this element. + * + * @param expression the JsonPath expression + * @return the JsonPath query + */ + public abstract SpinJsonPathQuery jsonPath(String expression); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathException.java new file mode 100644 index 0000000000000000000000000000000000000000..8eb1638bd03848cd66073c618fbf8b15937e7ff0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathException.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.SpinRuntimeException; + +/** + * @author Stefan Hentschel + */ +public class SpinJsonPathException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinJsonPathException(String message) { + super(message); + } + + public SpinJsonPathException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathQuery.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..8e855ce58477fe55c40e7780d71eee0c642b3a36 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPathQuery.java @@ -0,0 +1,65 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.SpinList; + +/** + * @author Stefan Hentschel + */ +public interface SpinJsonPathQuery { + + /** + * Fetches the node from the result of JsonPath. + * + * @return {@link SpinJsonNode} representation of the found node + * @throws SpinJsonPathException if node value is not a valid json path expression or the path is not found. + */ + SpinJsonNode element(); + + /** + * Fetches the list of nodes from the result of JsonPath. + * + * @return {@link SpinList} list of found nodes + * @throws SpinJsonDataFormatException if node value is not Array. + */ + SpinList elementList(); + + /** + * Fetches the string value from the result of JsonPath. + * + * @return String value of found node + * @throws SpinJsonDataFormatException if node value is not String. + */ + String stringValue(); + + /** + * Fetches the number value from the result of JsonPath. + * + * @return Number value of found node + * @throws SpinJsonDataFormatException if node value is not Number. + */ + Number numberValue(); + + /** + * Fetches the boolean value from the result of JsonPath. + * + * @return Boolean value of found node + * @throws SpinJsonDataFormatException if node value is not Boolean. + */ + Boolean boolValue(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPropertyException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPropertyException.java new file mode 100644 index 0000000000000000000000000000000000000000..210fecb8eff144e64d58bbf46e427ddbc6b81a8a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/json/SpinJsonPropertyException.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +/** + * @author Stefan Hentschel + */ +public class SpinJsonPropertyException extends SpinJsonException { + + private static final long serialVersionUID = 1L; + + public SpinJsonPropertyException(String message) { + super(message); + } + + public SpinJsonPropertyException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/scripting/SpinScriptEnv.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/scripting/SpinScriptEnv.java new file mode 100644 index 0000000000000000000000000000000000000000..e0ecdf722939cf7f0f8d8bb0ca3d654d3690288c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/scripting/SpinScriptEnv.java @@ -0,0 +1,111 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.scripting; + +import org.camunda.spin.SpinScriptException; +import org.camunda.spin.impl.logging.SpinCoreLogger; +import org.camunda.spin.impl.logging.SpinLogger; +import org.camunda.spin.impl.util.SpinIoUtil; + +import javax.script.ScriptEngine; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +/** + * Spin provides a set of environment scripts for known scripting languages. + * These scripts make it easier to use spin in a scripting language. Users can + * execute these scripts before they execute their custom scripts. + * + * @author Daniel Meyer + * + */ +public class SpinScriptEnv { + + private static final SpinCoreLogger LOG = SpinLogger.CORE_LOGGER; + + private static final String ENV_PATH_TEMPLATE = "script/env/%s/spin.%s"; + + /** + * Mapping of known {@link ScriptEngine} language names and + * file extensions of corresponding script files. + */ + public static final Map extensions = new HashMap(); + static { + extensions.put("python", "py"); + extensions.put("javascript", "js"); + extensions.put("groovy", "groovy"); + extensions.put("ruby", "rb"); + } + + /** + * Get file extension for script language. + * + * @param language the language name + * @return the file extension as string or null if the language is not in the set of languages supported by spin + */ + public static String getExtension(String language) { + language = language.toLowerCase(); + if("ecmascript".equals(language)) { + language = "javascript"; + } + return extensions.get(language); + } + + /** + * Get the spin scripting environment + * + * @param language the language name + * @return the environment script as string or null if the language is + * not in the set of languages supported by spin. + */ + public static String get(String language) { + language = language.toLowerCase(); + if("ecmascript".equals(language)) { + language = "javascript"; + } + + String extension = extensions.get(language); + if(extension == null) { + return null; + + } else { + return loadScriptEnv(language, extension); + + } + } + + protected static String loadScriptEnv(String language, String extension) { + String scriptEnvPath = String.format(ENV_PATH_TEMPLATE, language, extension); + InputStream envResource = SpinScriptException.class.getClassLoader().getResourceAsStream(scriptEnvPath); + + if(envResource == null) { + throw LOG.noScriptEnvFoundForLanguage(language, scriptEnvPath); + + } else { + try { + return SpinIoUtil.inputStreamAsString(envResource); + + } finally { + SpinIoUtil.closeSilently(envResource); + + } + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormat.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..962db9338af1e2b9ddccbdfce37fe7049f9ea8b7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormat.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import org.camunda.spin.Spin; + +/** + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public interface DataFormat> { + + String getName(); + + Class getWrapperType(); + + T createWrapperInstance(Object parameter); + + DataFormatReader getReader(); + + DataFormatWriter getWriter(); + + /** + * @return the DataFormatMapper used by this data format + */ + DataFormatMapper getMapper(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..94fff521064a9b6616ce95db8cc3470886020e48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatConfigurator.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +/** + *

Can be used to configure data formats of a certain type. + * An implementation will be supplied with all discovered data formats + * of the specified class. {@link DataFormat#getName()} may be used to further + * restrict configuration to data formats with a specific name.

+ * + * @author Thorben Lindhauer + */ +public interface DataFormatConfigurator> { + + /** + * @return the dataformat class this configurator can configure (including subclasses) + */ + Class getDataFormatClass(); + + /** + * Applies configuration to the desired format. + * This method is invoked with all dataformats of the required type. + */ + void configure(T dataFormat); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatMapper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..15d98da355e013bb5f9d82bee5e55f9edc7a975a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatMapper.java @@ -0,0 +1,101 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import org.camunda.spin.DeserializationTypeValidator; + +/** + * Maps a java object to the data format's internal representation and vice versa. + * + * @author Thorben Lindhauer + */ +public interface DataFormatMapper { + + /** + * Returns true if this mapper can map the provided Java Object. + * + * @param parameter the java object to check + * @return true if this object can be mapped. + */ + public boolean canMap(Object parameter); + + /** + * Maps a java object to a data format's internal data representation. + * + * @param parameter object that is mapped + * @return the data format's internal representation of that object + */ + public Object mapJavaToInternal(Object parameter); + + /** + * Maps the internal representation of a data format to a java object of the + * desired class. The desired class is not validated prior to the mapping. + * + * @param parameter the object to be mapped + * @param type the class to map the object to + * @return a java object of the specified class that was populated with the input + * parameter + */ + public T mapInternalToJava(Object parameter, Class type); + + /** + * Maps the internal representation of a data format to a java object of the + * desired class. The desired class is validated by the validator + * prior to the mapping. + * + * @param parameter the object to be mapped + * @param type the class to map the object to + * @param validator the validator for the target class + * @return a java object of the specified class that was populated with the input + * parameter + */ + + public T mapInternalToJava(Object parameter, Class type, DeserializationTypeValidator validator); + + /** + * Maps the internal representation of a data format to a java object of the + * desired class. The type identifier is given in a data format specific format. Its + * interpretation is data-format-specific. For example, it can be used to express generic + * type information that cannot be expressed by a {@link Class} object. + * The desired class is not validated prior to the mapping. + * + * @param parameter the object to be mapped + * @param typeIdentifier a data-format-specific type identifier that describes + * the class to map to + * @return a java object of the specified type that was populated with the input + * parameter + */ + public T mapInternalToJava(Object parameter, String typeIdentifier); + + /** + * Maps the internal representation of a data format to a java object of the + * desired class. The type identifier is given in a data format specific format. Its + * interpretation is data-format-specific. For example, it can be used to express generic + * type information that cannot be expressed by a {@link Class} object. + * The desired class is validated by the validator prior to the mapping. + * + * @param parameter the object to be mapped + * @param typeIdentifier a data-format-specific type identifier that describes + * the class to map to + * @param validator the validator for the target class + * @return a java object of the specified type that was populated with the input + * parameter + */ + public T mapInternalToJava(Object parameter, String typeIdentifier, DeserializationTypeValidator validator); + + String getCanonicalTypeName(Object object); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..642ae93531ff90e947492f2ca518e16232ada800 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatProvider.java @@ -0,0 +1,45 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import java.util.Map; + +/** + * @author Daniel Meyer + * + */ +public interface DataFormatProvider { + + /** + * @return the name of the data format provided by the implementation + */ + String getDataFormatName(); + + /** + * @return an instance of the data format provided by this implementation + */ + DataFormat createInstance(); + + /** + * @return an instance of the data format provided by this implementation configured using the + * passed configuration properties. + */ + default DataFormat createInstance(Map configurationProperties) { + return createInstance(); + }; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatReader.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatReader.java new file mode 100644 index 0000000000000000000000000000000000000000..7ecc9558749dc2e901d84cabc10dc86a24ce4a77 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatReader.java @@ -0,0 +1,57 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import java.io.Reader; + +import org.camunda.spin.Spin; + +/** + * Reads the internal representation of a {@link Spin} object from its serialized representation. + * + * @author Daniel Meyer + * @author Sebastian Menski + * @author Thorben Lindhauer + * + */ +public interface DataFormatReader { + + /** + * Returns true if this reader estimates to be able to consume the input data. + * Implementations may not read more than readLimit + * bytes from the supplied reader. + * + * @param reader reader that can be read from to detect a data format + * @param readLimit positive number that poses a restriction on how many characters + * an implementation may read. Reading beyond this limit may lead to incomplete + * input when the method {@link #readInput(Reader)} is invoked. + * @return true if this reader is able to consume the input + */ + boolean canRead(Reader reader, int readLimit); + + /** + * Read (or parse) a reader into this data format's input structure. + * For example, an Xml-Based data format may return an + * internal tree structure which can be used for traversing the xml tree. + * + * @param reader a {@link Reader} providing the data source + * @return the read or parsed input + * @throws SpinDataFormatException in case the reader cannot read the input + */ + Object readInput(Reader reader); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatWriter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatWriter.java new file mode 100644 index 0000000000000000000000000000000000000000..2149d3e1f7ee791c11deab40240a61f1b05988f3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/DataFormatWriter.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import java.io.Writer; + +/** + * @author Daniel Meyer + * + */ +public interface DataFormatWriter { + + /** + * Writes the internal representation, as provided by input + * to the supplied writer according to the data format + * that the implementation belongs to. + * For example, an XML data format writer writes XML. + * + * @param writer The writer to write the output to + * @param input The object to write. Can be safely cast to the internal + * format of the data format. + */ + public void writeToWriter(Writer writer, Object input); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/SpinDataFormatException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/SpinDataFormatException.java new file mode 100644 index 0000000000000000000000000000000000000000..94896fea3fb2459ca86960fe57e157ffe0809470 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/SpinDataFormatException.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import org.camunda.spin.SpinRuntimeException; + +/** + * Indicates an error in the underlying DataFormat layer + * + * @author Daniel Meyer + * + */ +public class SpinDataFormatException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinDataFormatException(String message, Throwable cause) { + super(message, cause); + } + + public SpinDataFormatException(String message) { + super(message); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TextBasedDataFormatReader.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TextBasedDataFormatReader.java new file mode 100644 index 0000000000000000000000000000000000000000..a8fdb314b384b33e662a1ec6acf8ebccd54fed53 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TextBasedDataFormatReader.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import java.io.IOException; +import java.io.Reader; +import java.util.regex.Pattern; + +import org.camunda.spin.impl.logging.SpinCoreLogger; + +/** + * Can be used as a base class to determine whether an input reader + * is readable by applying regular expression matching. + * + * @author Lindhauer + */ +public abstract class TextBasedDataFormatReader implements DataFormatReader { + + private static final SpinCoreLogger LOG = SpinCoreLogger.CORE_LOGGER; + + public boolean canRead(Reader input, int readLimit) { + char[] firstCharacters = new char[readLimit]; + + try { + input.read(firstCharacters, 0, readLimit); + } catch (IOException e) { + throw LOG.unableToReadFromReader(e); + } + + + Pattern pattern = getInputDetectionPattern(); + + return pattern.matcher(new String(firstCharacters)).find(); + } + + protected abstract Pattern getInputDetectionPattern(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..9470ec23d5d65e1a9dd9e253b183bd8a52b8cb66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/spi/TypeDetector.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +/** + * Detects the canonical type string of a supplied object + * + * @author Thorben Lindhauer + */ +public interface TypeDetector { + + boolean canHandle(Object object); + + String detectType(Object object); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathException.java new file mode 100644 index 0000000000000000000000000000000000000000..d82fa4b0dc47c445c8653cfa716412d5d94e1b1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathException.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import org.camunda.spin.SpinRuntimeException; + +/** + * Indicates an error during a XPath evaluation. + * + * @author Sebastian Menski + */ +public class SpinXPathException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinXPathException(String message, Throwable cause) { + super(message, cause); + } + + public SpinXPathException(String message) { + super(message); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathQuery.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..0270fadd85d83fce3c804a9092ebca22fcc125bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXPathQuery.java @@ -0,0 +1,93 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import org.camunda.spin.SpinList; + +import java.util.Map; + +/** + * @author Sebastian Menski + */ +public abstract class SpinXPathQuery { + + /** + * Returns the XPath query result as element. + * + * @return the wrapped XML element + */ + public abstract SpinXmlElement element(); + + /** + * Returns the XPath query result as a element list. + * + * @return the wrapped XML element list + */ + public abstract SpinList elementList(); + + /** + * Returns the XPath query result as attribute. + * + * @return the wrapped XML attribute + */ + public abstract SpinXmlAttribute attribute(); + + /** + * Returns the XPath query result as a attribute list. + * + * @return the wrapped XML attribute list + */ + public abstract SpinList attributeList(); + + /** + * Returns the XPath query result as a string. + * + * @return the string result + */ + public abstract String string(); + + /** + * Returns the XPath query result as a double. + * + * @return the double result + */ + public abstract Double number(); + + /** + * Returns the XPath query result as a boolean. + * + * @return the boolean result + */ + public abstract Boolean bool(); + + /** + * Maps a prefix, uri pair to a namespace. + * + * @param prefix prefix for the namespace. + * @param namespace uri of the namespace + * @return itself + */ + public abstract SpinXPathQuery ns(String prefix, String namespace); + + /** + * Maps a map of prefix, uri pairs to namespaces + * @param namespaces Map of the prefix, uri pairs. + * @return itself + */ + public abstract SpinXPathQuery ns(Map namespaces); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..b80c3a2aa9f7b92c5e607ad7f537f4755f2dc416 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttribute.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import java.io.Writer; + +/** + * An attribute in a tree-oriented XML data format. + * + * @author Sebastian Menski + * @author Daniel Meyer + * + */ +public abstract class SpinXmlAttribute extends SpinXmlNode { + + /** + * Returns the value of the attribute as {@link String}. + * + * @return the string value of the attribute + */ + public abstract String value(); + + /** + * Sets the value of the attribute. + * + * @param value the value to set + * @return the wrapped xml dom attribute + * @throws SpinXmlNodeException if the value is null + */ + public abstract SpinXmlAttribute value(String value); + + /** + * Removes the attribute. + * + * @return the wrapped owner {@link SpinXmlElement tree element} + */ + public abstract SpinXmlElement remove(); + + /** + * Returns the wrapped XML attribute value as string representation. + * + * @return the string representation + */ + public abstract String toString(); + + /** + * Writes the wrapped XML attribute value to an existing writer. + * + * @param writer the writer to write to + */ + public abstract void writeToWriter(Writer writer); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttributeException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttributeException.java new file mode 100644 index 0000000000000000000000000000000000000000..efcdb21df30364f13c20a235c098aed73dbdcaea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlAttributeException.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +/** + * Indicates an error in the underlying xml tree attribute. + * + * @author Sebastian Menski + */ +public class SpinXmlAttributeException extends SpinXmlNodeException { + + private static final long serialVersionUID = 1L; + + public SpinXmlAttributeException(String message) { + super(message); + } + + public SpinXmlAttributeException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlDataFormatException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlDataFormatException.java new file mode 100644 index 0000000000000000000000000000000000000000..89ccc7e2a4ca353885819578633b1a227fc0782e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlDataFormatException.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import org.camunda.spin.spi.SpinDataFormatException; + +/** + * @author Daniel Meyer + * + */ +public class SpinXmlDataFormatException extends SpinDataFormatException { + + private static final long serialVersionUID = 1L; + + public SpinXmlDataFormatException(String message, Throwable cause) { + super(message, cause); + } + + public SpinXmlDataFormatException(String message) { + super(message); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElement.java new file mode 100644 index 0000000000000000000000000000000000000000..df9e5aa7cfab73c76e134efa95fd23cfce76ca5c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElement.java @@ -0,0 +1,323 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import java.io.Writer; +import java.util.Collection; +import java.util.List; + +import org.camunda.spin.SpinList; + +/** + * An element in a tree-oriented XML data format. + * + * @author Sebastian Menski + * @author Daniel Meyer + * + */ +public abstract class SpinXmlElement extends SpinXmlNode { + + /** + * Checks whether this element has a attribute with an empty namespace and the given name. + * + * @param attributeName the name of the attribute + * @return true if the element has an attribute with this name under the local namespace, false otherwise + * @throws IllegalArgumentException if the attributeName is null + */ + public abstract boolean hasAttr(String attributeName); + + /** + * Returns the wrapped attribute for an empty namespace and the given name. + * + * @param attributeName the name of the attribute + * @return the wrapped {@link SpinXmlAttribute attribute} + * @throws IllegalArgumentException if the attributeName is null + * @throws SpinXmlAttributeException if the attribute is not found + */ + public abstract SpinXmlAttribute attr(String attributeName); + + /** + * Sets the attribute value in the local namespace of this element. + * + * @param attributeName the name of the attribute + * @param value the value to set + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the attributeName or value is null + */ + public abstract SpinXmlElement attr(String attributeName, String value); + + /** + * Removes the attribute with an empty namespace. + * + * @param attributeName the name of the attribute + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the attributeName is null + */ + public abstract SpinXmlElement removeAttr(String attributeName); + + /** + * Checks whether this element has a attribute with the given namespace and name. + * + * @param namespace the namespace of the attribute + * @param attributeName the name of the attribute + * @return true if the element has an attribute with this name under given namespace, false otherwise + * @throws IllegalArgumentException if the attributeName is null + */ + public abstract boolean hasAttrNs(String namespace, String attributeName); + + /** + * Returns the wrapped attribute for the given namespace and name. + * + * @param namespace the namespace of the attribute + * @param attributeName the name of the attribute + * @return the wrapped {@link SpinXmlAttribute attribute} + * @throws IllegalArgumentException if attributeName or value is null + * @throws SpinXmlElementImplementationException if the attribute cannot be set in the underlying implementation + */ + public abstract SpinXmlAttribute attrNs(String namespace, String attributeName); + + /** + * Sets the attribute value in the given namespace. + * + * @param namespace the namespace of the attribute + * @param attributeName the name of the attribute + * @param value the value to set + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if attributeName or value is null + * @throws SpinXmlElementImplementationException if the attribute cannot be set in the underlying implementation + */ + public abstract SpinXmlElement attrNs(String namespace, String attributeName, String value); + + /** + * Removes the attribute under the given namespace. + * + * @param namespace the namespace of the attribute + * @param attributeName the name of the attribute + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the attributeName is null + */ + public abstract SpinXmlElement removeAttrNs(String namespace, String attributeName); + + /** + * Returns all wrapped attributes of this element. + * + * @return the wrapped attributes or an empty list of no attributes are found + */ + public abstract SpinList attrs(); + + /** + * Returns all wrapped attributes for the given namespace. + * + * @param namespace the namespace of the attributes + * @return the wrapped attributes or an empty list of no attributes are found + */ + public abstract SpinList attrs(String namespace); + + /** + * Returns all names of the attributes of this element. + * + * @return the names of the attributes + */ + public abstract List attrNames(); + + /** + * Returns all names of the attributes in the given namespace. + * + * @return the names of the attributes + */ + public abstract List attrNames(String namespace); + + /** + * Returns the text content of an element. + * + * @return the text content or an empty string if non exists + */ + public abstract String textContent(); + + /** + * Sets the text content of an element. + * @param textContent the text content to set + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the textContent is null + */ + public abstract SpinXmlElement textContent(String textContent); + + /** + * Returns a single wrapped child element for the given name + * in the local namespace of this element. + * + * @param elementName the element name + * @return the wrapped child {@link SpinXmlElement element} + * @throws IllegalArgumentException if the elementName is null + * @throws SpinXmlElementException if none or more than one child element is found + */ + public abstract SpinXmlElement childElement(String elementName); + + /** + * Returns a single wrapped child {@link SpinXmlElement element} for the given namespace + * and name. + * + * @param namespace the namespace of the element + * @param elementName the element name + * @return the wrapped child {@link SpinXmlElement element} + * @throws IllegalArgumentException if the elementName is null + * @throws SpinXmlElementException if none or more than one child element is found + */ + public abstract SpinXmlElement childElement(String namespace, String elementName); + + /** + * Returns all child elements of this {@link SpinXmlElement elements}. + * + * @return list of wrapped child {@link SpinXmlElement elements} + */ + public abstract SpinList childElements(); + + /** + * Returns all child {@link SpinXmlElement elements} with a given name in the local namespace + * of this element. + * + * @param elementName the element name + * @return a collection of wrapped {@link SpinXmlElement elements} + * @throws IllegalArgumentException if the element name is null + * @throws SpinXmlElementException if no child element was found + */ + public abstract SpinList childElements(String elementName); + + /** + * Returns all child {@link SpinXmlElement elements} with a given namespace and name. + * + * @param namespace the namespace of the element + * @param elementName the element name + * @return a collection of wrapped {@link SpinXmlElement elements} + * @throws IllegalArgumentException if the element name is null + * @throws SpinXmlElementException if no child element was found + */ + public abstract SpinList childElements(String namespace, String elementName); + + /** + * Appends child elements to this {@link SpinXmlElement element}. + * + * @param childElements the child elements to append + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the childElements is null or one of them + * @throws SpinXmlElementImplementationException if a child element cannot be appended in the underlying implementation + */ + public abstract SpinXmlElement append(SpinXmlElement... childElements); + + /** + * Appends child elements to this {@link SpinXmlElement element}. + * + * @param childElements the child elements to append + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the childElements is null or one of them + * @throws SpinXmlElementImplementationException if a child element cannot be appended in the underlying implementation + */ + public abstract SpinXmlElement append(Collection childElements); + + /** + * Appends a child element to this element before the existing child element. + * + * @param childElement the child element to append + * @param existingChildElement the child element to append before + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the child element or existing child element is null + * @throws SpinXmlElementException if the existing child element is not a child of this element + * @throws SpinXmlElementImplementationException if the new child element cannot be inserted in the underlying implementation + */ + public abstract SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement); + + /** + * Appends a child element to this {@link SpinXmlElement element} after the existing child {@link SpinXmlElement element}. + * + * @param childElement the child element to append + * @param existingChildElement the child element to append after + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the child element or existing child element is null + * @throws SpinXmlElementException if the existing child element is not a child of this element + * @throws SpinXmlElementImplementationException if the new child element cannot be inserted in the underlying implementation + */ + public abstract SpinXmlElement appendAfter(SpinXmlElement childElement, SpinXmlElement existingChildElement); + + /** + * Removes all child elements from this element. + * + * @param childElements the child elements to remove + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if child elements is null or any of them + * @throws SpinXmlElementException if one of the child elements does not exist + * @throws SpinXmlElementImplementationException if the child element cannot be removed in the underlying implementation + */ + public abstract SpinXmlElement remove(SpinXmlElement... childElements); + + /** + * Removes all child elements from this element. + * + * @param childElements the child elements to remove + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if child elements is null or any of them + * @throws SpinXmlElementException if one of the child elements does not exist + * @throws SpinXmlElementImplementationException if the child element cannot be removed in the underlying implementation + */ + public abstract SpinXmlElement remove(Collection childElements); + + /** + * Replaces this element by an new one. + * + * @param newChildElement the new element + * @return the new wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if the new element is null or has the wrong type + * @throws SpinXmlElementException if this element has no parent element + * @throws SpinXmlElementImplementationException if the element cannot be replaced in the underlying implementation + */ + public abstract SpinXmlElement replace(SpinXmlElement newChildElement); + + /** + * Replaces an existing child element with a new one. + * + * @param existingChildElement the existing child element to replace + * @param newChildElement the new child element + * @return the wrapped {@link SpinXmlElement element} + * @throws IllegalArgumentException if any of the child elements is null + * @throws SpinXmlElementException if the existing element is not a child element of this + * @throws SpinXmlElementImplementationException if the child cannot be replaced in the underlying implementation + */ + public abstract SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement); + + /** + * Creates a XPath query on this element. + * + * @param expression the XPath expression + * @return the XPath query + */ + public abstract SpinXPathQuery xPath(String expression); + + /** + * Returns the wrapped XML element as string representation. + * + * @return the string representation + * @throws SpinXmlElementException if the element cannot be transformed or no new transformer can be created + */ + public abstract String toString(); + + /** + * Writes the wrapped XML element to a existing writer. + * + * @param writer the writer to write to + * @throws SpinXmlElementException if the element cannot be transformed or no new transformer can be created + */ + public abstract void writeToWriter(Writer writer); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementException.java new file mode 100644 index 0000000000000000000000000000000000000000..100ba6fdb181bc6bb630b085abfeaf965c5d9e0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementException.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +/** + * Indicates an error in the underlying xml tree element. + * + * @author Sebastian Menski + */ +public class SpinXmlElementException extends SpinXmlNodeException { + + private static final long serialVersionUID = 1L; + + public SpinXmlElementException(String message) { + super(message); + } + + public SpinXmlElementException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementImplementationException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementImplementationException.java new file mode 100644 index 0000000000000000000000000000000000000000..79cb6ea6a1552f77c424719807304328914ba6c3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlElementImplementationException.java @@ -0,0 +1,35 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +/** + * Indicates an error in the underlying xml tree element implementation. + * + * @author Sebastian Menski + */ +public class SpinXmlElementImplementationException extends SpinXmlElementException { + + private static final long serialVersionUID = 1L; + + public SpinXmlElementImplementationException(String message) { + super(message); + } + + public SpinXmlElementImplementationException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNode.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNode.java new file mode 100644 index 0000000000000000000000000000000000000000..522d11600f91ece551eb0d9b5f8fc32d75747e67 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNode.java @@ -0,0 +1,87 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import org.camunda.spin.Spin; + +/** + * An element in a tree-oriented XML data format. + * + * @author Sebastian Menski + * @author Daniel Meyer + * + */ +public abstract class SpinXmlNode> extends Spin { + + /** + * Returns the local name of the node without namespace or prefix. + * + * @return the name of the node + */ + public abstract String name(); + + /** + * Returns the namespace uri of the node and not the prefix. + * + * @return the namespace of the node + */ + public abstract String namespace(); + + /** + * Returns the prefix of the node and not the namespace uri. + * + * @return the prefix of the node + */ + public abstract String prefix(); + + /** + * Checks if the node has a given prefix. + * + * @param prefix the prefix to check + * @return true if the name has the same prefix + */ + public abstract boolean hasPrefix(String prefix); + + /** + * Checks if the node has a given namespace. + * + * @param namespace the namespace to check + * @return true if the node has the same namespace + */ + public abstract boolean hasNamespace(String namespace); + + /** + * Maps XML into specific class + * + * @param type Class to which the Xml should be mapped + * @return mapped Class + * + * @throws SpinDataFormatException in case the input cannot be mapped to class for several reasons + */ + public abstract C mapTo(Class type); + + /** + * Maps Xml into specific class + * + * @param canonicalName canonical name of the class + * @return mapped class + * + * @throws SpinDataFormatException in case the input cannot be mapped to class for several reasons + */ + public abstract C mapTo(String canonicalName); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNodeException.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNodeException.java new file mode 100644 index 0000000000000000000000000000000000000000..8d6c7d26b1c571e7a941ee1748f1a0c4049fbd00 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/java/org/camunda/spin/xml/SpinXmlNodeException.java @@ -0,0 +1,37 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import org.camunda.spin.SpinRuntimeException; + +/** + * Indicates an error in the underlying xml tree node. + * + * @author Sebastian Menski + */ +public class SpinXmlNodeException extends SpinRuntimeException { + + private static final long serialVersionUID = 1L; + + public SpinXmlNodeException(String message) { + super(message); + } + + public SpinXmlNodeException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/groovy/spin.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/groovy/spin.groovy new file mode 100644 index 0000000000000000000000000000000000000000..64aacbad00c6fdfe2e1fbbc2a5a6d7dedbf1d733 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/groovy/spin.groovy @@ -0,0 +1,21 @@ +/* Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This is the default environment for using camunda Spin in Groovy applications. + */ + +/* + * Bind the Spin S(...) function to the variable S. + */ +S = org.camunda.spin.Spin.&S \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/javascript/spin.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/javascript/spin.js new file mode 100644 index 0000000000000000000000000000000000000000..4364b93284f9586959d9811087c697c06559477c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/javascript/spin.js @@ -0,0 +1,21 @@ +/* Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * This is the default environment for using camunda Spin in Javascript applications. + */ + +/** + * Bind the Spin S function to the variable S. + */ +var S = Java.type('org.camunda.spin.Spin').S; \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/python/spin.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/python/spin.py new file mode 100644 index 0000000000000000000000000000000000000000..2bacca2808ab49f8c0295a8d35fcbd390a55d053 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/python/spin.py @@ -0,0 +1,18 @@ +""" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +""" + +# This is the default environment for using camunda Spin in Python applications. + +# Import the Spin S(...) function. +import org.camunda.spin.Spin.S as S diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/ruby/spin.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/ruby/spin.rb new file mode 100644 index 0000000000000000000000000000000000000000..49fce4db72de5d0aa2643985a5c1fc2a039fc842 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/main/resources/script/env/ruby/spin.rb @@ -0,0 +1,21 @@ +=begin +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +=end + +# This is the default environment for using camunda Spin in Ruby applications. + +# expose Spin's S(...) function globally +def S(*args) + org.camunda.spin.Spin.S(*args) +end + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/DataFormatsTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/DataFormatsTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6ede27e76fd91330055c0d2af7d9dd58dba9df39 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/DataFormatsTest.java @@ -0,0 +1,41 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public class DataFormatsTest { + + @Test + public void testCustomClassLoaderForInitialization() { + // when initializing data formats with a class loader + DataFormats dataFormats = new DataFormats(); + dataFormats.registerDataFormats(DataFormats.class.getClassLoader()); + + // then the operation was successful + Assert.assertEquals(0, dataFormats.getAllAvailableDataFormats().size()); + + // note: this checks the existence of API that allows to initialize + // data formats with a custom class loader; the functionality is actually tested + // as part of the platform integration tests + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/SpinCreateTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/SpinCreateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d335ee9eadabcde148c029965503f2f2df3c7ff1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/SpinCreateTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin; + +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.S; + +import org.camunda.spin.spi.DataFormat; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public class SpinCreateTest { + + @Test + public void shouldFailForNonExistingDataFormat() { + try { + S("{}", "a non-existing format"); + fail("expected exception"); + } catch (IllegalArgumentException e) { + // happy path + } + + try { + DataFormat dataFormat = null; + S("{}", dataFormat); + fail("expected exception"); + } catch (IllegalArgumentException e) { + // happy path + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/Script.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/Script.java new file mode 100644 index 0000000000000000000000000000000000000000..1e656464a631e8151307b32f1408e945663e9029 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/Script.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import org.junit.rules.TestRule; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Method annotation to signal a script test for the {@link ScriptRule} {@link TestRule}. + * The name of the script is optional and if omitted the package name is used as directory + * and the ClassName.MethodName.ScriptExtension as filename. Additionally a list of + * variables can be defined and the execute flag decides whether the script is execute + * before the test function is called. + * + * The script variables can be accessed trough the {@link ScriptRule#variables} + * field. + * + * Example usage: + * + *
+ *   {@literal @}Test
+ *   {@literal @}Script
+ *   public void scriptNameWithoutExtension() {
+ *     \\...
+ *   }
+ *
+ *   {@literal @}Test
+ *   {@literal @}Script("scriptNameWithoutExtension")
+ *   public void notTheScriptName() {
+ *     \\...
+ *   }
+ *
+ *   {@literal @}Test
+ *   {@literal @}Script(
+ *     name = "scriptNameWithoutExtension",
+ *     variables = {
+ *       {@literal @}ScriptVariable(name="a", value="b"),
+ *       {@literal @}ScriptVariable(name="f", file="test.xml")
+ *     }
+ *   )
+ *   public void notTheScriptName() {
+ *     \\...
+ *   }
+ *
+ *   {@literal @}Test
+ *   {@literal @}Script(
+ *     name = "scriptNameWithoutExtension",
+ *     execute = false
+ *   )
+ *   public void notTheScriptName() {
+ *       Map variables = Collections.singletonMap("a", "b");
+ *       script.execute(variables)
+ *       assertEquals("b", script.variables.get("a"))
+ *   }
+ * 
+ * + * + * @author Sebastian Menski + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Script { + + String value() default ""; + + String name() default ""; + + ScriptVariable[] variables() default {}; + + boolean execute() default true; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngine.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngine.java new file mode 100644 index 0000000000000000000000000000000000000000..3b38456b99a76b92e3a16de5a14eca4a1cbd4324 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngine.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotation to define a {@link ScriptEngine} of a test class + * using the {@link ScriptEngineRule}. + * + *
+ *   {@literal @}ScriptEngine("python")
+ *   public class SpinXmlPythonTest extends SpinXmlScriptTest {
+ *     // ...
+ *   }
+ * 
+ * + * @author Sebastian Menski + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface ScriptEngine { + + String value(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngineRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngineRule.java new file mode 100644 index 0000000000000000000000000000000000000000..e8828c6e829625c2f225d913eb5829e1e584500b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptEngineRule.java @@ -0,0 +1,102 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import java.util.HashMap; +import java.util.Map; + +import javax.script.ScriptContext; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; + +import org.junit.ClassRule; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * A jUnit4 {@link ClassRule} to define create a {@link ScriptEngine} + * base on {@literal @}{@link ScriptEngineRule} annotation. + * + * @author Sebastian Menski + */ +public class ScriptEngineRule implements TestRule { + + private static final SpinTestLogger LOG = SpinTestLogger.TEST_LOGGER; + + private static final Map cachedEngines = new HashMap<>(); + + private static final String GRAAL_JS_SCRIPT_ENGINE_NAME = "Graal.js"; + + private javax.script.ScriptEngine scriptEngine; + + + public Statement apply(final Statement base, final Description description) { + return new Statement() { + public void evaluate() throws Throwable { + scriptEngine = createScriptEngine(description); + if (scriptEngine != null) { + LOG.scriptEngineFoundForLanguage(scriptEngine.getFactory().getLanguageName()); + } + base.evaluate(); + } + }; + } + + /** + * Create script engine from {@literal @}{@link org.camunda.spin.impl.test.ScriptEngine} Annotation. The created + * script engines will be cached to speedup subsequent creations. + * + * @param description the {@link Description} of the test method + * @return the script engine or null if no suitable found + */ + private ScriptEngine createScriptEngine(Description description) { + org.camunda.spin.impl.test.ScriptEngine annotation = description.getTestClass().getAnnotation(org.camunda.spin.impl.test.ScriptEngine.class); + if (annotation == null) { + return null; + } + else { + String language = annotation.value(); + if (!cachedEngines.containsKey(language)) { + ScriptEngine engine = new ScriptEngineManager().getEngineByName(language); + if (engine == null) { + throw LOG.noScriptEngineFoundForLanguage(language); + } + if (GRAAL_JS_SCRIPT_ENGINE_NAME.equals(engine.getFactory().getEngineName())) { + configureGraalJsScriptEngine(engine); + } + cachedEngines.put(language, engine); + } + return cachedEngines.get(language); + } + } + + /** + * Get the script engine defined by the {@literal @}{@link org.camunda.spin.impl.test.ScriptEngine} Annotation + * + * @return the script engine or null if no script engine was found + */ + public ScriptEngine getScriptEngine() { + return scriptEngine; + } + + protected void configureGraalJsScriptEngine(ScriptEngine scriptEngine) { + // make sure GraalVM JS can provide access the host and can lookup classes + scriptEngine.getContext().setAttribute("polyglot.js.allowHostAccess", true, ScriptContext.ENGINE_SCOPE); + scriptEngine.getContext().setAttribute("polyglot.js.allowHostClassLookup", true, ScriptContext.ENGINE_SCOPE); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRule.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRule.java new file mode 100644 index 0000000000000000000000000000000000000000..4070209899c1d3d23b64c6a3a021622500597b3d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRule.java @@ -0,0 +1,368 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import java.io.File; +import java.io.Reader; +import java.util.HashMap; +import java.util.Map; + +import javax.script.Bindings; +import javax.script.ScriptEngine; +import javax.script.ScriptException; +import javax.script.SimpleBindings; + +import org.camunda.spin.SpinScriptException; +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.scripting.SpinScriptEnv; +import org.graalvm.polyglot.Value; +import org.junit.ClassRule; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +/** + * A jUnit4 {@link TestRule} to load and execute a script. To + * execute a {@link org.camunda.spin.impl.test.ScriptEngine} {@link ClassRule} + * is used to obtain a {@link ScriptEngine}. + * + * @author Sebastian Menski + * @author Daniel Meyer + */ +public class ScriptRule implements TestRule { + + private static final SpinTestLogger LOG = SpinTestLogger.TEST_LOGGER; + + private String script; + private String scriptPath; + private ScriptEngine scriptEngine; + + /** + * The variables of the script accessed during script execution. + */ + protected final Map variables = new HashMap<>(); + + public Statement apply(final Statement base, final Description description) { + return new Statement() { + public void evaluate() throws Throwable { + loadScript(description); + base.evaluate(); + tearDownVariables(); + } + }; + } + + protected void tearDownVariables() { + for (Object variable : variables.values()) { + if (variable != null && Reader.class.isAssignableFrom(variable.getClass())) { + Reader reader = (Reader) variable; + SpinIoUtil.closeSilently(reader); + } + } + } + + /** + * Load a script and the script variables defined. Also execute the + * script if {@link Script#execute()} is {@link true}. + * + * @param description the description of the test method + * @throws Throwable + */ + private void loadScript(Description description) throws Throwable { + scriptEngine = getScriptEngine(description); + if (scriptEngine == null) { + return; + } + + script = getScript(description); + collectScriptVariables(description); + if (scriptEngine.getFactory().getLanguageName().equalsIgnoreCase("ruby")) { + // set magic property to remove all internal variables of the ruby scripting engine + // otherwise global variables will live forever + variables.put("org.jruby.embed.clear.variables", true); + } + boolean execute = isExecuteScript(description); + if (execute) { + executeScript(); + } + } + + /** + * Returns the {@link ScriptEngine} of the {@link ScriptEngineRule} of the + * test class. + * + * @param description the description of the test method + * @return the script engine found or null + */ + private ScriptEngine getScriptEngine(Description description) { + try { + ScriptEngineRule scriptEngineRule = (ScriptEngineRule) description.getTestClass().getField("scriptEngine").get(null); + return scriptEngineRule.getScriptEngine(); + } catch (NoSuchFieldException e) { + return null; + } catch (IllegalAccessException e) { + return null; + } + } + + /** + * Return the script as {@link String} based on the {@literal @}{@link Script} annotation + * of the test method. + * + * @param description the description of the test method + * @return the script as string or null if no script was found + */ + private String getScript(Description description) { + Script scriptAnnotation = description.getAnnotation(Script.class); + if (scriptAnnotation == null) { + return null; + } + String scriptBasename = getScriptBasename(scriptAnnotation, description); + scriptPath = getScriptPath(scriptBasename, description); + File file = SpinIoUtil.getClasspathFile(scriptPath, description.getTestClass().getClassLoader()); + return SpinIoUtil.fileAsString(file); + } + + /** + * Collect all {@literal @}{@link ScriptVariable} annotations of the test method + * and save the variables in the {@link #variables} field. + * + * @param description the description of the test method + */ + private void collectScriptVariables(Description description) { + ScriptVariable scriptVariable = description.getAnnotation(ScriptVariable.class); + collectScriptVariable(scriptVariable, description); + + Script script = description.getAnnotation(Script.class); + if (script != null) { + for (ScriptVariable variable : script.variables()) { + collectScriptVariable(variable, description); + } + } + } + + /** + * Extract the variable of a single {@literal @}{@link ScriptVariable} annotation. + * + * @param scriptVariable the annotation + * @param description the description of the test method + */ + private void collectScriptVariable(ScriptVariable scriptVariable, Description description) { + if (scriptVariable == null) { + return; + } + + String name = scriptVariable.name(); + String value = scriptVariable.value(); + String filename = scriptVariable.file(); + boolean isNull = scriptVariable.isNull(); + if (isNull) { + variables.put(name, null); + LOG.scriptVariableFound(name, "isNull", null); + } + else if (!filename.isEmpty()) { + Reader fileAsReader = SpinIoUtil.classpathResourceAsReader(filename); + variables.put(name, fileAsReader); + LOG.scriptVariableFound(name, "reader", filename); + } + else { + variables.put(name, value); + LOG.scriptVariableFound(name, "string", value); + } + } + + /** + * Determines if the script should be executed before the call of the + * java test method. + * + * @param description the description of the test method + * @return true if the script should be executed in front or false otherwise + */ + private boolean isExecuteScript(Description description) { + Script annotation = description.getAnnotation(Script.class); + return annotation != null && annotation.execute(); + } + + /** + * Executes the script with the set variables. + * @throws Throwable + * + * @throws SpinScriptException if an error occurs during the script execution + */ + private void executeScript() throws Throwable { + if (scriptEngine != null) { + try { + String environment = SpinScriptEnv.get(scriptEngine.getFactory().getLanguageName()); + + Bindings bindings = new SimpleBindings(variables); + LOG.executeScriptWithScriptEngine(scriptPath, scriptEngine.getFactory().getEngineName()); + scriptEngine.eval(environment, bindings); + scriptEngine.eval(script, bindings); + } catch (ScriptException e) { + if ("graal.js".equalsIgnoreCase(scriptEngine.getFactory().getEngineName())) { + throw e.getCause(); + } + throw LOG.scriptExecutionError(scriptPath, e); + } + } + } + + /** + * Execute the script and add the given variables to the script variables. + * + * @param scriptVariables the variables to set additionally + * @return this script rule + * @throws Throwable + * @throws SpinScriptException if an error occurs during the script execution + */ + public ScriptRule execute(Map scriptVariables) throws Throwable { + variables.putAll(scriptVariables); + executeScript(); + return this; + } + + /** + * Execute the script + * + * @return this script rule + * @throws Throwable + * @throws SpinScriptException if an error occurs during the script execution + */ + public ScriptRule execute() throws Throwable { + executeScript(); + return this; + } + + /** + * Determines the base filename of the script. + * + * @param scriptAnnotation the script annotation of the test method + * @param description the description of the test method + * @return the base filename of the script + */ + private String getScriptBasename(Script scriptAnnotation, Description description) { + String scriptBasename = scriptAnnotation.value(); + if (scriptBasename.isEmpty()) { + scriptBasename = scriptAnnotation.name(); + } + if (scriptBasename.isEmpty()) { + scriptBasename = description.getTestClass().getSimpleName() + "." + description.getMethodName(); + } + return scriptBasename; + } + + /** + * Returns the directory path of the package. + * + * @param description the description of the test method + * @return the directory for the package + */ + private String getPackageDirectoryPath(Description description) { + String packageName = description.getTestClass().getPackage().getName(); + return replaceDotsWithPathSeparators(packageName) + File.separator; + } + + /** + * Replace all dots in the path with the {@link File#separator} character. + * + * @param path the path to process + * @return the processed path + */ + private String replaceDotsWithPathSeparators(String path) { + return path.replace(".", File.separator); + } + + /** + * Returns the full path of the script based on package and basename. + * + * @param scriptBasename the basename of the script file + * @param description the description of the test method + * @return the full path + */ + private String getScriptPath(String scriptBasename, Description description) { + return getPackageDirectoryPath(description) + scriptBasename + getScriptExtension(); + } + + /** + * Returns the script file extension based on the {@link ScriptEngine} language. + * + * @return the file extension or empty string if none was found + */ + private String getScriptExtension() { + String languageName = scriptEngine.getFactory().getLanguageName(); + String extension = SpinScriptEnv.getExtension(languageName); + if (extension == null) { + LOG.noScriptExtensionFoundForScriptLanguage(languageName); + return ""; + } + else { + return "." + extension; + } + } + + /** + * Returns the value of a named script variable + * @param name the name of the variable + * @return the value of the variable or null if the variable does not exist. + */ + @SuppressWarnings("unchecked") + public T getVariable(String name) { + try { + if (scriptEngine.getFactory().getLanguageName().equals("ECMAScript")) { + return (T) getVariableJs(name); + } + else { + return (T) variables.get(name); + } + } catch(ClassCastException e) { + throw LOG.cannotCastVariableError(name, e); + } + } + + /** + * If JavaScript engine is used the variable may be placed in the global + * variable map. + * + * @param name the name of the variable + * @return the variable if found or null + */ + @SuppressWarnings("unchecked") + private Object getVariableJs(String name) { + Object variable = variables.get(name); + if (variable == null) { + if (variables.containsKey("nashorn.global")) { + variable = ((Map) variables.get("nashorn.global")).get(name); + } else if (variables.containsKey("polyglot.context")) { + Value member = ((org.graalvm.polyglot.Context)variables.get("polyglot.context")).getBindings("js").getMember(name); + variable = member == null ? null : member.as(Object.class); + } + } + return variable; + } + + /** + * Set the variable with the given name + * @param name the name of the variable + * @param value value of the variable + * @return this script rule + */ + public ScriptRule setVariable(String name, Object value) { + variables.put(name, value); + return this; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ea403c273cda00e02d11907ccccb54a707598a9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptRuleTest.java @@ -0,0 +1,48 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Sebastian Menski + */ +public abstract class ScriptRuleTest extends ScriptTest { + + @Test + @Script + public void shouldSetFoo() { + Object foo = script.getVariable("foo"); + assertThat(foo).isNotNull(); + + Object bar = script.getVariable("bar"); + assertThat(bar).isNull(); + } + + @Test + @Script + public void shouldSetBar() { + Object foo = script.getVariable("foo"); + assertThat(foo).isNull(); + + Object bar = script.getVariable("bar"); + assertThat(bar).isNotNull(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..425add7f349b12c9b9046b587997f24848013437 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptTest.java @@ -0,0 +1,57 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import java.util.Map; + +import org.camunda.spin.SpinScriptException; +import org.junit.ClassRule; +import org.junit.Rule; + +/** + * Base script test which loads an engine and provides the + * script as field. + * + * @author Sebastian Menski + */ +public abstract class ScriptTest { + + @ClassRule + public static ScriptEngineRule scriptEngine = new ScriptEngineRule(); + + @Rule + public ScriptRule script = new ScriptRule(); + + protected void failingWithException() throws Throwable { + try { + script.execute(); + } + catch (SpinScriptException e) { + throw e.getCause().getCause().getCause(); + } + } + + protected void failingWithException(Map variables) throws Throwable { + try { + script.execute(variables); + } + catch (SpinScriptException e) { + throw e.getCause().getCause().getCause(); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptVariable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptVariable.java new file mode 100644 index 0000000000000000000000000000000000000000..749eaea60a244623a296dabd8afa007fb5156dde --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/ScriptVariable.java @@ -0,0 +1,63 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import java.lang.annotation.*; + +/** + * Annotation to define script variable bindings. Either used directly + * in on the test method (if only one variable should be defined) + * + *
+ *   {@literal @}Test
+ *   {@literal @}Script
+ *   {@literal @}ScriptVariable(name="input", value="test")
+ *   public void shouldAccessInputVariable() {
+ *     //...
+ *   }
+ * 
+ * + * or in a list as the variables argument of the {@literal @}{@link Script} Annotation + * + *
+ *   {@literal @}Test
+ *   {@literal @}Script{
+ *     variables = {
+ *       @ScriptVariable(name="input", value="test"),
+ *       @ScriptVariable(name="customerFile", file="customer.xml"),
+ *     }
+ *   }
+ *   public void shouldAccessInputVariableAndCustomers() {
+ *     //...
+ *   }
+ * 
+ * + * @author Sebastian Menski + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface ScriptVariable { + + String name(); + + String value() default ""; + + String file() default ""; + + boolean isNull() default false; + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/SpinTestLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/SpinTestLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..b30fa5d68f7e471a206463dcdc4bf6508c518698 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/SpinTestLogger.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test; + +import org.camunda.commons.logging.BaseLogger; +import org.camunda.spin.SpinRuntimeException; +import org.camunda.spin.SpinScriptException; +import org.camunda.spin.impl.logging.SpinLogger; + +/** + * Logger for test cases. + * + * @author Sebastian Menski + */ +public class SpinTestLogger extends SpinLogger { + + public static final SpinTestLogger TEST_LOGGER = BaseLogger.createLogger(SpinTestLogger.class, PROJECT_CODE, "org.camunda.spin.test", "02"); + + public void scriptEngineFoundForLanguage(String scriptLanguage) { + logInfo("001", "Script engine found for script language '{}'", scriptLanguage); + } + + public void scriptLoaded(String scriptPath) { + logInfo("002", "Script loaded with filename '{}'", scriptPath); + } + + public void scriptVariableFound(String name, String type, String value) { + logInfo("003", "Script variable found with name '{}', type '{}' and value '{}'", name, type, value); + } + + public void noScriptExtensionFoundForScriptLanguage(String languageName) { + logWarn("004", "No script extension found for script language '{}'", languageName); + } + + public void testDisabled(String reason) { + logInfo("005", "Test disabled because '{}'", reason); + } + + public void executeScriptWithScriptEngine(String scriptPath, String engineName) { + logInfo("006", "Execute script '{}' with script engine '{}'", scriptPath, engineName); + } + + public SpinScriptException noScriptEngineFoundForLanguage(String scriptLanguage) { + return new SpinScriptException(exceptionMessage("002", "No script engine found for script language '{}'", scriptLanguage)); + } + + public SpinScriptException scriptExecutionError(String scriptPath, Throwable cause) { + return new SpinScriptException(exceptionMessage("004", "Error during execution of script '{}'", scriptPath), cause); + } + + public SpinScriptException cannotCastVariableError(String name, Throwable e) { + return new SpinScriptException(exceptionMessage("005", "Cannot cast variable '{}', wrong type", name), e); + } + + public SpinScriptException unableToUnwrapRhinoJsVariable(String name, Throwable e) { + return new SpinScriptException(exceptionMessage("006", "Unable to unwrap rhinojs variable with name '{}'", name), e); + } + + public SpinScriptException unableToFindUnwrapMethod(Throwable e) { + return new SpinScriptException(exceptionMessage("007", "Unable to find unwrap method of NativeJavaObject")); + } + + public SpinRuntimeException unableToUnwrapRhinoJsWrappedException(String message) { + return new SpinScriptException(exceptionMessage("008", "Unable to unwrap rhinojs wrapped exception with message '{}'", message)); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..bfa88c590cff853736991bdb4949ec25e3071e1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test.script; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptRuleTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("groovy") +public class GroovyScriptRuleTest extends ScriptRuleTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.java new file mode 100644 index 0000000000000000000000000000000000000000..919a5c019186686acc191897d0d8ffdc0908d27d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test.script; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptRuleTest; + +@ScriptEngine("nashorn") +public class JavascriptScriptRuleNashornTest extends ScriptRuleTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..445a1e84e4e55e4c62b31da5a58d7e840b1d447f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test.script; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptRuleTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("graal.js") +public class JavascriptScriptRuleTest extends ScriptRuleTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/PythonScriptRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/PythonScriptRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..68ecabab1fb92f1c4bf4d7994f615533ea302010 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/PythonScriptRuleTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test.script; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptRuleTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("python") +public class PythonScriptRuleTest extends ScriptRuleTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/RubyScriptRuleTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/RubyScriptRuleTest.java new file mode 100644 index 0000000000000000000000000000000000000000..76d5159ba7b41bec080a39e30f9a8ef8baf5a762 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/test/script/RubyScriptRuleTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.test.script; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptRuleTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("ruby") +public class RubyScriptRuleTest extends ScriptRuleTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/util/RewindableReaderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/util/RewindableReaderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..815bcacf2165f2441311c0af3f9000896eee52ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/impl/util/RewindableReaderTest.java @@ -0,0 +1,216 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.util; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.util.Arrays; + +import org.junit.After; +import org.junit.Test; + +public class RewindableReaderTest { + + private static final String EXAMPLE_INPUT_STRING = "a long string with content"; + private static final int DEFAULT_BUFFER_SIZE = 10; + + protected RewindableReader reader; + + @Test + public void shouldRead() throws IOException { + // read(char[]) + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + assertThat(reader.getRewindBufferSize()).isEqualTo(DEFAULT_BUFFER_SIZE); + assertThat(reader.getCurrentRewindableCapacity()).isEqualTo(DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[5]; + int charactersRead = reader.read(buffer); + + String bufferAsString = new String(buffer); + + assertThat(charactersRead).isEqualTo(5); + assertThat(reader.getCurrentRewindableCapacity()).isEqualTo(DEFAULT_BUFFER_SIZE - 5); + + assertThat(bufferAsString).isEqualTo(EXAMPLE_INPUT_STRING.substring(0, 5)); + + reader.close(); + + // read(char[], off, len) + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + buffer = new char[5]; + charactersRead = reader.read(buffer, 2, 3); + + assertThat(charactersRead).isEqualTo(3); + + assertThat(buffer[0]).isEqualTo((char) 0); + assertThat(buffer[1]).isEqualTo((char) 0); + + bufferAsString = new String(Arrays.copyOfRange(buffer, 2, 4)); + assertThat(bufferAsString).isEqualTo(EXAMPLE_INPUT_STRING.substring(0, 2)); + + // read() + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + char charRead = (char) reader.read(); + assertThat(charRead).isEqualTo('a'); + + reader.close(); + } + + @Test + public void shouldRewind() throws IOException { + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[5]; + reader.read(buffer); + + reader.rewind(); + + assertThat(SpinIoUtil.getStringFromReader(reader)).isEqualTo(EXAMPLE_INPUT_STRING); + } + + @Test + public void shouldRewindAfterRepeatedRead() throws IOException { + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[5]; + reader.read(buffer); + reader.read(buffer); + + reader.rewind(); + + assertThat(SpinIoUtil.getStringFromReader(reader)).isEqualTo(EXAMPLE_INPUT_STRING); + } + + @Test + public void shouldReadAndRewindWhenEndOfInputIsReached() throws IOException { + String input = EXAMPLE_INPUT_STRING.substring(0, 5); + + reader = newReaderInstance(input, DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[10]; + int charactersRead = reader.read(buffer); + String bufferAsString = + new String(Arrays.copyOfRange(buffer, 0, charactersRead)); + + assertThat(charactersRead).isEqualTo(5); + assertThat(bufferAsString).isEqualTo(input); + + charactersRead = reader.read(buffer); + assertThat(charactersRead).isEqualTo(-1); + + reader.rewind(); + + charactersRead = reader.read(buffer); + bufferAsString = + new String(Arrays.copyOfRange(buffer, 0, charactersRead)); + + assertThat(charactersRead).isEqualTo(5); + assertThat(bufferAsString).isEqualTo(input); + } + + @Test + public void shouldReadRemainder() throws IOException { + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[5]; + reader.read(buffer); + + assertThat(SpinIoUtil.getStringFromReader(reader)).isEqualTo(EXAMPLE_INPUT_STRING.substring(5)); + } + + /** + * When reading more characters than fits into the reader's buffer + * @throws IOException + */ + @Test + public void shouldFailWhenRewindLimitExceeded() throws IOException { + // exceeding with read(char[]) + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + char[] buffer = new char[DEFAULT_BUFFER_SIZE + 5]; + reader.read(buffer); + + assertThat(SpinIoUtil.getStringFromReader(reader)) + .isEqualTo(EXAMPLE_INPUT_STRING.substring(DEFAULT_BUFFER_SIZE + 5)); + + try { + reader.rewind(); + fail("IOException expected"); + } catch (IOException e) { + // happy path + } + + // exceeding with read() + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + buffer = new char[DEFAULT_BUFFER_SIZE]; + reader.read(buffer); + reader.read(); + + try { + reader.rewind(); + fail("IOException expected"); + } catch (IOException e) { + // happy path + } + + // repeated read(char[]) + reader = newReaderInstance(EXAMPLE_INPUT_STRING, DEFAULT_BUFFER_SIZE); + + buffer = new char[DEFAULT_BUFFER_SIZE]; + reader.read(buffer); + reader.read(buffer); + + try { + reader.rewind(); + fail("IOException expected"); + } catch (IOException e) { + // happy path + } + } + + @Test + public void shouldRewindWhenNothingWasRead() throws IOException { + reader = newReaderInstance("", DEFAULT_BUFFER_SIZE); + + int charRead = reader.read(); + assertThat(charRead).isEqualTo(-1); + + reader.rewind(); + + charRead = reader.read(); + assertThat(charRead).isEqualTo(-1); + } + + @After + public void closeReader() { + if (reader != null) { + SpinIoUtil.closeSilently(reader); + } + } + + protected RewindableReader newReaderInstance(String input, int bufferSize) { + Reader reader = new StringReader(input); + return new RewindableReader(reader, bufferSize); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/CustomDataFormatProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/CustomDataFormatProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..9c7ca135c22aae0680b2bbd9c7d60969340fcea0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/CustomDataFormatProvider.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + + +import java.util.Map; + +/** + * @author Thorben Lindhauer + * + */ +public class CustomDataFormatProvider implements DataFormatProvider { + + public static final String NAME = "test-data-format"; + public static final ExampleCustomDataFormat DATA_FORMAT = new ExampleCustomDataFormat(NAME); + + @Override + public String getDataFormatName() { + return NAME; + } + + @Override + public DataFormat createInstance() { + return DATA_FORMAT; + } + + @Override + public DataFormat createInstance(Map configurationProperties) { + boolean conditionalProperty = (boolean) configurationProperties.getOrDefault("conditional-prop", false); + DATA_FORMAT.setConditionalProperty(conditionalProperty); + return DATA_FORMAT; + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/DataFormatLoadingTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/DataFormatLoadingTest.java new file mode 100644 index 0000000000000000000000000000000000000000..edb5d9b61e76b6a7db81899b5c4a8785b538bb94 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/DataFormatLoadingTest.java @@ -0,0 +1,176 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.powermock.api.mockito.PowerMockito.mock; +import static org.powermock.api.mockito.PowerMockito.mockStatic; +import static org.powermock.api.mockito.PowerMockito.when; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.ServiceLoader; + +import org.camunda.spin.DataFormats; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Matchers; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +/** + * Note: The @RunWith and @PrepareForTest annotations are required by powermock to be able + * to mock static methods provided by the JDK (i.e. ServiceLoader.load(..) in our case). + * See https://code.google.com/p/powermock/wiki/MockSystem and + * https://code.google.com/p/powermock/wiki/MockStatic + * + * @author Thorben Lindhauer + */ +@RunWith(PowerMockRunner.class) +public class DataFormatLoadingTest { + + protected ServiceLoader mockServiceLoader; + + @SuppressWarnings("rawtypes") + protected ServiceLoader mockConfiguratorLoader; + + @Before + @SuppressWarnings("unchecked") + public void setUp() { + mockStatic(ServiceLoader.class); + + mockServiceLoader = mock(ServiceLoader.class); + when(ServiceLoader.load(Matchers.eq(DataFormatProvider.class), Matchers.any(ClassLoader.class))) + .thenReturn(mockServiceLoader); + + mockConfiguratorLoader = mock(ServiceLoader.class); + when(ServiceLoader.load(Matchers.eq(DataFormatConfigurator.class), Matchers.any(ClassLoader.class))) + .thenReturn(mockConfiguratorLoader); + } + + @Test + @PrepareForTest( { DataFormats.class }) + public void testCustomDataFormatProvider() { + // given a custom data format provider that is returned by the service loader API + mockProviders(new CustomDataFormatProvider()); + mockConfigurators(); + + // when the custom data format is requested + DataFormat customDataFormat = DataFormats.getDataFormat(CustomDataFormatProvider.NAME); + + // then it should be properly returned + assertThat(customDataFormat).isNotNull(); + assertThat(customDataFormat).isSameAs(CustomDataFormatProvider.DATA_FORMAT); + } + + + @Test + @PrepareForTest( { DataFormats.class }) + public void testConfigureDataFormat() { + // given a custom data format provider that is returned by the service loader API + mockProviders(new CustomDataFormatProvider()); + mockConfigurators(new ExampleCustomDataFormatConfigurator()); + + DataFormat format = DataFormats.getDataFormat(CustomDataFormatProvider.NAME); + assertThat(format).isSameAs(CustomDataFormatProvider.DATA_FORMAT); + + // then the configuration was applied + ExampleCustomDataFormat customFormat = (ExampleCustomDataFormat) format; + assertThat(customFormat.getProperty()).isEqualTo(ExampleCustomDataFormatConfigurator.UPDATED_PROPERTY); + } + + @Test + @PrepareForTest(DataFormats.class) + public void testConfigureDataFormatWithConfiguratorList() { + // given a custom data format provider that is returned by the service loader API + mockProviders(new CustomDataFormatProvider()); + mockConfigurators(); + DataFormatConfigurator configurator = new ExampleCustomDataFormatConfigurator(); + + // when a list of data format configurators is passed to the "load" method + DataFormats.loadDataFormats(DataFormats.class.getClassLoader(), + Collections.singletonList(configurator)); + + // then the configuration was applied + ExampleCustomDataFormat customFormat = (ExampleCustomDataFormat) DataFormats + .getDataFormat(CustomDataFormatProvider.NAME); + assertThat(customFormat.getProperty()) + .isEqualTo(ExampleCustomDataFormatConfigurator.UPDATED_PROPERTY); + } + + @Test + @PrepareForTest(DataFormats.class) + public void testRegisterDataFormatWithConfiguratorList() { + // given a custom data format provider that is returned by the service loader API + mockProviders(new CustomDataFormatProvider()); + mockConfigurators(); + DataFormatConfigurator configurator = new ExampleCustomDataFormatConfigurator(); + + // when a list of data format configurators is passed to the "load" method + DataFormats.getInstance().registerDataFormats(DataFormats.class.getClassLoader(), + Collections.singletonList(configurator)); + + // then the configuration was applied + ExampleCustomDataFormat customFormat = (ExampleCustomDataFormat) DataFormats + .getDataFormat(CustomDataFormatProvider.NAME); + assertThat(customFormat.getProperty()) + .isEqualTo(ExampleCustomDataFormatConfigurator.UPDATED_PROPERTY); + } + + @Test + @PrepareForTest(DataFormats.class) + public void shouldPassConfiguratorPropertiesToProvider() { + // given a custom data format provider that is returned by the service loader API + mockProviders(new CustomDataFormatProvider()); + mockConfigurators(); + + // when a map of configuration properties is passed to the "load" method + DataFormats.getInstance().registerDataFormats(DataFormats.class.getClassLoader(), + Collections.EMPTY_LIST, + Collections.singletonMap("conditional-prop", true)); + + // then the configuration property is applied + ExampleCustomDataFormat customFormat = (ExampleCustomDataFormat) DataFormats + .getDataFormat(CustomDataFormatProvider.NAME); + assertThat(customFormat.isConditionalProperty()) + .isTrue(); + } + + protected void mockProviders(final DataFormatProvider... providers) { + when(mockServiceLoader.iterator()).thenAnswer(new Answer>() { + + @Override + public Iterator answer(InvocationOnMock invocation) throws Throwable { + return Arrays.asList(providers).iterator(); + } + }); + } + + protected void mockConfigurators(final DataFormatConfigurator... configurators) { + when(mockConfiguratorLoader.iterator()).thenAnswer(new Answer>>() { + + @Override + public Iterator> answer(InvocationOnMock invocation) throws Throwable { + return Arrays.asList(configurators).iterator(); + } + }); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormat.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..9fd34385bc148d9bd27006e2e0b2f7588e8997f8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormat.java @@ -0,0 +1,80 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + +import org.camunda.spin.json.SpinJsonNode; + +/** + * @author Thorben Lindhauer + * + */ +public class ExampleCustomDataFormat implements DataFormat { + + protected String name; + protected String property = "defaultValue"; + protected boolean conditionalProperty = false; + + public ExampleCustomDataFormat(String name) { + this.name = name; + } + + @Override + public String getName() { + return name; + } + + @Override + public Class getWrapperType() { + return null; + } + + @Override + public SpinJsonNode createWrapperInstance(Object parameter) { + return null; + } + + @Override + public DataFormatReader getReader() { + return null; + } + + @Override + public DataFormatWriter getWriter() { + return null; + } + + @Override + public DataFormatMapper getMapper() { + return null; + } + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public boolean isConditionalProperty() { + return conditionalProperty; + } + + public void setConditionalProperty(boolean conditionalProperty) { + this.conditionalProperty = conditionalProperty; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormatConfigurator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormatConfigurator.java new file mode 100644 index 0000000000000000000000000000000000000000..94d063d7ffc05e24e20711e765162740a2bab2e4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/java/org/camunda/spin/spi/ExampleCustomDataFormatConfigurator.java @@ -0,0 +1,38 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.spi; + + + +/** + * @author Thorben Lindhauer + * + */ +public class ExampleCustomDataFormatConfigurator implements DataFormatConfigurator { + + public static final String UPDATED_PROPERTY = "updatedProperty"; + + @Override + public Class getDataFormatClass() { + return ExampleCustomDataFormat.class; + } + + @Override + public void configure(ExampleCustomDataFormat dataFormat) { + dataFormat.setProperty(UPDATED_PROPERTY); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/logback-test.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/logback-test.xml new file mode 100644 index 0000000000000000000000000000000000000000..650a86c01c0c57d0a7ce102937833fd744fbd8d6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/logback-test.xml @@ -0,0 +1,11 @@ + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetBar.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetBar.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ee84c16fc3e3f04fbffec05d68b0dbee2dab3cf5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetBar.groovy @@ -0,0 +1 @@ +bar = 'bar' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetFoo.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetFoo.groovy new file mode 100644 index 0000000000000000000000000000000000000000..7d854c9e36441850a2b7b6017b6d1731109d8e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/GroovyScriptRuleTest.shouldSetFoo.groovy @@ -0,0 +1 @@ +foo = 'foo' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetBar.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetBar.js new file mode 100644 index 0000000000000000000000000000000000000000..ee84c16fc3e3f04fbffec05d68b0dbee2dab3cf5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetBar.js @@ -0,0 +1 @@ +bar = 'bar' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetFoo.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetFoo.js new file mode 100644 index 0000000000000000000000000000000000000000..7d854c9e36441850a2b7b6017b6d1731109d8e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleNashornTest.shouldSetFoo.js @@ -0,0 +1 @@ +foo = 'foo' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetBar.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetBar.js new file mode 100644 index 0000000000000000000000000000000000000000..ee84c16fc3e3f04fbffec05d68b0dbee2dab3cf5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetBar.js @@ -0,0 +1 @@ +bar = 'bar' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetFoo.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetFoo.js new file mode 100644 index 0000000000000000000000000000000000000000..7d854c9e36441850a2b7b6017b6d1731109d8e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/JavascriptScriptRuleTest.shouldSetFoo.js @@ -0,0 +1 @@ +foo = 'foo' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetBar.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetBar.py new file mode 100644 index 0000000000000000000000000000000000000000..ee84c16fc3e3f04fbffec05d68b0dbee2dab3cf5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetBar.py @@ -0,0 +1 @@ +bar = 'bar' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetFoo.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetFoo.py new file mode 100644 index 0000000000000000000000000000000000000000..7d854c9e36441850a2b7b6017b6d1731109d8e2f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/PythonScriptRuleTest.shouldSetFoo.py @@ -0,0 +1 @@ +foo = 'foo' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetBar.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetBar.rb new file mode 100644 index 0000000000000000000000000000000000000000..b48812b77411979f8939b117cd6ba5078fda4ff4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetBar.rb @@ -0,0 +1 @@ +$bar = 'bar' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetFoo.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetFoo.rb new file mode 100644 index 0000000000000000000000000000000000000000..3da8b9ea806914c9539fcaf75d26a76a72014f66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/core/src/test/resources/org/camunda/spin/impl/test/script/RubyScriptRuleTest.shouldSetFoo.rb @@ -0,0 +1 @@ +$foo = 'foo' diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a91e031700ebc237f26d53c6cfab15ef22c22f36 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/pom.xml @@ -0,0 +1,192 @@ + + 4.0.0 + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + org.camunda.spin + camunda-spin-root + 7.24.0-SNAPSHOT + + + camunda-spin-dataformat-all + camunda Spin - all dataformats in one + + + + false + + compile|runtime + + + + + + org.camunda.spin + camunda-spin-dataformat-json-jackson + + + + org.camunda.spin + camunda-spin-dataformat-xml-dom + + + + jakarta.xml.bind + jakarta.xml.bind-api + + + + com.sun.xml.bind + jaxb-impl + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.0 + + + package + + shade + + + true + true + true + + + org.camunda.commons:* + org.camunda.spin:camunda-spin-core + org.slf4j:* + + + + + com.fasterxml + spinjar.com.fasterxml + + + com.jayway + spinjar.com.jayway + + + net.minidev + spinjar.com.minidev + + + org.objectweb + spinjar.com.objectweb + + + + com.sun.istack + spinjar.com.sun.istack + + + com.sun.activation + spinjar.com.sun.activation + + + com.sun.xml.bind + spinjar.com.sun.xml.bind + + + com.sun.xml.txw2 + spinjar.com.sun.xml.txw2 + + + javax.xml.bind + spinjar.javax.xml.bind + + + javax.activation + spinjar.javax.activation + + + + + + + + com.sun.xml.bind:* + + META-INF/services/javax.xml.bind.JAXBContext + + + + *:* + + module-info.class + + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + true + true + org.camunda.spin:* + + + junit + junit + ${version.junit} + + + + + + org.apache.felix + maven-bundle-plugin + + false + + + ${project.groupId}* + + + !spinjar*, + !org.junit*, + !org.slf4j.impl, + !com.fasterxml*, + !com.jayway, + !net.minidev.json*, + !org.codehaus.jackson*, + org.slf4j, + org.camunda.commons.utils, + org.camunda.commons.logging, + * + + . + *;inline=true + true + + + + + bundle-manifest + process-classes + + manifest + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/src/main/resources/META-INF/MANIFEST.MF b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/src/main/resources/META-INF/services/spinjar.javax.xml.bind.JAXBContext b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/src/main/resources/META-INF/services/spinjar.javax.xml.bind.JAXBContext new file mode 100644 index 0000000000000000000000000000000000000000..c32c73ab18f2e1bcbe81a23f0d82a47571a224cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-all/src/main/resources/META-INF/services/spinjar.javax.xml.bind.JAXBContext @@ -0,0 +1 @@ +spinjar.com.sun.xml.bind.v2.ContextFactory \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6580328c6295c5c655fd697585e0ecb3023898d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/pom.xml @@ -0,0 +1,267 @@ + + 4.0.0 + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + org.camunda.spin + camunda-spin-root + 7.24.0-SNAPSHOT + + + camunda-spin-dataformat-json-jackson + camunda Spin - Jackson JSON data format + + + + org.camunda.spin + camunda-spin-core + + + + org.camunda.commons + camunda-commons-logging + + + + org.camunda.commons + camunda-commons-utils + + + + com.fasterxml.jackson.core + jackson-core + + + + com.fasterxml.jackson.core + jackson-databind + + + + com.jayway.jsonpath + json-path + + + asm + org.ow2.asm + + + + + + junit + junit + test + + + + org.assertj + assertj-core + test + + + + org.apache.groovy + groovy-jsr223 + test + + + + org.apache.groovy + groovy-json + test + + + + org.python + jython + test + + + + org.jruby + jruby-complete + test + + + + org.graalvm.js + js + test + + + + org.graalvm.js + js-scriptengine + test + + + + ch.qos.logback + logback-classic + test + + + + net.javacrumbs.json-unit + json-unit-fluent + test + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.camunda.spin + camunda-spin-core + test-jar + test + + + + + + disable-javascript-tests + + (,1.8) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -XX:PermSize=128m -XX:MaxPermSize=256m + + **/javascript/** + + + + + + + + + jdk-15-and-onwards + + [15,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/nashorn/** + + + + + + + + + jdk-16-and-onwards + + [16,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -XX:MetaspaceSize=128m + + + **/nashorn/** + + + + + + + + + + check-api-compatibility + + (,) + + + + + org.codehaus.mojo + clirr-maven-plugin + 2.8 + + ${spin.version.old} + true + + org/camunda/spin/impl/** + + + + + all + verify + + check-no-fork + + + ${project.build.directory}/clirr-all.txt + false + false + + + + restrictive + verify + + check-no-fork + + + ${project.build.directory}/clirr-restrictive.txt + true + ../.clirr-jenkins-ignore.xml + + + + + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + bundle-manifest + process-classes + + manifest + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..8d07cfe32b5a3eb68e1d9c200524bcc5771975cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonLogger.java @@ -0,0 +1,118 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson; + +import org.camunda.commons.logging.BaseLogger; +import org.camunda.spin.impl.logging.SpinLogger; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPathException; +import org.camunda.spin.json.SpinJsonPropertyException; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.jayway.jsonpath.PathNotFoundException; + +/** + * @author Thorben Lindhauer + * @author Stefan Hentschel + */ +public class JacksonJsonLogger extends SpinLogger { + + public static final String PROJECT_CODE = SpinLogger.PROJECT_CODE + "/JACKSON-JSON"; + public static final JacksonJsonLogger JSON_TREE_LOGGER = BaseLogger.createLogger(JacksonJsonLogger.class, PROJECT_CODE, "org.camunda.spin.json", "01"); + + public SpinJsonDataFormatException unableToParseInput(Exception e) { + return new SpinJsonDataFormatException(exceptionMessage("001", "Unable to parse input into json node"), e); + } + + /** + * Exception handler if we are unable to parse a json value into a java representation + * + * @param expectedType Name of the expected Type + * @param type Type of the json node + * @return SpinJsonDataFormatException + */ + public SpinJsonDataFormatException unableToParseValue(String expectedType, JsonNodeType type) { + return new SpinJsonDataFormatException(exceptionMessage("002", "Expected '{}', got '{}'", expectedType, type.toString())); + } + + public SpinJsonDataFormatException unableToWriteJsonNode(Exception cause) { + return new SpinJsonDataFormatException(exceptionMessage("003", "Unable to write json node"), cause); + } + + public SpinJsonException unableToFindProperty(String propertyName) { + return new SpinJsonPropertyException(exceptionMessage("004", "Unable to find '{}'", propertyName)); + } + + public SpinJsonException unableToCreateNode(String objectType) { + return new SpinJsonPropertyException(exceptionMessage("005", "Unable to create node for object of type '{}'", objectType)); + } + + public SpinJsonException unableToDeserialize(JsonNode jsonNode, JavaType type, Exception cause) { + return new SpinJsonException( + exceptionMessage("006", "Cannot deserialize '{}...' to java type '{}'", + jsonNode.toString().substring(0, 10), type), cause); + } + + public SpinJsonDataFormatException unableToConstructJavaType(String fromString, Exception cause) { + return new SpinJsonDataFormatException( + exceptionMessage("007", "Cannot construct java type from string '{}'", fromString), cause); + } + + public SpinJsonDataFormatException unableToDetectCanonicalType(Object parameter) { + return new SpinJsonDataFormatException(exceptionMessage("008", "Cannot detect canonical data type for parameter '{}'", parameter)); + } + + public SpinJsonDataFormatException unableToMapInput(Object input, Exception cause) { + return new SpinJsonDataFormatException(exceptionMessage("009", "Unable to map object '{}' to json node", input), cause); + } + + public SpinJsonException unableToModifyNode(String nodeName) { + return new SpinJsonException(exceptionMessage("010", "Unable to modify node of type '{}'. Node is not a list.", nodeName)); + } + + public SpinJsonException unableToGetIndex(String nodeName) { + return new SpinJsonException(exceptionMessage("011", "Unable to get index from '{}'. Node is not a list.", nodeName)); + } + + public IndexOutOfBoundsException indexOutOfBounds(Integer index, Integer size) { + return new IndexOutOfBoundsException(exceptionMessage("012", "Index is out of bound! Index: '{}', Size: '{}'", index, size)); + } + + public SpinJsonPathException unableToEvaluateJsonPathExpressionOnNode(SpinJsonNode node, Exception cause) { + return new SpinJsonPathException( + exceptionMessage("013", "Unable to evaluate JsonPath expression on element '{}'", node.getClass().getName()), cause); + } + + public SpinJsonPathException unableToCompileJsonPathExpression(String expression, Exception cause) { + return new SpinJsonPathException( + exceptionMessage("014", "Unable to compile '{}'!", expression), cause); + } + + public SpinJsonPathException unableToCastJsonPathResultTo(Class castClass, Exception cause) { + return new SpinJsonPathException( + exceptionMessage("015", "Unable to cast JsonPath expression to '{}'", castClass.getName()), cause); + } + + public SpinJsonPathException invalidJsonPath(Class castClass, Exception cause) { + return new SpinJsonPathException( + exceptionMessage("017", "Invalid json path to '{}'", castClass.getName()), cause); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonNode.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonNode.java new file mode 100644 index 0000000000000000000000000000000000000000..455d27859884f2d1994695f432c6004777574ded --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/JacksonJsonNode.java @@ -0,0 +1,501 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +import java.io.StringWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.SpinListImpl; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatMapper; +import org.camunda.spin.impl.json.jackson.query.JacksonJsonPathQuery; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPathQuery; +import org.camunda.spin.spi.DataFormatMapper; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.jayway.jsonpath.InvalidPathException; +import com.jayway.jsonpath.JsonPath; + +/** + * Wrapper for a Jackson Json Tree Node. + * + * @author Thorben Lindhauer + * @author Stefan Hentschel + */ +public class JacksonJsonNode extends SpinJsonNode { + + private static final JacksonJsonLogger LOG = JacksonJsonLogger.JSON_TREE_LOGGER; + + protected final JsonNode jsonNode; + protected final JacksonJsonDataFormat dataFormat; + + + public JacksonJsonNode(JsonNode jsonNode, JacksonJsonDataFormat dataFormat) { + this.jsonNode = jsonNode; + this.dataFormat = dataFormat; + } + + public String getDataFormatName() { + return dataFormat.getName(); + } + + public JsonNode unwrap() { + return jsonNode; + } + + public String toString() { + StringWriter writer = new StringWriter(); + writeToWriter(writer); + return writer.toString(); + } + + public void writeToWriter(Writer writer) { + dataFormat.getWriter().writeToWriter(writer, jsonNode); + } + + /** + * fetch correct array index if index is less than 0 + * + * ArrayNode will convert all negative integers into 0... + * + * @param index wanted index + * @return {@link Integer} new index + */ + protected Integer getCorrectIndex(Integer index) { + Integer size = jsonNode.size(); + Integer newIndex = index; + + // reverse walking through the array + if(index < 0) { + newIndex = size + index; + } + + // the negative index would be greater than the size a second time! + if(newIndex < 0) { + throw LOG.indexOutOfBounds(index, size); + } + + // the index is greater as the actual size + if(index > size) { + throw LOG.indexOutOfBounds(index, size); + } + + return newIndex; + } + + protected int lookupArray(JsonNode searchNode, int direction) { + if(!this.isArray()) { + throw LOG.unableToGetIndex(jsonNode.getNodeType().name()); + } + int i = direction>0 ? 0 : jsonNode.size() - 1; + for (; i < jsonNode.size() && i >= 0; i += direction) { + if (jsonNode.get(i).equals(searchNode)){ + return i; + } + } + return -1; + } + + public Integer indexOf(Object searchObject) { + ensureNotNull("searchObject", searchObject); + JsonNode node = dataFormat.createJsonNode(searchObject); + int res = lookupArray(node, 1); + if(res == -1){ + throw LOG.unableToFindProperty(node.asText()); + } + return res; + } + + public Integer lastIndexOf(Object searchObject) { + ensureNotNull("searchObject", searchObject); + JsonNode node = dataFormat.createJsonNode(searchObject); + int res = lookupArray(node, -1); + if(res == -1){ + throw LOG.unableToFindProperty(node.asText()); + } + return res; + } + + public boolean contains(Object searchObject) { + ensureNotNull("searchObject", searchObject); + JsonNode node = dataFormat.createJsonNode(searchObject); + int res = lookupArray(node, 1); + return res != -1; + } + + public boolean isObject() { + return jsonNode.isObject(); + } + + public boolean hasProp(String name) { + return jsonNode.has(name); + } + + public SpinJsonNode prop(String name) { + ensureNotNull("name", name); + if(jsonNode.has(name)) { + JsonNode property = jsonNode.get(name); + return dataFormat.createWrapperInstance(property); + } else { + throw LOG.unableToFindProperty(name); + } + } + + public SpinJsonNode prop(String name, String newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + node.put(name, newProperty); + + return this; + } + + public SpinJsonNode prop(String name, Number newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + // Numbers magic because Jackson has no native .put(Number value) + if (newProperty == null) { + node.putNull(name); + } else if(newProperty instanceof Long) { + node.put(name, newProperty.longValue()); + } else if(newProperty instanceof Integer) { + node.put(name, newProperty.intValue()); + } else if(newProperty instanceof Float) { + node.put(name, newProperty.floatValue()); + } else { + // convert any other sub class of Number into Float + node.put(name, newProperty.floatValue()); + } + + return this; + } + + public SpinJsonNode prop(String name, int newProperty) { + return prop(name, (Number) newProperty); + } + + public SpinJsonNode prop(String name, float newProperty) { + return prop(name, (Number) newProperty); + } + + public SpinJsonNode prop(String name, long newProperty) { + return prop(name, (Number) newProperty); + } + + public SpinJsonNode prop(String name, boolean newProperty) { + return prop(name, (Boolean) newProperty); + } + + public SpinJsonNode prop(String name, Boolean newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + node.put(name, newProperty); + + return this; + } + + public SpinJsonNode prop(String name, List newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + node.set(name, dataFormat.createJsonNode(newProperty)); + + return this; + } + + public SpinJsonNode propList(String name, List newProperty) { + return prop(name, newProperty); + } + + public SpinJsonNode prop(String name, Map newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + node.set(name, dataFormat.createJsonNode(newProperty)); + + return this; + } + + public SpinJsonNode prop(String name, SpinJsonNode newProperty) { + ObjectNode node = (ObjectNode) jsonNode; + + if (newProperty != null) { + node.set(name, (JsonNode) newProperty.unwrap()); + } + else { + node.putNull(name); + } + + return this; + } + + public SpinJsonNode deleteProp(String name) { + ensureNotNull("name", name); + + if(jsonNode.has(name)) { + ObjectNode node = (ObjectNode) jsonNode; + node.remove(name); + return this; + } else { + throw LOG.unableToFindProperty(name); + } + } + + public SpinJsonNode deleteProp(List names) { + ensureNotNull("names", names); + + for(String name: names) { + deleteProp(name); + } + + return this; + } + + public SpinJsonNode append(Object property) { + ensureNotNull("property", property); + if(jsonNode.isArray()) { + ArrayNode node = (ArrayNode) jsonNode; + + node.add(dataFormat.createJsonNode(property)); + + return this; + } else { + throw LOG.unableToModifyNode(jsonNode.getNodeType().name()); + } + } + + public SpinJsonNode insertAt(int index, Object property) { + ensureNotNull("property", property); + + if(jsonNode.isArray()) { + index = getCorrectIndex(index); + ArrayNode node = (ArrayNode) jsonNode; + + node.insert(index, dataFormat.createJsonNode(property)); + + return this; + } else { + throw LOG.unableToModifyNode(jsonNode.getNodeType().name()); + } + } + + public SpinJsonNode insertBefore(Object searchObject, Object insertObject) { + ensureNotNull("searchObject", searchObject); + ensureNotNull("insertObject", insertObject); + if(this.isArray()) { + Integer i = indexOf(searchObject); + + return insertAt(i, insertObject); + + } else { + throw LOG.unableToCreateNode(jsonNode.getNodeType().name()); + } + } + + public SpinJsonNode insertAfter(Object searchObject, Object insertObject) { + ensureNotNull("searchObject", searchObject); + ensureNotNull("insertObject", insertObject); + if(this.isArray()) { + Integer i = indexOf(searchObject); + + return insertAt(i + 1, insertObject); + + } else { + throw LOG.unableToCreateNode(jsonNode.getNodeType().name()); + } + } + + public SpinJsonNode remove(Object property) { + return removeAt(indexOf(property)); + } + + public SpinJsonNode removeLast(Object property) { + return removeAt(lastIndexOf(property)); + } + + public SpinJsonNode removeAt(int index) { + if(this.isArray()) { + ArrayNode node = (ArrayNode) jsonNode; + + node.remove(getCorrectIndex(index)); + + return this; + } else { + throw LOG.unableToModifyNode(jsonNode.getNodeType().name()); + } + } + + public Boolean isBoolean() { + return jsonNode.isBoolean(); + } + + public Boolean boolValue() { + if(jsonNode.isBoolean()) { + return jsonNode.booleanValue(); + } else { + throw LOG.unableToParseValue(Boolean.class.getSimpleName(), jsonNode.getNodeType()); + } + } + + public Boolean isNumber() { + return jsonNode.isNumber(); + } + + public Number numberValue() { + if(jsonNode.isNumber()) { + return jsonNode.numberValue(); + } else { + throw LOG.unableToParseValue(Number.class.getSimpleName(), jsonNode.getNodeType()); + } + } + + public Boolean isString() { + return jsonNode.isTextual(); + } + + public String stringValue() { + if(jsonNode.isTextual()) { + return jsonNode.textValue(); + } else { + throw LOG.unableToParseValue(String.class.getSimpleName(), jsonNode.getNodeType()); + } + } + + public Boolean isNull() { + return jsonNode.isNull(); + } + + public Boolean isValue() { + return jsonNode.isValueNode(); + } + + public Object value() { + if(jsonNode.isBoolean()) { + return jsonNode.booleanValue(); + } + + if(jsonNode.isNumber()) { + return jsonNode.numberValue(); + } + + if(jsonNode.isTextual()) { + return jsonNode.textValue(); + } + + if (jsonNode.isNull()) { + return null; + } + + throw LOG.unableToParseValue("String/Number/Boolean/Null", jsonNode.getNodeType()); + } + + public Boolean isArray() { + return jsonNode.isArray(); + } + + public SpinList elements() { + if(jsonNode.isArray()) { + Iterator iterator = jsonNode.elements(); + SpinList list = new SpinListImpl(); + while(iterator.hasNext()) { + SpinJsonNode node = dataFormat.createWrapperInstance(iterator.next()); + list.add(node); + } + + return list; + } else { + throw LOG.unableToParseValue(SpinList.class.getSimpleName(), jsonNode.getNodeType()); + } + } + + public List fieldNames() { + if(jsonNode.isContainerNode()) { + Iterator iterator = jsonNode.fieldNames(); + List list = new ArrayList(); + while(iterator.hasNext()) { + list.add(iterator.next()); + } + + return list; + } else { + throw LOG.unableToParseValue("Array/Object", jsonNode.getNodeType()); + } + } + + public JsonNodeType getNodeType() { + return jsonNode.getNodeType(); + } + + public SpinJsonPathQuery jsonPath(String expression) { + ensureNotNull("expression", expression); + try { + JsonPath query = JsonPath.compile(expression); + return new JacksonJsonPathQuery(this, query, dataFormat); + } catch(InvalidPathException pex) { + throw LOG.unableToCompileJsonPathExpression(expression, pex); + } catch(IllegalArgumentException aex) { + throw LOG.unableToCompileJsonPathExpression(expression, aex); + } + } + + /** + * Maps the json represented by this object to a java object of the given type.
+ * Note: the desired target type is not validated and needs to be trusted. + * + * @throws SpinJsonException if the json representation cannot be mapped to the specified type + */ + public C mapTo(Class type) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(jsonNode, type); + } + + /** + * Maps the json represented by this object to a java object of the given type. + * Argument is to be supplied in Jackson's canonical type string format + * (see {@link JavaType#toCanonical()}).
+ * Note: the desired target type is not validated and needs to be trusted. + * + * @throws SpinJsonException if the json representation cannot be mapped to the specified type + * @throws SpinJsonDataFormatException if the parameter does not match a valid type + */ + public C mapTo(String type) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(jsonNode, type); + } + + /** + * Maps the json represented by this object to a java object of the given type.
+ * Note: the desired target type is not validated and needs to be trusted. + * + * @throws SpinJsonException if the json representation cannot be mapped to the specified type + */ + public C mapTo(JavaType type) { + JacksonJsonDataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(jsonNode, type); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/AbstractJacksonJsonTypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/AbstractJacksonJsonTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..18a88eb48de385c9d0f1871c62ac4b26c570c59e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/AbstractJacksonJsonTypeDetector.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.TypeDetector; + +public abstract class AbstractJacksonJsonTypeDetector implements TypeDetector { + + public boolean appliesTo(DataFormat dataFormat) { + return dataFormat instanceof JacksonJsonDataFormat; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/DefaultJsonJacksonTypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/DefaultJsonJacksonTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..de9836ad9df0d12ea1d2eb3e3c5700ad7927efbd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/DefaultJsonJacksonTypeDetector.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import com.fasterxml.jackson.databind.type.TypeFactory; + +public class DefaultJsonJacksonTypeDetector extends AbstractJacksonJsonTypeDetector { + + public boolean canHandle(Object object) { + return true; + } + + public String detectType(Object object) { + Class type = object.getClass(); + return TypeFactory.defaultInstance().constructType(type).toCanonical(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormat.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..38c12d46ec3e9d8b91a8941888a4390bf327c201 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormat.java @@ -0,0 +1,307 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.jayway.jsonpath.spi.json.JacksonJsonProvider; +import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; +import org.camunda.spin.DataFormats; +import org.camunda.spin.impl.json.jackson.JacksonJsonLogger; +import org.camunda.spin.impl.json.jackson.JacksonJsonNode; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.TypeDetector; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.type.TypeFactory; +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.Configuration.ConfigurationBuilder; + +/** + * Spin data format that can wrap Json content and uses + * Jackson as its implementation. + * Caches an instance of {@link ObjectMapper} according to the advice given in the + * Jackson documentation. + * + * + * @author Thorben Lindhauer + * @author Stefan Hentschel + */ +public class JacksonJsonDataFormat implements DataFormat { + + public static final String DATA_FORMAT_NAME = DataFormats.JSON_DATAFORMAT_NAME; + + private static final JacksonJsonLogger LOG = JacksonJsonLogger.JSON_TREE_LOGGER; + + /** The Jackson Object Mapper used by this dataformat */ + protected ObjectMapper objectMapper; + + /** The JsonPath configuration */ + protected Configuration jsonPathConfiguration; + + protected List typeDetectors; + + protected JacksonJsonDataFormatReader dataFormatReader; + protected JacksonJsonDataFormatWriter dataFormatWriter; + protected JacksonJsonDataFormatMapper dataFormatMapper; + + protected final String name; + + public JacksonJsonDataFormat(String name) { + this(name, new ObjectMapper()); + } + + public JacksonJsonDataFormat(String name, ObjectMapper objectMapper) { + + this(name, objectMapper, + new ConfigurationBuilder() + .jsonProvider(new JacksonJsonProvider(objectMapper)) + .mappingProvider(new JacksonMappingProvider(objectMapper)) + .build()); + } + + public JacksonJsonDataFormat(String name, ObjectMapper objectMapper, Configuration jsonPathConfiguration) { + this.name = name; + this.objectMapper = objectMapper; + this.jsonPathConfiguration = jsonPathConfiguration; + init(); + } + + + // initialization ///////////////////////////////////////////// + + protected void init() { + initReader(); + initWriter(); + initMapper(); + initTypeDetectors(); + } + + protected void initMapper() { + this.dataFormatMapper = new JacksonJsonDataFormatMapper(this); + } + + protected void initWriter() { + this.dataFormatWriter = new JacksonJsonDataFormatWriter(this); + } + + protected void initReader() { + this.dataFormatReader = new JacksonJsonDataFormatReader(this); + } + + + protected void initTypeDetectors() { + typeDetectors = new ArrayList<>(); + typeDetectors.add(new ListJacksonJsonTypeDetector()); + typeDetectors.add(new DefaultJsonJacksonTypeDetector()); + } + + // interface implementation /////////////////////////////////// + + public String getName() { + return DATA_FORMAT_NAME; + } + + public Class getWrapperType() { + return JacksonJsonNode.class; + } + + public SpinJsonNode createWrapperInstance(Object parameter) { + return new JacksonJsonNode((JsonNode) parameter, this); + } + + /** + * Identifies the canonical type of an object heuristically. + * + * @return the canonical type identifier of the object's class + * according to Jackson's type format (see {@link TypeFactory#constructFromCanonical(String)}) + */ + public String getCanonicalTypeName(Object object) { + ensureNotNull("object", object); + + for (TypeDetector typeDetector : typeDetectors) { + if (typeDetector.canHandle(object)) { + return typeDetector.detectType(object); + } + } + + throw LOG.unableToDetectCanonicalType(object); + } + + /** + * Constructs a {@link JavaType} object based on the parameter, which + * has to follow Jackson's canonical type string format. + * + * @param canonicalString canonical string representation of the type + * @return the constructed java type + * @throws SpinJsonDataFormatException if no type can be constructed from the given parameter + */ + public JavaType constructJavaTypeFromCanonicalString(String canonicalString) { + try { + return TypeFactory.defaultInstance().constructFromCanonical(canonicalString); + } catch (IllegalArgumentException e) { + throw LOG.unableToConstructJavaType(canonicalString, e); + } + } + + public void addTypeDetector(TypeDetector typeDetector) { + typeDetectors.add(0, typeDetector); + } + + public JacksonJsonDataFormatMapper getMapper() { + return dataFormatMapper; + } + + public JacksonJsonDataFormatReader getReader() { + return dataFormatReader; + } + + public JacksonJsonDataFormatWriter getWriter() { + return dataFormatWriter; + } + + // resources ////////////////////////////////////////////////// + + /** + * Returns a {@link Configuration} object for jayway json path + * which uses this dataformat's object mapper as {@link JsonProvider}. + * + * @return the {@link Configuration} for jsonpath + */ + public Configuration getJsonPathConfiguration() { + return jsonPathConfiguration; + } + + public void setJsonPathConfiguration(Configuration jsonPathConfiguration) { + this.jsonPathConfiguration = jsonPathConfiguration; + } + + /** + * Returns the configured Jackson {@link ObjectMapper} instance. + * @return the configured object mapper. + */ + public ObjectMapper getObjectMapper() { + return objectMapper; + } + + public void setObjectMapper(ObjectMapper objectMapper) { + this.objectMapper = objectMapper; + } + + // helper functions ////////////////////////////////////////// + + @SuppressWarnings("unchecked") + public JsonNode createJsonNode(Object parameter) { + if(parameter instanceof SpinJsonNode) { + return (JsonNode) ((SpinJsonNode) parameter).unwrap(); + + } else if(parameter instanceof String) { + return createJsonNode((String) parameter); + + } else if(parameter instanceof Integer) { + return createJsonNode((Integer) parameter); + + } else if(parameter instanceof Boolean) { + return createJsonNode((Boolean) parameter); + + } else if(parameter instanceof Float) { + return createJsonNode((Float) parameter); + + } else if(parameter instanceof Long) { + return createJsonNode((Long) parameter); + + } else if(parameter instanceof Number) { + return createJsonNode(((Number) parameter).doubleValue()); + + } else if(parameter instanceof List) { + return createJsonNode((List) parameter); + + } else if(parameter instanceof Map) { + return createJsonNode((Map) parameter); + + } else if (parameter == null) { + return createNullJsonNode(); + } else { + throw LOG.unableToCreateNode(parameter.getClass().getSimpleName()); + } + } + + public JsonNode createJsonNode(String parameter) { + return objectMapper.getNodeFactory().textNode(parameter); + } + + public JsonNode createJsonNode(Integer parameter) { + return objectMapper.getNodeFactory().numberNode(parameter); + } + + public JsonNode createJsonNode(Float parameter) { + return objectMapper.getNodeFactory().numberNode(parameter); + } + + public JsonNode createJsonNode(Double parameter) { + return objectMapper.getNodeFactory().numberNode(parameter); + } + + public JsonNode createJsonNode(Long parameter) { + return objectMapper.getNodeFactory().numberNode(parameter); + } + + public JsonNode createJsonNode(Boolean parameter) { + return objectMapper.getNodeFactory().booleanNode(parameter); + } + + public JsonNode createJsonNode(List parameter) { + if (parameter != null) { + ArrayNode node = objectMapper.getNodeFactory().arrayNode(); + for(Object entry : parameter) { + node.add(createJsonNode(entry)); + } + return node; + } + else { + return createNullJsonNode(); + } + + } + + public JsonNode createJsonNode(Map parameter) { + if (parameter != null) { + ObjectNode node = objectMapper.getNodeFactory().objectNode(); + for (Map.Entry entry : parameter.entrySet()) { + node.set(entry.getKey(), createJsonNode(entry.getValue())); + } + return node; + } + else { + return createNullJsonNode(); + } + } + + public JsonNode createNullJsonNode() { + return objectMapper.getNodeFactory().nullNode(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatMapper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..54c846edf18e98064420266db56118047f8e21e2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatMapper.java @@ -0,0 +1,140 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.SpinRuntimeException; +import org.camunda.spin.impl.json.jackson.JacksonJsonLogger; +import org.camunda.spin.spi.DataFormatMapper; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.type.TypeFactory; + +public class JacksonJsonDataFormatMapper implements DataFormatMapper { + + private static final JacksonJsonLogger LOG = JacksonJsonLogger.JSON_TREE_LOGGER; + + protected JacksonJsonDataFormat format; + + public JacksonJsonDataFormatMapper(JacksonJsonDataFormat format) { + this.format = format; + } + + public boolean canMap(Object parameter) { + // Jackson ObjectMapper#canSerialize() method was removed + // due to causing performance issues in high load scenarios + return parameter != null; + } + + public String getCanonicalTypeName(Object object) { + return format.getCanonicalTypeName(object); + } + + public Object mapJavaToInternal(Object parameter) { + ObjectMapper mapper = format.getObjectMapper(); + try { + return mapper.valueToTree(parameter); + } catch (IllegalArgumentException e) { + throw LOG.unableToMapInput(parameter, e); + } + } + + public T mapInternalToJava(Object parameter, Class type) { + return mapInternalToJava(parameter, type, null); + } + + @Override + public T mapInternalToJava(Object parameter, Class type, DeserializationTypeValidator validator) { + JavaType javaType = TypeFactory.defaultInstance().constructType(type); + return mapInternalToJava(parameter, javaType, validator); + } + + public T mapInternalToJava(Object parameter, String typeIdentifier) { + return mapInternalToJava(parameter, typeIdentifier, null); + } + + @Override + public T mapInternalToJava(Object parameter, String typeIdentifier, DeserializationTypeValidator validator) { + try { + //sometimes the class identifier is at once a fully qualified class name + final Class aClass = Class.forName(typeIdentifier, true, Thread.currentThread().getContextClassLoader()); + return (T) mapInternalToJava(parameter, aClass, validator); + } catch (ClassNotFoundException e) { + JavaType javaType = format.constructJavaTypeFromCanonicalString(typeIdentifier); + T result = mapInternalToJava(parameter, javaType, validator); + return result; + } + } + + public C mapInternalToJava(Object parameter, JavaType type) { + return mapInternalToJava(parameter, type, null); + } + + public C mapInternalToJava(Object parameter, JavaType type, DeserializationTypeValidator validator) { + JsonNode jsonNode = (JsonNode) parameter; + try { + validateType(type, validator); + ObjectMapper mapper = format.getObjectMapper(); + return mapper.readValue(mapper.treeAsTokens(jsonNode), type); + } catch (IOException | SpinRuntimeException e) { + throw LOG.unableToDeserialize(jsonNode, type, e); + } + } + + /** + * Validate the type with the help of the validator.
+ * Note: when adjusting this method, please also consider adjusting + * the {@code AbstractVariablesResource#validateType} in the REST API + */ + protected void validateType(JavaType type, DeserializationTypeValidator validator) { + if (validator != null) { + List invalidTypes = new ArrayList<>(); + validateType(type, validator, invalidTypes); + if (!invalidTypes.isEmpty()) { + throw new SpinRuntimeException("The following classes are not whitelisted for deserialization: " + invalidTypes); + } + } + } + + protected void validateType(JavaType type, DeserializationTypeValidator validator, List invalidTypes) { + if (!type.isPrimitive()) { + if (!type.isArrayType()) { + validateTypeInternal(type, validator, invalidTypes); + } + if (type.isMapLikeType()) { + validateType(type.getKeyType(), validator, invalidTypes); + } + if (type.isContainerType() || type.hasContentType()) { + validateType(type.getContentType(), validator, invalidTypes); + } + } + } + + protected void validateTypeInternal(JavaType type, DeserializationTypeValidator validator, List invalidTypes) { + String className = type.getRawClass().getName(); + if (!validator.validate(className) && !invalidTypes.contains(className)) { + invalidTypes.add(className); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..3d878643dc18068c7e105254ee2826c1bf55fcb9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatProvider.java @@ -0,0 +1,43 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import static org.camunda.spin.DataFormats.JSON_DATAFORMAT_NAME; + +import java.util.Set; + +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatProvider; + +/** + * Provides the {@link JacksonJsonDataFormat} with default configuration. + * + * @author Daniel Meyer + * + */ +public class JacksonJsonDataFormatProvider implements DataFormatProvider { + + protected Set names; + + public String getDataFormatName() { + return JSON_DATAFORMAT_NAME; + } + + public DataFormat createInstance() { + return new JacksonJsonDataFormat(JSON_DATAFORMAT_NAME); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatReader.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatReader.java new file mode 100644 index 0000000000000000000000000000000000000000..1707e1f1eaca1f61f13ed57632a3930cb295cbee --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatReader.java @@ -0,0 +1,67 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import java.io.IOException; +import java.io.Reader; +import java.util.regex.Pattern; + +import com.fasterxml.jackson.databind.node.MissingNode; +import org.camunda.spin.impl.json.jackson.JacksonJsonLogger; +import org.camunda.spin.spi.TextBasedDataFormatReader; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author Thorben Lindhauer + */ +public class JacksonJsonDataFormatReader extends TextBasedDataFormatReader { + + private static final JacksonJsonLogger JSON_LOGGER = JacksonJsonLogger.JSON_TREE_LOGGER; + private static final Pattern INPUT_MATCHING_PATTERN = Pattern.compile("\\A(\\s)*[{\\[]"); + + protected JacksonJsonDataFormat format; + + public JacksonJsonDataFormatReader(JacksonJsonDataFormat format) { + this.format = format; + } + + public Object readInput(Reader input) { + ObjectMapper mapper = format.getObjectMapper(); + + try { + final JsonNode jsonNode = mapper.readTree(input); + if (jsonNode instanceof MissingNode) { + throw new IOException("Input is empty"); + } + return jsonNode; + } + catch (JsonProcessingException e) { + throw JSON_LOGGER.unableToParseInput(e); + } + catch (IOException e) { + throw JSON_LOGGER.unableToParseInput(e); + } + } + + protected Pattern getInputDetectionPattern() { + return INPUT_MATCHING_PATTERN; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatWriter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatWriter.java new file mode 100644 index 0000000000000000000000000000000000000000..260eda83f2ceaaa5381cfee0cb22441e81f5d6ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/JacksonJsonDataFormatWriter.java @@ -0,0 +1,58 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import java.io.IOException; +import java.io.Writer; + +import org.camunda.spin.impl.json.jackson.JacksonJsonLogger; +import org.camunda.spin.spi.DataFormatWriter; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * @author Daniel Meyer + * + */ +public class JacksonJsonDataFormatWriter implements DataFormatWriter { + + private static final JacksonJsonLogger LOG = JacksonJsonLogger.JSON_TREE_LOGGER; + + protected JacksonJsonDataFormat dataFormat; + + public JacksonJsonDataFormatWriter(JacksonJsonDataFormat dataFormat) { + this.dataFormat = dataFormat; + } + + public void writeToWriter(Writer writer, Object input) { + final ObjectMapper objectMapper = dataFormat.getObjectMapper(); + final JsonFactory factory = objectMapper.getFactory(); + + try { + JsonGenerator generator = factory.createGenerator(writer); + objectMapper.writeTree(generator, (JsonNode) input); + } + catch (IOException e) { + throw LOG.unableToWriteJsonNode(e); + } + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/ListJacksonJsonTypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/ListJacksonJsonTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..6e6952dd01f2669d9ec808517a6f7aec6de1d788 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/ListJacksonJsonTypeDetector.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import java.lang.reflect.TypeVariable; +import java.util.List; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; + +public class ListJacksonJsonTypeDetector extends AbstractJacksonJsonTypeDetector { + + public boolean canHandle(Object object) { + return object instanceof List; + } + + public String detectType(Object object) { + return constructType(object).toCanonical(); + } + + protected JavaType constructType(Object object) { + TypeFactory typeFactory = TypeFactory.defaultInstance(); + + if (object instanceof List && !((List) object).isEmpty()) { + List list = (List) object; + Object firstElement = list.get(0); + if (bindingsArePresent(list.getClass())) { + final JavaType elementType = constructType(firstElement); + return typeFactory.constructCollectionType(list.getClass(), elementType); + } + } + return typeFactory.constructType(object.getClass()); + } + + private boolean bindingsArePresent(Class erasedType) { + TypeVariable[] vars = erasedType.getTypeParameters(); + int varLen = (vars == null) ? 0 : vars.length; + if (varLen == 0) { + return false; + } + if (varLen != 1) { + throw new IllegalArgumentException("Cannot create TypeBindings for class " + erasedType.getName() + " with 1 type parameter: class expects " + varLen); + } + return true; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/MapJacksonJsonTypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/MapJacksonJsonTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..9998097a46e02da8c2f5f74065ddd1e754cf7775 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/MapJacksonJsonTypeDetector.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import org.camunda.spin.spi.TypeDetector; + +import java.util.Map; + +import static org.camunda.spin.impl.json.jackson.format.TypeHelper.constructType; + +/** + * Detects erased types of Map classes. + *

To use it, make sure to call {@link JacksonJsonDataFormat#addTypeDetector(TypeDetector)} + * to activate it.

+ */ +public class MapJacksonJsonTypeDetector extends AbstractJacksonJsonTypeDetector { + + /** + * Object instance to use. + */ + public static MapJacksonJsonTypeDetector INSTANCE = new MapJacksonJsonTypeDetector(); + + @Override + public boolean canHandle(Object value) { + return value instanceof Map; + } + + @Override + public String detectType(Object value) { + return constructType(value).toCanonical(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/SetJacksonJsonTypeDetector.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/SetJacksonJsonTypeDetector.java new file mode 100644 index 0000000000000000000000000000000000000000..175895290231e04b40d9767af8011a56e5cf94d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/SetJacksonJsonTypeDetector.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import org.camunda.spin.spi.TypeDetector; + +import java.util.Set; + +import static org.camunda.spin.impl.json.jackson.format.TypeHelper.constructType; + +/** + * Detects erased types of Set classes. + *

To use it, make sure to call {@link JacksonJsonDataFormat#addTypeDetector(TypeDetector)} + * to activate it.

+ */ +public class SetJacksonJsonTypeDetector extends AbstractJacksonJsonTypeDetector { + + /** + * Object instance to use. + */ + public static SetJacksonJsonTypeDetector INSTANCE = new SetJacksonJsonTypeDetector(); + + @Override + public boolean canHandle(Object value) { + return value instanceof Set; + } + + @Override + public String detectType(Object value) { + return constructType(value).toCanonical(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/TypeHelper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/TypeHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..a3a2c05fcc4dddbb2b26b7dba51aa22b2fdfecd6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/format/TypeHelper.java @@ -0,0 +1,131 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; + +import java.lang.reflect.TypeVariable; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +/** + * Collection of helper methods to construct types. + */ +public class TypeHelper { + + /** + * Checks if the erased type has the correct number of type bindings. + * + * @param erasedType class of the type. + * @param expectedTypeParametersCount expected number of bindings. + * @return true if the number of type binding matches expected value. + */ + static boolean bindingsArePresent(Class erasedType, int expectedTypeParametersCount) { + if (erasedType == null) { + return false; + } + TypeVariable>[] typeParameters = erasedType.getTypeParameters(); + if (typeParameters.length == 0) { + return false; + } + if (typeParameters.length != expectedTypeParametersCount) { + throw new IllegalArgumentException( + "Cannot create TypeBindings for class " + erasedType.getName() + " with " + expectedTypeParametersCount + + " type parameter: class expects " + typeParameters.length + " type parameters."); + } + return true; + } + + /** + * Constructs Java type based on the content values. + * + * @param value value with values. + * @return Java type. + */ + static JavaType constructType(Object value) { + TypeFactory typeFactory = TypeFactory.defaultInstance(); + if (value instanceof Collection) { + Collection collection = (Collection) value; + int size = collection.size(); + if (size > 0) { + Iterator iterator = collection.iterator(); + + Object element = null; + do { + element = iterator.next(); + + if (bindingsArePresent(value.getClass(), 1) && (element != null || size == 1)) { + JavaType elementType = constructType(element); + return typeFactory.constructCollectionType(guessCollectionType(value), elementType); + + } + } while (iterator.hasNext() && element == null); + } + } else if (value instanceof Map) { + Map map = (Map) value; + int size = map.size(); + if (size > 0) { + Set> entries = map.entrySet(); + Iterator> iterator = entries.iterator(); + + Map.Entry entry = null; + do { + entry = iterator.next(); + + if (bindingsArePresent(value.getClass(), 2) && (entry.getValue() != null || size == 1)) { + JavaType keyType = constructType(entry.getKey()); + JavaType valueType = constructType(entry.getValue()); + return typeFactory.constructMapType(Map.class, keyType, valueType); + + } + } while (iterator.hasNext() && entry.getValue() == null); + + JavaType keyType = constructType(entry.getKey()); + return typeFactory.constructMapType(Map.class, keyType, TypeFactory.unknownType()); + + } + } + + if (value != null) { + return typeFactory.constructType(value.getClass()); + + } else { + return TypeFactory.unknownType(); + + } + } + + /** + * Guess collection class. + * + * @param value collection. + * @return class of th collection implementation. + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + static Class guessCollectionType(Object value) { + if (value instanceof Collection) { + return (Class) value.getClass(); + } else { + throw new IllegalArgumentException( + "Could not detect class for " + value + " of type " + value.getClass().getName()); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/query/JacksonJsonPathQuery.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/query/JacksonJsonPathQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..a0bedaf0a67f8dec0f4a0badb199d899ab32994d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/java/org/camunda/spin/impl/json/jackson/query/JacksonJsonPathQuery.java @@ -0,0 +1,102 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.query; + +import com.jayway.jsonpath.InvalidPathException; +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.json.jackson.JacksonJsonLogger; +import org.camunda.spin.impl.json.jackson.JacksonJsonNode; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPathQuery; + +import com.fasterxml.jackson.databind.JsonNode; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.PathNotFoundException; + +/** + * @author Stefan Hentschel + */ +public class JacksonJsonPathQuery implements SpinJsonPathQuery { + + private static final JacksonJsonLogger LOG = JacksonJsonLogger.JSON_TREE_LOGGER; + + protected final SpinJsonNode spinJsonNode; + protected final JsonPath query; + protected final JacksonJsonDataFormat dataFormat; + + public JacksonJsonPathQuery(JacksonJsonNode jacksonJsonNode, JsonPath query, JacksonJsonDataFormat dataFormat) { + this.spinJsonNode = jacksonJsonNode; + this.query = query; + this.dataFormat = dataFormat; + } + + public SpinJsonNode element() { + try { + Object result = query.read(spinJsonNode.toString(), dataFormat.getJsonPathConfiguration()); + JsonNode node; + if (result != null) { + node = dataFormat.createJsonNode(result); + } else { + node = dataFormat.createNullJsonNode(); + } + return dataFormat.createWrapperInstance(node); + } catch(PathNotFoundException pex) { + throw LOG.unableToEvaluateJsonPathExpressionOnNode(spinJsonNode, pex); + } catch (ClassCastException cex) { + throw LOG.unableToCastJsonPathResultTo(SpinJsonNode.class, cex); + } catch(InvalidPathException iex) { + throw LOG.invalidJsonPath(SpinJsonNode.class, iex); + } + } + + public SpinList elementList() { + JacksonJsonNode node = (JacksonJsonNode) element(); + if(node.isArray()) { + return node.elements(); + } else { + throw LOG.unableToParseValue(SpinList.class.getSimpleName(), node.getNodeType()); + } + } + + public String stringValue() { + JacksonJsonNode node = (JacksonJsonNode) element(); + if(node.isString()) { + return node.stringValue(); + } else { + throw LOG.unableToParseValue(String.class.getSimpleName(), node.getNodeType()); + } + } + + public Number numberValue() { + JacksonJsonNode node = (JacksonJsonNode) element(); + if(node.isNumber()) { + return node.numberValue(); + } else { + throw LOG.unableToParseValue(Number.class.getSimpleName(), node.getNodeType()); + } + } + + public Boolean boolValue() { + JacksonJsonNode node = (JacksonJsonNode) element(); + if(node.isBoolean()) { + return node.boolValue(); + } else { + throw LOG.unableToParseValue(Boolean.class.getSimpleName(), node.getNodeType()); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider new file mode 100644 index 0000000000000000000000000000000000000000..cb302c5dff72e3e43259bc8ad937e4e38c8bc801 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider @@ -0,0 +1 @@ +org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatProvider diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f606bf5f3205a26543b6070c47085ebe766af44c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeCreateScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeCreateGroovyTest extends JsonTreeCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b8ec8067e1e887b55d3fa7562324540cefc1dc1f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeEditListPropertyScriptTest; + +/** + * @author Stefan Hentschel + * + */ +@ScriptEngine("groovy") +public class JsonTreeEditListPropertyGroovyTest extends JsonTreeEditListPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d2e3b193b25ea189109750695aadf86d20900455 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeJsonPathScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeJsonPathGroovyTest extends JsonTreeJsonPathScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..86dd97ab294693821676daf652648c67f768e466 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapJsonToJavaScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("groovy") +public class JsonTreeMapJsonToJavaGroovyTest extends JsonTreeMapJsonToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0921fbb0775406e0c2c32f60477fac9cf6c9db6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapObjectToJsonScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeMapObjectToJsonGroovyTest extends JsonTreeMapObjectToJsonScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..18bca5f06296e31bab0fbc6862516d8a3993f6a0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeReadPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeReadPropertyGroovyTest extends JsonTreeReadPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..81bbd87311cec81d445947d3db49257e4a3f2f41 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeRemovePropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeRemovePropertyGroovyTest extends JsonTreeRemovePropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1068afebb73ef9944d983225169cebcf0db1360d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeSetPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("groovy") +public class JsonTreeSetPropertyGroovyTest extends JsonTreeSetPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/impl/json/jackson/format/JsonDeserializationValidationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/impl/json/jackson/format/JsonDeserializationValidationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..267e8ee13930251749680cc8ea3745235d951a98 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/impl/json/jackson/format/JsonDeserializationValidationTest.java @@ -0,0 +1,257 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.json.jackson.format; + +import static org.mockito.Mockito.times; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.SpinRuntimeException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; + +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; + +public class JsonDeserializationValidationTest { + + protected DeserializationTypeValidator validator; + protected static JacksonJsonDataFormat format; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void setUpMocks() { + format = new JacksonJsonDataFormat("test"); + } + + @AfterClass + public static void tearDown() { + format = null; + } + + @Test + public void shouldValidateNothingForPrimitiveClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(int.class); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verifyZeroInteractions(validator); + } + + @Test + public void shouldValidateBaseTypeOnlyForBaseClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(String.class); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator).validate("java.lang.String"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateBaseTypeOnlyForComplexClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(Complex.class); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator).validate("org.camunda.spin.impl.json.jackson.format.JsonDeserializationValidationTest$Complex"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateContentTypeOnlyForArrayClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(Integer[].class); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator).validate("java.lang.Integer"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateCollectionAndContentTypeForCollectionClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.ArrayList"); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator).validate("java.util.ArrayList"); + Mockito.verify(validator).validate("java.lang.String"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateCollectionAndContentTypeForNestedCollectionClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.ArrayList>"); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator, times(2)).validate("java.util.ArrayList"); + Mockito.verify(validator).validate("java.lang.String"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateMapAndKeyAndContentTypeForMapClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.HashMap"); + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(type, validator); + + // then + Mockito.verify(validator).validate("java.util.HashMap"); + Mockito.verify(validator).validate("java.lang.String"); + Mockito.verify(validator).validate("java.lang.Integer"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldFailForSimpleClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(String.class); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[java.lang.String]"); + + // when + format.getMapper().validateType(type, validator); + } + + @Test + public void shouldFailForComplexClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(Complex.class); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[org.camunda.spin.impl.json.jackson.format.JsonDeserializationValidationTest$Complex]"); + + // when + format.getMapper().validateType(type, validator); + } + + @Test + public void shouldFailForArrayClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructType(Integer[].class); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[java.lang.Integer]"); + + // when + format.getMapper().validateType(type, validator); + } + + @Test + public void shouldFailForCollectionClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.ArrayList"); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[java.util.ArrayList, java.lang.String]"); + + // when + format.getMapper().validateType(type, validator); + } + + @Test + public void shouldFailForMapClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.HashMap"); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[java.util.HashMap, java.lang.String, java.lang.Integer]"); + + // when + format.getMapper().validateType(type, validator); + } + + @Test + public void shouldFailOnceForMapClass() { + // given + JavaType type = TypeFactory.defaultInstance().constructFromCanonical("java.util.HashMap"); + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("[java.util.HashMap, java.lang.String]"); + + // when + format.getMapper().validateType(type, validator); + } + + public static class Complex { + private Nested nested; + + public Nested getNested() { + return nested; + } + } + + public static class Nested { + private int testInt; + + public int getTestInt() { + return testInt; + } + } + + protected DeserializationTypeValidator createValidatorMock(boolean result) { + DeserializationTypeValidator newValidator = Mockito.mock(DeserializationTypeValidator.class); + Mockito.when(newValidator.validate(Mockito.anyString())).thenReturn(result); + return newValidator; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8e179061d97cb9c3f450ada306109c30ab0a577c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeCreateScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("graal.js") +public class JsonTreeCreateJavascriptTest extends JsonTreeCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..506a4fdfa69ca44fc518138b7b191d858cfa7f83 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeEditListPropertyScriptTest; +import org.junit.Ignore; +import org.junit.Test; + +/** + * @author Stefan Hentschel + * + */ +@ScriptEngine("graal.js") +public class JsonTreeEditListPropertyJavascriptTest extends JsonTreeEditListPropertyScriptTest { + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertAtWithWrongObject() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertWrongObjectAfterSearchObject() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailAppendWrongNode() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertWrongObjectBeforeSearchObject() throws Throwable { + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..98869dbad4df78f4db575533609de7caf7e21bb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeJsonPathScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("graal.js") +public class JsonTreeJsonPathJavascriptTest extends JsonTreeJsonPathScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9e6b67b813d890d363d1b0b0108fa8ecb26a4ed4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapJsonToJavaScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("graal.js") +public class JsonTreeMapJsonToJavaJavascriptTest extends JsonTreeMapJsonToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..01bbf7a3e0f854b719e5a9584981ce35a90bd6b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java @@ -0,0 +1,33 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapObjectToJsonScriptTest; +import org.junit.Ignore; + +/** + * Note: Jackson is apparently not able to map graal.js's internal representations + * of javascript objects and arrays. + * + * @author Thorben Lindhauer + */ +@Ignore +@ScriptEngine("graal.js") +public class JsonTreeMapObjectToJsonJavascriptTest extends JsonTreeMapObjectToJsonScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0511dff5b76c2d4ea560d6b20c670ee5323654de --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeReadPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("graal.js") +public class JsonTreeReadPropertyJavascriptTest extends JsonTreeReadPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0f3a1f5552e9363c28decf0c82eda96180259dad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeRemovePropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("graal.js") +public class JsonTreeRemovePropertyJavascriptTest extends JsonTreeRemovePropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e9557e0d158ce8ab70955b8ae649a298c7738e1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeSetPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("graal.js") +public class JsonTreeSetPropertyJavascriptTest extends JsonTreeSetPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..547f837f277563367ae0180a4db31478a18b0ee9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeCreateScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeCreateJavascriptTest extends JsonTreeCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2f68f5d8087563ea2f289b2c6df0742157695253 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeEditListPropertyScriptTest; +import org.junit.Ignore; +import org.junit.Test; + +@ScriptEngine("nashorn") +public class JsonTreeEditListPropertyJavascriptTest extends JsonTreeEditListPropertyScriptTest { + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertAtWithWrongObject() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertWrongObjectAfterSearchObject() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailAppendWrongNode() throws Throwable { + } + + /** + * Ignored since javascript implementation changed + * see: https://app.camunda.com/jira/browse/CAM-3612 + */ + @Test + @Ignore + public void shouldFailInsertWrongObjectBeforeSearchObject() throws Throwable { + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..269bf34589551f5f874cff3f9b7ccbb79e4b86d4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeJsonPathScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeJsonPathJavascriptTest extends JsonTreeJsonPathScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a980e5acf6815976781b4d8f2f80aab25844b614 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaJavascriptTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapJsonToJavaScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeMapJsonToJavaJavascriptTest extends JsonTreeMapJsonToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..a77db17b8bf0001297d47a0fc69b54d81b58a2d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.java @@ -0,0 +1,31 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapObjectToJsonScriptTest; +import org.junit.Ignore; + +/** + * Note: Jackson is apparently not able to map Nashorn's internal representations + * of javascript objects and arrays. + */ +@Ignore +@ScriptEngine("nashorn") +public class JsonTreeMapObjectToJsonJavascriptTest extends JsonTreeMapObjectToJsonScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4ccfe70ae4aef742c0d1e281d7ccb60d995a890d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeReadPropertyScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeReadPropertyJavascriptTest extends JsonTreeReadPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..287a5a28e357371c27dad46dcee53d414c64f7f9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeRemovePropertyScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeRemovePropertyJavascriptTest extends JsonTreeRemovePropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..947e26d121a5704f4ad9a4873bedd75fc93b801e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeSetPropertyScriptTest; + +@ScriptEngine("nashorn") +public class JsonTreeSetPropertyJavascriptTest extends JsonTreeSetPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3bdae546aa8d448a9f1cae1848d95efc16d9cd90 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationTest.java @@ -0,0 +1,198 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.DataFormats.json; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.camunda.spin.json.mapping.CustomerList; +import org.camunda.spin.json.mapping.GenericCustomerList; +import org.camunda.spin.json.mapping.Order; +import org.camunda.spin.json.mapping.RegularCustomer; +import org.camunda.spin.json.mapping.dmn.DmnDecisionResultEntries; +import org.camunda.spin.json.mapping.dmn.DmnDecisionResultEntriesImpl; +import org.camunda.spin.json.mapping.dmn.DmnDecisionResultImpl; +import org.camunda.spin.spi.DataFormatMapper; +import org.camunda.spin.spi.DataFormatReader; +import org.camunda.spin.spi.DataFormatWriter; +import org.junit.Test; + +public class JsonSerializationTest { + + @Test + public void testNotGenericList() throws Exception { + CustomerList customers = new CustomerList<>(); + customers.add(new RegularCustomer("someCustomer", 5)); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isNotNull(); + + final byte[] bytes = serializeToByteArray(customers); + assertThat(bytes).isNotEmpty(); + + final Object o = deserializeFromByteArray(bytes, canonicalTypeString); + assertThat(o).isInstanceOf(CustomerList.class); + + CustomerList deserializedCustomerList = (CustomerList) o; + assertEquals("someCustomer", deserializedCustomerList.get(0).getName()); + assertEquals(5, deserializedCustomerList.get(0).getContractStartDate()); + } + + @Test + public void testOrder() throws Exception { + Order order = JsonTestConstants.createExampleOrder(); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(order); + assertThat(canonicalTypeString).isNotNull(); + + final byte[] bytes = serializeToByteArray(order); + assertThat(bytes).isNotEmpty(); + + final Object o = deserializeFromByteArray(bytes, canonicalTypeString); + assertThat(o).isInstanceOf(Order.class); + + Order deserializedOrder = (Order) o; + JsonTestConstants.assertIsExampleOrder(deserializedOrder); + } + + @Test + public void testPlainTypeArray() throws Exception { + int[] array = new int[]{5, 10}; + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(array); + assertThat(canonicalTypeString).isNotNull(); + + final byte[] bytes = serializeToByteArray(array); + assertThat(bytes).isNotEmpty(); + + final Object o = deserializeFromByteArray(bytes, canonicalTypeString); + assertThat(o).isInstanceOf(int[].class); + + int[] deserializedArray = (int[]) o; + assertEquals(5, deserializedArray[0]); + assertEquals(10, deserializedArray[1]); + } + + @Test + public void testGenericList() throws Exception { + GenericCustomerList customers = new GenericCustomerList<>(); + customers.add(new RegularCustomer("someCustomer", 5)); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isNotNull(); + + final byte[] bytes = serializeToByteArray(customers); + assertThat(bytes).isNotEmpty(); + + final Object o = deserializeFromByteArray(bytes, canonicalTypeString); + assertThat(o).isInstanceOf(GenericCustomerList.class); + + GenericCustomerList deserializedCustomerList = (GenericCustomerList) o; + assertEquals("someCustomer", deserializedCustomerList.get(0).getName()); + assertEquals(5, deserializedCustomerList.get(0).getContractStartDate()); + + } + + @Test + public void serializeAndDeserializeGenericCollection() throws Exception { + List ruleResults = new ArrayList<>(); + final DmnDecisionResultEntriesImpl result1 = new DmnDecisionResultEntriesImpl(); + result1.putValue("key1", "value1"); + result1.putValue("key2", "value2"); + ruleResults.add(result1); + final DmnDecisionResultEntriesImpl result2 = new DmnDecisionResultEntriesImpl(); + result2.putValue("key3", "value3"); + result2.putValue("key4", "value4"); + ruleResults.add(result2); + DmnDecisionResultImpl dmnDecisionResult = new DmnDecisionResultImpl(ruleResults); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(dmnDecisionResult); + assertThat(canonicalTypeString).isNotNull(); + + final byte[] bytes = serializeToByteArray(dmnDecisionResult); + assertThat(bytes).isNotEmpty(); + + //deserialization is not working for this kind of class + + } + + @Test + public void deserializeHashMap() throws Exception { + final byte[] bytes = new String("{\"foo\": \"bar\"}").getBytes(); + assertThat(bytes).isNotEmpty(); + + final Object o = deserializeFromByteArray(bytes, "java.util.HashMap"); + assertThat(o).isInstanceOf(HashMap.class); + assertTrue(((HashMap)o).containsKey("foo")); + assertEquals("bar", ((HashMap)o).get("foo")); + } + + protected byte[] serializeToByteArray(Object deserializedObject) throws Exception { + DataFormatMapper mapper = json().getMapper(); + DataFormatWriter writer = json().getWriter(); + + ByteArrayOutputStream out = new ByteArrayOutputStream(); + OutputStreamWriter outWriter = new OutputStreamWriter(out); + BufferedWriter bufferedWriter = new BufferedWriter(outWriter); + + try { + Object mappedObject = mapper.mapJavaToInternal(deserializedObject); + writer.writeToWriter(bufferedWriter, mappedObject); + return out.toByteArray(); + } + finally { + out.close(); + outWriter.close(); + bufferedWriter.close(); + } + } + + protected Object deserializeFromByteArray(byte[] bytes, String objectTypeName) throws Exception { + DataFormatMapper mapper = json().getMapper(); + DataFormatReader reader = json().getReader(); + + ByteArrayInputStream bais = new ByteArrayInputStream(bytes); + InputStreamReader inReader = new InputStreamReader(bais); + BufferedReader bufferedReader = new BufferedReader(inReader); + + try { + Object mappedObject = reader.readInput(bufferedReader); + return doDeserialization(mapper, mappedObject, objectTypeName); + } finally { + bais.close(); + inReader.close(); + bufferedReader.close(); + } + } + + protected Object doDeserialization(DataFormatMapper mapper, Object mappedObject, String objectTypeName) { + return mapper.mapInternalToJava(mappedObject, objectTypeName); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationWithValidationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationWithValidationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1ebff659c92cb49ae602f49238c0a1ccd8fc0b7d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonSerializationWithValidationTest.java @@ -0,0 +1,39 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.spi.DataFormatMapper; +import org.junit.Before; +import org.mockito.Mockito; + +public class JsonSerializationWithValidationTest extends JsonSerializationTest { + + protected DeserializationTypeValidator validator; + + @Before + public void setUpValidator() { + validator = Mockito.mock(DeserializationTypeValidator.class); + Mockito.when(validator.validate(Mockito.anyString())).thenReturn(true); + } + + @Override + protected Object doDeserialization(DataFormatMapper mapper, Object mappedObject, String objectTypeName) { + return mapper.mapInternalToJava(mappedObject, objectTypeName, validator); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonTestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonTestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..8ef5941f0ae358a04341b02009faa1fc2ee9076b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/JsonTestConstants.java @@ -0,0 +1,132 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.tuple; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.json.mapping.Customer; +import org.camunda.spin.json.mapping.Invoice; +import org.camunda.spin.json.mapping.Order; +import org.camunda.spin.json.mapping.OrderDetails; +import org.camunda.spin.json.mapping.RegularCustomer; + +public class JsonTestConstants { + + public static final String EXAMPLE_JSON_FILE_NAME = "org/camunda/spin/json/example.json"; + + public static final String EXAMPLE_JSON = SpinIoUtil.fileAsString(EXAMPLE_JSON_FILE_NAME); + + public static final String EXAMPLE_JSON_COLLECTION = "[" + EXAMPLE_JSON + "]"; + + public static final String EXAMPLE_INVALID_JSON = "{\"invalid\":"; + + public static final String EXAMPLE_EMPTY_STRING = ""; + + /** + * A json file that can only be parsed when configuring Jackson correctly. + */ + public static final String EXAMPLE_JACKSON_READ_CONFIGURATION_JSON_FILE_NAME = "org/camunda/spin/json/example_jackson.json"; + + public static final String EXAMPLE_JACKSON_READ_CONFIGURATION_JSON = SpinIoUtil.fileAsString(EXAMPLE_JACKSON_READ_CONFIGURATION_JSON_FILE_NAME); + + public static final String EXAMPLE_JACKSON_TYPE_JSON_FILE_NAME = "org/camunda/spin/json/example_jackson_types.json"; + + public static final String EXAMPLE_JACKSON_TYPE_JSON = SpinIoUtil.fileAsString(EXAMPLE_JACKSON_TYPE_JSON_FILE_NAME); + + public static Order createExampleOrder() { + Order order = new Order(); + order.setId(1234567890987654321L); + order.setOrder("order1"); + order.setDueUntil(20150112); + order.setActive(true); + + OrderDetails orderDetails = new OrderDetails(); + orderDetails.setArticle("camundaBPM"); + orderDetails.setPrice(1234567.13d); + orderDetails.setRoundedPrice(1234567L); + + List currencies = new ArrayList(); + currencies.add("euro"); + currencies.add("dollar"); + orderDetails.setCurrencies(currencies); + + order.setOrderDetails(orderDetails); + + List customers = new ArrayList(); + + customers.add(new RegularCustomer("Kermit", 1354539722)); + customers.add(new RegularCustomer("Waldo", 1320325322)); + customers.add(new RegularCustomer("Johnny", 1286110922)); + + order.setCustomers(customers); + + return order; + + } + + public static void assertIsExampleOrder(Order order) { + assertThat(order.getId()).isEqualTo(1234567890987654321L); + assertThat(order.getOrder()).isEqualTo("order1"); + assertThat(order.getDueUntil()).isEqualTo(20150112); + assertThat(order.isActive()).isTrue(); + + OrderDetails orderDetails = order.getOrderDetails(); + assertThat(orderDetails).isNotNull(); + assertThat(orderDetails.getArticle()).isEqualTo("camundaBPM"); + assertThat(orderDetails.getPrice()).isEqualTo(1234567.13d); + assertThat(orderDetails.getRoundedPrice()).isEqualTo(1234567L); + assertThat(orderDetails.getCurrencies()).containsExactly("euro", "dollar"); + + List customers = order.getCustomers(); + assertThat(customers).isNotNull(); + assertThat(customers.size()).isEqualTo(3); + + assertThat(customers).extracting("name", "contractStartDate") + .contains( + tuple("Kermit", 1354539722), + tuple("Waldo", 1320325322), + tuple("Johnny", 1286110922)); + } + + public static Invoice createExampleInvoice() { + Invoice invoice = new Invoice(); + invoice.setAmount(2000); + + RegularCustomer customer = new RegularCustomer("Kermit", 20130505); + invoice.setCustomer(customer); + + return invoice; + } + + public static void assertIsExampleInvoice(Invoice invoice) { + assertThat(invoice).isNotNull(); + assertThat(invoice.getAmount()).isEqualTo(2000); + + assertThat(invoice.getCustomer()).isNotNull(); + + Customer customer = invoice.getCustomer(); + assertThat(customer).isInstanceOf(RegularCustomer.class); + assertThat(customer.getName()).isEqualTo("Kermit"); + assertThat(customer.getContractStartDate()).isEqualTo(20130505); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Customer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Customer.java new file mode 100644 index 0000000000000000000000000000000000000000..a2ee599bcd4b781b3811cbd118cbbf6b23dbe45c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Customer.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +public interface Customer { + + String getName(); + + int getContractStartDate(); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/CustomerList.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/CustomerList.java new file mode 100644 index 0000000000000000000000000000000000000000..71108fa75c594b0faa1bff85622f4891c2693ea3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/CustomerList.java @@ -0,0 +1,159 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * @author Svetlana Dorokhova. + */ +@JsonDeserialize(contentAs = RegularCustomer.class) +public class CustomerList implements List { + + protected List innerList = new ArrayList(); + + @Override + public int size() { + return innerList.size(); + } + + @Override + public boolean isEmpty() { + return innerList.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return innerList.contains(o); + } + + @Override + public Iterator iterator() { + return innerList.iterator(); + } + + @Override + public Object[] toArray() { + return innerList.toArray(); + } + + @Override + public Customer[] toArray(Customer[] a) { + return innerList.toArray(a); + } + + @Override + public boolean add(Customer customer) { + return innerList.add(customer); + } + + @Override + public boolean remove(Object o) { + return innerList.remove(o); + } + + @Override + public boolean containsAll(Collection c) { + return innerList.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + return innerList.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return innerList.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + return innerList.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return innerList.retainAll(c); + } + + @Override + public void clear() { + innerList.clear(); + } + + @Override + public boolean equals(Object o) { + return innerList.equals(o); + } + + @Override + public int hashCode() { + return innerList.hashCode(); + } + + @Override + public Customer get(int index) { + return innerList.get(index); + } + + @Override + public Customer set(int index, Customer element) { + return innerList.set(index, element); + } + + @Override + public void add(int index, Customer element) { + innerList.add(index, element); + } + + @Override + public Customer remove(int index) { + return innerList.remove(index); + } + + @Override + public int indexOf(Object o) { + return innerList.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return innerList.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return innerList.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return innerList.listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return innerList.subList(fromIndex, toIndex); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/DateObject.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/DateObject.java new file mode 100644 index 0000000000000000000000000000000000000000..20a1eeb615fe0d291b328dfe0200abc41edf5b57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/DateObject.java @@ -0,0 +1,32 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +import java.util.Date; + +public class DateObject { + + private Date date; + + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/EmptyBean.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/EmptyBean.java new file mode 100644 index 0000000000000000000000000000000000000000..8ef22ab250ec339561148cb08ddb1453c2086897 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/EmptyBean.java @@ -0,0 +1,22 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +public class EmptyBean { + + // that is all +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/GenericCustomerList.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/GenericCustomerList.java new file mode 100644 index 0000000000000000000000000000000000000000..9430bdf93ae565a2698142c83c6597248495a9ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/GenericCustomerList.java @@ -0,0 +1,160 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +/** + * @author Svetlana Dorokhova. + */ + +@JsonDeserialize(contentAs = RegularCustomer.class) +public class GenericCustomerList implements List { + + protected List innerList = new ArrayList(); + + @Override + public int size() { + return innerList.size(); + } + + @Override + public boolean isEmpty() { + return innerList.isEmpty(); + } + + @Override + public boolean contains(Object o) { + return innerList.contains(o); + } + + @Override + public Iterator iterator() { + return innerList.iterator(); + } + + @Override + public Object[] toArray() { + return innerList.toArray(); + } + + @Override + public T[] toArray(T[] a) { + return innerList.toArray(a); + } + + @Override + public boolean add(T customer) { + return innerList.add(customer); + } + + @Override + public boolean remove(Object o) { + return innerList.remove(o); + } + + @Override + public boolean containsAll(Collection c) { + return innerList.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + return innerList.addAll(c); + } + + @Override + public boolean addAll(int index, Collection c) { + return innerList.addAll(index, c); + } + + @Override + public boolean removeAll(Collection c) { + return innerList.removeAll(c); + } + + @Override + public boolean retainAll(Collection c) { + return innerList.retainAll(c); + } + + @Override + public void clear() { + innerList.clear(); + } + + @Override + public boolean equals(Object o) { + return innerList.equals(o); + } + + @Override + public int hashCode() { + return innerList.hashCode(); + } + + @Override + public T get(int index) { + return innerList.get(index); + } + + @Override + public T set(int index, T element) { + return innerList.set(index, element); + } + + @Override + public void add(int index, T element) { + innerList.add(index, element); + } + + @Override + public T remove(int index) { + return innerList.remove(index); + } + + @Override + public int indexOf(Object o) { + return innerList.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return innerList.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return innerList.listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return innerList.listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return innerList.subList(fromIndex, toIndex); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Invoice.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Invoice.java new file mode 100644 index 0000000000000000000000000000000000000000..1131234ccda6b4567712cb30c21b1e9084f8fd1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Invoice.java @@ -0,0 +1,36 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +public class Invoice { + + private int amount; + private Customer customer; + + public int getAmount() { + return amount; + } + public void setAmount(int amount) { + this.amount = amount; + } + public Customer getCustomer() { + return customer; + } + public void setCustomer(Customer customer) { + this.customer = customer; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Order.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Order.java new file mode 100644 index 0000000000000000000000000000000000000000..63ccb3ebec2025ce37d394b65cd7a22a4316248a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/Order.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +import java.util.List; + +public class Order { + + private long id; + private String order; + private Object dueUntil; + private boolean active; + private List customers; + private OrderDetails orderDetails; + private Object nullValue; + + public long getId() { + return id; + } + public void setId(long id) { + this.id = id; + } + public String getOrder() { + return order; + } + public void setOrder(String order) { + this.order = order; + } + public Object getDueUntil() { + return dueUntil; + } + public void setDueUntil(Object dueUntil) { + this.dueUntil = dueUntil; + } + public boolean isActive() { + return active; + } + public void setActive(boolean active) { + this.active = active; + } + public List getCustomers() { + return customers; + } + public void setCustomers(List customers) { + this.customers = customers; + } + public OrderDetails getOrderDetails() { + return orderDetails; + } + public void setOrderDetails(OrderDetails orderDetails) { + this.orderDetails = orderDetails; + } + public Object getNullValue() { + return nullValue; + } + public void setNullValue(Object nullValue) { + this.nullValue = nullValue; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/OrderDetails.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/OrderDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..56ade8c75c246b295a73f76e84b0270849b88ef3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/OrderDetails.java @@ -0,0 +1,59 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + +import java.util.List; + +public class OrderDetails { + + private String article; + private double price; + private long roundedPrice; + private List currencies; + private boolean paid; + + public String getArticle() { + return article; + } + public void setArticle(String article) { + this.article = article; + } + public double getPrice() { + return price; + } + public void setPrice(double price) { + this.price = price; + } + public long getRoundedPrice() { + return roundedPrice; + } + public void setRoundedPrice(long roundedPrice) { + this.roundedPrice = roundedPrice; + } + public List getCurrencies() { + return currencies; + } + public void setCurrencies(List currencies) { + this.currencies = currencies; + } + public boolean isPaid() { + return paid; + } + public void setPaid(boolean paid) { + this.paid = paid; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/RegularCustomer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/RegularCustomer.java new file mode 100644 index 0000000000000000000000000000000000000000..7339151966854755ee09af503026567d8c9c78b9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/RegularCustomer.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping; + + +public class RegularCustomer implements Customer { + + private String name; + private int contractStartDate; + + public RegularCustomer() { + } + + public RegularCustomer(String name, int contractStartDate) { + this.name = name; + this.contractStartDate = contractStartDate; + } + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public int getContractStartDate() { + return contractStartDate; + } + public void setContractStartDate(int contractStartDate) { + this.contractStartDate = contractStartDate; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResult.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResult.java new file mode 100644 index 0000000000000000000000000000000000000000..d21009628d4e7e3ae02579ccf1787767b84fff9e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResult.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping.dmn; + +import java.io.Serializable; +import java.util.List; + +/** + * @author Svetlana Dorokhova. + */ +public interface DmnDecisionResult extends List, Serializable { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntries.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntries.java new file mode 100644 index 0000000000000000000000000000000000000000..fbea9e2c4aa685f2ee048ab170d15406dfaed3d5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntries.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping.dmn; + +import java.io.Serializable; +import java.util.Map; + +/** + * @author Svetlana Dorokhova. + */ +public interface DmnDecisionResultEntries extends Map, Serializable { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntriesImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntriesImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..1db753afda94e6919068744f6eb0a26d8962cfc0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultEntriesImpl.java @@ -0,0 +1,98 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping.dmn; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + +/** + * @author Svetlana Dorokhova. + */ +public class DmnDecisionResultEntriesImpl implements DmnDecisionResultEntries { + + protected final Map outputValues = new LinkedHashMap(); + + public void putValue(String name, Object value) { + outputValues.put(name, value); + } + + public void putAllValues(Map values) { + outputValues.putAll(values); + } + + @Override + public int size() { + return outputValues.size(); + } + + @Override + public boolean isEmpty() { + return outputValues.isEmpty(); + } + + @Override + public boolean containsKey(Object key) { + return outputValues.containsKey(key); + } + + @Override + public boolean containsValue(Object value) { + return outputValues.containsValue(value); + } + + @Override + public Object get(Object key) { + return outputValues.get(key); + } + + @Override + public Object put(String key, Object value) { + return outputValues.put(key, value); + } + + @Override + public Object remove(Object key) { + return outputValues.remove(key); + } + + @Override + public void putAll(Map m) { + outputValues.putAll(m); + } + + @Override + public void clear() { + outputValues.clear(); + } + + @Override + public Set keySet() { + return outputValues.keySet(); + } + + @Override + public Collection values() { + return outputValues.values(); + } + + @Override + public Set> entrySet() { + return outputValues.entrySet(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultImpl.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..aeb03f52246c06beb1f9474e4b46dac8a3ac052f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/mapping/dmn/DmnDecisionResultImpl.java @@ -0,0 +1,167 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.mapping.dmn; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; + +/** + * @author Svetlana Dorokhova. + */ +public class DmnDecisionResultImpl implements DmnDecisionResult { + + protected final List ruleResults; + + public DmnDecisionResultImpl() { + this.ruleResults = new ArrayList(); + } + + public DmnDecisionResultImpl(List ruleResults) { + this.ruleResults = ruleResults; + } + + @Override + public Iterator iterator() { + return asUnmodifiableList().iterator(); + } + + @Override + public int size() { + return ruleResults.size(); + } + + @Override + public boolean isEmpty() { + return ruleResults.isEmpty(); + } + + @Override + public DmnDecisionResultEntries get(int index) { + return ruleResults.get(index); + } + + @Override + public boolean contains(Object o) { + return ruleResults.contains(o); + } + + @Override + public Object[] toArray() { + return ruleResults.toArray(); + } + + @Override + public T[] toArray(T[] a) { + return ruleResults.toArray(a); + } + + @Override + public boolean add(DmnDecisionResultEntries e) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + + + @Override + public boolean remove(Object o) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public boolean containsAll(Collection c) { + return ruleResults.containsAll(c); + } + + @Override + public boolean addAll(Collection c) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public boolean addAll(int index, Collection c) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public boolean removeAll(Collection c) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public boolean retainAll(Collection c) { + throw new UnsupportedOperationException(); + } + + @Override + public void clear() { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public DmnDecisionResultEntries set(int index, DmnDecisionResultEntries element) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public void add(int index, DmnDecisionResultEntries element) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public DmnDecisionResultEntries remove(int index) { + throw new UnsupportedOperationException("decision result is immutable"); + } + + @Override + public int indexOf(Object o) { + return ruleResults.indexOf(o); + } + + @Override + public int lastIndexOf(Object o) { + return ruleResults.lastIndexOf(o); + } + + @Override + public ListIterator listIterator() { + return asUnmodifiableList().listIterator(); + } + + @Override + public ListIterator listIterator(int index) { + return asUnmodifiableList().listIterator(index); + } + + @Override + public List subList(int fromIndex, int toIndex) { + return asUnmodifiableList().subList(fromIndex, toIndex); + } + + @Override + public String toString() { + return ruleResults.toString(); + } + + protected List asUnmodifiableList() { + return Collections.unmodifiableList(ruleResults); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeDataFormatReaderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeDataFormatReaderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..64315bf2fe55e91a4e008cd54006285d751f6fab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeDataFormatReaderTest.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_COLLECTION; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatReader; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class JsonJacksonTreeDataFormatReaderTest { + + private JacksonJsonDataFormatReader reader; + private Reader inputReader; + + private static final int REWINDING_LIMIT = 256; + + @Before + public void setUp() { + reader = new JacksonJsonDataFormatReader(new JacksonJsonDataFormat(DataFormats.JSON_DATAFORMAT_NAME)); + } + + @Test + public void shouldMatchJsonInput() throws IOException { + inputReader = stringToReader(EXAMPLE_JSON); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + inputReader.close(); + + inputReader = stringToReader(EXAMPLE_JSON_COLLECTION); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + } + + @Test + public void shouldMatchJsonInputWithWhitespace() throws IOException { + inputReader = stringToReader(" " + EXAMPLE_JSON); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + inputReader.close(); + + inputReader = stringToReader("\r\n\t " + EXAMPLE_JSON); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + } + + @Test + public void shouldNotMatchInvalidJson() throws IOException { + inputReader = stringToReader("prefix " + EXAMPLE_JSON); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isFalse(); + } + + public Reader stringToReader(String input) { + return new StringReader(input); + } + + @After + public void tearDown() throws IOException { + if (inputReader != null) { + inputReader.close(); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeNodeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeNodeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f83275b9f657c2984f9192d4ca2921199a983289 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonJacksonTreeNodeTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson; +import static org.camunda.spin.Spin.S; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import java.io.StringWriter; + +import org.camunda.spin.impl.json.jackson.JacksonJsonNode; +import org.junit.Before; +import org.junit.Test; + +public class JsonJacksonTreeNodeTest { + + protected JacksonJsonNode jsonNode; + + @Before + public void parseJson() { + jsonNode = S(EXAMPLE_JSON); + } + + @Test + public void canWriteToString() { + assertThatJson(jsonNode.toString()).isEqualTo(EXAMPLE_JSON); + } + + @Test + public void canWriteToWriter() { + StringWriter writer = new StringWriter(); + jsonNode.writeToWriter(writer); + String value = writer.toString(); + assertThatJson(value).isEqualTo(EXAMPLE_JSON); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..280f2ec96701f52e6c3ff4c49ce4b3a43d3c85b7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateScriptTest.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import org.camunda.spin.impl.json.jackson.JacksonJsonNode; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class JsonTreeCreateScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name="input", value = "{\"root\": 1}") + public void shouldCreateForString() { + + JacksonJsonNode json1 = script.getVariable("json1"); + assertThat(json1).isNotNull(); + + JacksonJsonNode json2 = script.getVariable("json2"); + assertThat(json2).isNotNull(); + + JacksonJsonNode json3 = script.getVariable("json3"); + assertThat(json3).isNotNull(); + + } + + @Test + @Script( + variables = { + @ScriptVariable(name="input1", file = EXAMPLE_JSON_FILE_NAME), + @ScriptVariable(name="input2", file = EXAMPLE_JSON_FILE_NAME), + @ScriptVariable(name="input3", file = EXAMPLE_JSON_FILE_NAME) + } + ) + public void shouldCreateForReader() { + + JacksonJsonNode json1 = script.getVariable("json1"); + assertThat(json1).isNotNull(); + + JacksonJsonNode json2 = script.getVariable("json2"); + assertThat(json2).isNotNull(); + + JacksonJsonNode json3 = script.getVariable("json3"); + assertThat(json3).isNotNull(); + } + + @Test + @Script + @ScriptVariable(name="input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldBeIdempotent() { + + JacksonJsonNode json = script.getVariable("json"); + assertThat(json).isNotNull(); + + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..938da4afd74b042d143d27e9a7ab7f61b7e3eee0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeCreateTest.java @@ -0,0 +1,285 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.DataFormats.json; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.Spin.S; +import static org.camunda.spin.impl.util.SpinIoUtil.stringAsReader; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_EMPTY_STRING; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_INVALID_JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import java.io.Reader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.spi.SpinDataFormatException; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + */ +public class JsonTreeCreateTest { + + @Test + public void shouldCreateForString() { + SpinJsonNode json = JSON(EXAMPLE_JSON); + assertThat(json).isNotNull(); + + json = S(EXAMPLE_JSON, json()); + assertThat(json).isNotNull(); + + json = S(EXAMPLE_JSON, DataFormats.JSON_DATAFORMAT_NAME); + assertThat(json).isNotNull(); + + json = S(EXAMPLE_JSON); + assertThat(json).isNotNull(); + } + + @Test + public void shouldCreateObjectDeclaredInput() { + Object input = EXAMPLE_JSON; + SpinJsonNode jsonNode = JSON(input); + assertThat(jsonNode.prop("order")).isNotNull(); + } + + @Test + public void shouldCreateForReader() { + SpinJsonNode json = JSON(stringAsReader(EXAMPLE_JSON)); + assertThat(json).isNotNull(); + + json = S(stringAsReader(EXAMPLE_JSON), json()); + assertThat(json).isNotNull(); + + json = S(stringAsReader(EXAMPLE_JSON), DataFormats.JSON_DATAFORMAT_NAME); + assertThat(json).isNotNull(); + + json = S(stringAsReader(EXAMPLE_JSON)); + assertThat(json).isNotNull(); + } + + @Test + public void shouldBeIdempotent() { + SpinJsonNode json = JSON(EXAMPLE_JSON); + assertThat(json).isEqualTo(JSON(json)); + assertThat(json).isEqualTo(S(json, json())); + assertThat(json).isEqualTo(S(json, DataFormats.JSON_DATAFORMAT_NAME)); + assertThat(json).isEqualTo(S(json)); + } + + @Test + public void shouldFailForNull() { + SpinJsonNode jsonNode = null; + + try { + JSON(jsonNode); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(jsonNode, json()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(jsonNode); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + Reader reader = null; + + try { + JSON(reader); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(reader, json()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(reader); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + String inputString = null; + + try { + JSON(inputString); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString, json()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString, DataFormats.JSON_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void shouldFailForInvalidJson() { + try { + JSON(EXAMPLE_INVALID_JSON); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_JSON, json()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_JSON, DataFormats.JSON_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_JSON); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void shouldFailForEmptyString() { + try { + JSON(EXAMPLE_EMPTY_STRING); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING, json()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING, DataFormats.JSON_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void shouldFailForEmptyReader() { + try { + JSON(stringAsReader(EXAMPLE_EMPTY_STRING)); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(stringAsReader(EXAMPLE_EMPTY_STRING), json()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(stringAsReader(EXAMPLE_EMPTY_STRING)); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void shouldCreateForBoolean() { + SpinJsonNode node = JSON("false"); + assertThat(node.isBoolean()).isTrue(); + assertThat(node.isValue()).isTrue(); + assertThat(node.boolValue()).isFalse(); + } + + @Test + public void shouldCreateForNumber() { + SpinJsonNode node = JSON("42"); + assertThat(node.isNumber()).isTrue(); + assertThat(node.isValue()).isTrue(); + assertThat(node.numberValue()).isEqualTo(42); + } + + @Test + public void shouldCreateForPrimitiveString() { + SpinJsonNode node = JSON("\"a String\""); + assertThat(node.isString()).isTrue(); + assertThat(node.isValue()).isTrue(); + assertThat(node.stringValue()).isEqualTo("a String"); + } + + @Test + public void shouldFailForUnescapedString() { + try { + JSON("a String"); + fail("expected exception"); + } catch (SpinDataFormatException e) { + // expected + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c7700eaf13c64779da8e878129117de3073f117b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyScriptTest.java @@ -0,0 +1,499 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Test; + +/** + * Index: + * 1) indexOf + * 2) lastIndexOf + * 3) append + * 4) insertAt + * 5) insertBefore + * 6) insertAfter + * 7) remove + * 8) removeLast + * 9) removeAt + * + * @author Stefan Hentschel + * + */ +public abstract class JsonTreeEditListPropertyScriptTest extends ScriptTest { + + // ----------------- 1) indexOf ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadIndexOfNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadIndexOfWithoutSearchNode() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadIndexOfNonExistentValue() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadIndexOf() { + Number i = script.getVariable("value"); + + // Casts to int because ruby returns long instead of int values! + assertThat(i.intValue()).isEqualTo(1); + } + + // ----------------- 2) lastIndexOf ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadLastIndexOfNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadLastIndexOfWithoutSearchNode() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadLastIndexOfNonExistentValue() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadLastIndexOf() { + Number i = script.getVariable("value"); + + // Casts to int because ruby returns long instead of int values! + assertThat(i.intValue()).isEqualTo(1); + } + + // ----------------- 3) append ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailAppendToNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailAppendWrongNode() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailAppendNullNode() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldAppendNodeToArray() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String value = script.getVariable("value"); + + // casts to int because ruby returns long instead of int values! + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(value).isEqualTo("Testcustomer"); + } + + // ----------------- 4) insertAt ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAtNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = IndexOutOfBoundsException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAtWithIndexOutOfBounds() throws Throwable { + failingWithException(); + } + + @Test(expected = IndexOutOfBoundsException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAtWithNegativeIndexOutOfBounds() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAtWithWrongObject() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAtWithNullObject() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldInsertAtWithIndex() { + Number oldSize = script.getVariable("oldSize"); + Number oldPosition = script.getVariable("oldPosition"); + Number newSize = script.getVariable("newSize"); + Number newPosition = script.getVariable("newPosition"); + String value = script.getVariable("value"); + + // Casts to int because ruby returns long instead of int! + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(oldPosition.intValue() + 1).isEqualTo(newPosition.intValue()); + assertThat(value).isEqualTo("test1"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldInsertAtWithNegativeIndex() { + Number oldSize = script.getVariable("oldSize"); + Number oldPosition = script.getVariable("oldPosition"); + Number newSize = script.getVariable("newSize"); + Number newPosition = script.getVariable("newPosition"); + String value = script.getVariable("value"); + + // Casts to Int because Ruby returns long values instead of int + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(oldPosition.intValue() + 1).isEqualTo(newPosition.intValue()); + assertThat(value).isEqualTo("test1"); + } + + // ----------------- 5) insertBefore ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertBeforeNonExistentSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertBeforeWithNullAsSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertNullObjectBeforeSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertWrongObjectBeforeSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertBeforeWrongSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertBeforeOnNonArray() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldInsertBeforeSearchObjectOnBeginning() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String oldValue = script.getVariable("oldValue"); + String newValue = script.getVariable("newValue"); + String oldValueOnNewPosition = script.getVariable("oldValueOnNewPosition"); + + // casts to int because ruby returns long instead of int + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(oldValue).isEqualTo("euro"); + assertThat(oldValue).isEqualTo(oldValueOnNewPosition); + assertThat(newValue).isEqualTo("Test"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldInsertBeforeSearchObject() { + Number oldSize = script.getVariable("oldSize"); + String oldValue = script.getVariable("oldValue"); + String oldValueOnNewPosition = script.getVariable("oldValueOnNewPosition"); + + Number newSize = script.getVariable("newSize"); + String newValue = script.getVariable("newValue"); + + // casts to int because ruby returns long instead of int + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(oldValue).isEqualTo("dollar"); + assertThat(oldValue).isEqualTo(oldValueOnNewPosition); + assertThat(newValue).isEqualTo("Test"); + } + + // ----------------- 6) insertAfter ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAfterNonExistentSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAfterWithNullAsSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertNullObjectAfterSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertWrongObjectAfterSearchObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAfterOnNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailInsertAfterWrongSearchObject() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldInsertAfterSearchObjectOnEnding() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String oldValue = script.getVariable("oldValue"); + String newValue = script.getVariable("newValue"); + String oldValueOnNewPosition = script.getVariable("oldValueOnNewPosition"); + + // casts to int because ruby returns long instead of int + assertThat(oldSize.intValue() + 1).isEqualTo(newSize.intValue()); + assertThat(oldValue).isEqualTo("dollar"); + assertThat(oldValue).isEqualTo(oldValueOnNewPosition); + assertThat(newValue).isEqualTo("Test"); + } + + // ----------------- 7) remove ---------------------- + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveNonExistentObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveNullObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveWrongObject() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldRemoveObject() { + Number oldSize = script.getVariable("oldSize"); + String oldValue = script.getVariable("oldValue"); + Number newSize = script.getVariable("newSize"); + String newValue = script.getVariable("newValue"); + + assertThat(oldValue.equals(newValue)).isFalse(); + + // Casts to int because ruby returns long instead of int values! + assertThat(oldSize.intValue() - 1).isEqualTo(newSize.intValue()); + } + + // ----------------- 8) removeLast ---------------------- + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveLastNullObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveLastWrongObject() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveLastNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveLastNonExistentObject() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", value = "[\"test\",\"test\",\"new value\",\"test\"]") + public void shouldRemoveLast() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String oldValue = script.getVariable("oldValue"); + String value = script.getVariable("newValue"); + + // casts to int because ruby returns long instead of int + assertThat(oldSize.intValue() - 1).isEqualTo(newSize.intValue()); + assertThat(oldValue).isEqualTo("test"); + assertThat(value).isEqualTo("new value"); + } + + // ----------------- 9) removeAt ---------------------- + + @Test(expected = SpinJsonException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveAtNonArray() throws Throwable { + failingWithException(); + } + + @Test(expected = IndexOutOfBoundsException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveAtWithIndexOutOfBounds() throws Throwable { + failingWithException(); + } + + @Test(expected = IndexOutOfBoundsException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailRemoveAtWithNegativeIndexOutOfBounds() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldRemoveAtWithIndex() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String value = script.getVariable("value"); + + + // casts to int because ruby returns long instead of int + assertThat(newSize.intValue()).isEqualTo(1); + assertThat(oldSize.intValue() - 1).isEqualTo(newSize.intValue()); + assertThat(value).isEqualTo("euro"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldRemoveAtWithNegativeIndex() { + Number oldSize = script.getVariable("oldSize"); + Number newSize = script.getVariable("newSize"); + String value = script.getVariable("value"); + + // casts to int because ruby returns long instead of int + assertThat(newSize.intValue()).isEqualTo(1); + assertThat(oldSize.intValue() - 1).isEqualTo(newSize.intValue()); + assertThat(value).isEqualTo("dollar"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f8dd2b0bd43b714d424bf964d6e15c8de0d47264 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeEditListPropertyTest.java @@ -0,0 +1,639 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import java.util.Date; + +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Before; +import org.junit.Test; + +/** + * Index: + * 1) indexOf + * 2) lastIndexOf + * 3) append + * 4) insertAt + * 5) insertBefore + * 6) insertAfter + * 7) remove + * 8) removeLast + * 9) removeAt + * 10) contains + * + * @author Stefan Hentschel + */ +public class JsonTreeEditListPropertyTest { + + protected SpinJsonNode jsonNode; + protected SpinJsonNode customers; + protected SpinJsonNode currencies; + + @Before + public void readJson() { + jsonNode = JSON(EXAMPLE_JSON); + customers = jsonNode.prop("customers"); + currencies = jsonNode.prop("orderDetails").prop("currencies"); + } + + // ----------------- 1) indexOf ---------------------- + + @Test + public void readIndexOfNonArray() { + try { + jsonNode.indexOf("n"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void readIndexOfWithoutSearchNode() { + try { + jsonNode.indexOf(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void readIndexOfNonExistentValue() { + try { + customers.indexOf("n"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void readIndexOfExistentValue() { + Integer i = currencies.indexOf("euro"); + + assertThat(i).isEqualTo(0); + } + + // ----------------- 2) lastIndexOf ---------------------- + + @Test + public void readLastIndexOfNonArray() { + try { + jsonNode.lastIndexOf("n"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void readLastIndexOfWithoutSearchNode() { + try { + jsonNode.lastIndexOf(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void readLastIndexOfNonExistentValue() { + try { + customers.lastIndexOf("n"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void readLastIndexOfExistentValue() { + Integer i = currencies.lastIndexOf("dollar"); + + assertThat(i).isEqualTo(1); + } + + // ----------------- 3) append ---------------------- + + @Test + public void appendNodeToArray() { + Integer oldSize = customers.elements().size(); + customers.append("Testcustomer"); + Integer newSize = customers.elements().size(); + + assertThat(oldSize).isNotEqualTo(newSize); + assertThat(oldSize + 1).isEqualTo(newSize); + assertThat(customers.elements().get(oldSize).isString()).isTrue(); + assertThat(customers.elements().get(oldSize).stringValue()).isEqualTo("Testcustomer"); + } + + @Test + public void appendNodeToNonArray() { + try { + jsonNode.append("testcustomer"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + //expected + } + } + + @Test + public void appendWrongNode() { + try { + jsonNode.append(new Date()); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void appendNullNode() { + try { + jsonNode.append(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + // ----------------- 4) insertAt ---------------------- + + @Test + public void insertAtWithIndex() { + Integer oldSize = currencies.elements().size(); + Integer oldPosition = currencies.indexOf("dollar"); + SpinJsonNode oldNode = currencies.elements().get(1); + + currencies.insertAt(1, "test1"); + + Integer newSize = currencies.elements().size(); + Integer newPosition = currencies.indexOf("dollar"); + SpinJsonNode newNode = currencies.elements().get(1); + + assertThat(oldSize + 1).isEqualTo(newSize); + assertThat(newNode.equals(oldNode)).isFalse(); + assertThat(newNode.stringValue()).isEqualTo("test1"); + assertThat(oldPosition + 1).isEqualTo(newPosition); + } + + @Test + public void insertAtNonArray() { + try { + jsonNode.insertAt(1, "test"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void insertAtWithNegativeIndex() { + Integer oldSize = currencies.elements().size(); + Integer oldPosition = currencies.indexOf("dollar"); + SpinJsonNode oldNode = currencies.elements().get(0); + + currencies.insertAt(-2, "test1"); + + Integer newSize = currencies.elements().size(); + Integer newPosition = currencies.indexOf("dollar"); + SpinJsonNode newNode = currencies.elements().get(0); + + assertThat(oldSize + 1).isEqualTo(newSize); + assertThat(newNode.equals(oldNode)).isFalse(); + assertThat(newNode.stringValue()).isEqualTo("test1"); + assertThat(oldPosition + 1).isEqualTo(newPosition); + } + + @Test + public void insertAtWithIndexOutOfBounds() { + try { + currencies.insertAt(6, "string"); + fail("Expected: IndexOutOfBoundsException"); + } catch(IndexOutOfBoundsException e) { + // expected + } + } + + @Test + public void insertAtWithNegativeIndexOutOfBounds() { + try { + currencies.insertAt(-6, "string"); + fail("Expected: IndexOutOfBoundsException"); + } catch(IndexOutOfBoundsException e) { + // expected + } + } + + @Test + public void insertAtWithWrongObject() { + try { + currencies.insertAt(1, new Date()); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void insertAtWithNullObject() { + try { + currencies.insertAt(1, null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + // ----------------- 5) insertBefore ---------------------- + + @Test + public void insertBeforeNonExistentSearchObject() { + try { + currencies.insertBefore(1, "test"); + fail("Expected: SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void insertBeforeWithNullAsSearchObject() { + try { + currencies.insertBefore(null, "test"); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void insertBeforeSearchObjectOnBeginning() { + SpinJsonNode oldNode = currencies.elements().get(0); + Integer size = currencies.elements().size(); + + currencies.insertBefore("euro", "Test"); + + SpinJsonNode newNode = currencies.elements().get(0); + SpinJsonNode oldNodeNewPosition = currencies.elements().get(1); + Integer newSize = currencies.elements().size(); + + assertThat(oldNode.equals(newNode)).isFalse(); + assertThat(newNode.stringValue()).isEqualTo("Test"); + assertThat(oldNode.stringValue()).isEqualTo(oldNodeNewPosition.stringValue()); + assertThat(size).isNotEqualTo(newSize); + } + + @Test + public void insertBeforeSearchObject() { + SpinJsonNode oldNode = currencies.elements().get(1); + Integer size = currencies.elements().size(); + + currencies.insertBefore("dollar", "Test"); + + SpinJsonNode newNode = currencies.elements().get(1); + SpinJsonNode oldNodeNewPosition = currencies.elements().get(2); + Integer newSize = currencies.elements().size(); + + assertThat(oldNode).isNotEqualTo(newNode); + assertThat(newNode.stringValue()).isEqualTo("Test"); + assertThat(oldNode.stringValue()).isEqualTo(oldNodeNewPosition.stringValue()); + assertThat(size).isNotEqualTo(newSize); + } + + @Test + public void insertNullObjectBeforeSearchObject() { + try { + currencies.insertBefore("euro", null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void insertWrongObjectBeforeSearchObject() { + try { + currencies.insertBefore("euro", new Date()); + fail("Expected: SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void insertObjectBeforeWrongSearchObject() { + try { + currencies.insertBefore(new Date(), "test"); + fail("Expected: SpinJsonTreePropertyException"); + } catch (SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void insertBeforeOnNonArray() { + try { + jsonNode.insertBefore("test", "test"); + fail("Expected: SpinJsonTreeNodeException"); + } catch (SpinJsonException e) { + // expected + } + } + + // ----------------- 6) insertAfter ---------------------- + + @Test + public void insertAfterNonExistentSearchObject() { + try { + currencies.insertBefore("test", "test"); + fail("Expected: SpinJsonTreeNodeException"); + } catch (SpinJsonException e) { + // expected + } + } + + @Test + public void insertAfterSearchObjectOnEnding() { + SpinJsonNode oldNode = currencies.elements().get(1); + Integer size = currencies.elements().size(); + + currencies.insertAfter("dollar", "Test"); + + SpinJsonNode newNode = currencies.elements().get(2); + SpinJsonNode oldNodeNewPosition = currencies.elements().get(1); + Integer newSize = currencies.elements().size(); + + assertThat(oldNode.equals(newNode)).isFalse(); + assertThat(oldNode.stringValue()).isEqualTo(oldNodeNewPosition.stringValue()); + assertThat(size).isNotEqualTo(newSize); + } + + @Test + public void insertAfterSearchObject() { + SpinJsonNode oldNode = currencies.elements().get(0); + Integer size = currencies.elements().size(); + + currencies.insertAfter("dollar", "Test"); + + SpinJsonNode newNode = currencies.elements().get(1); + SpinJsonNode oldNodeNewPosition = currencies.elements().get(0); + Integer newSize = currencies.elements().size(); + + assertThat(oldNode.equals(newNode)).isFalse(); + assertThat(oldNode.stringValue()).isEqualTo(oldNodeNewPosition.stringValue()); + assertThat(size).isNotEqualTo(newSize); + } + + @Test + public void insertNullObjectAfterSearchObject() { + try { + currencies.insertBefore("euro", null); + fail("Expected: IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // expected + } + } + + @Test + public void insertWrongObjectAfterSearchObject() { + try { + currencies.insertBefore("euro", new Date()); + fail("Expected: SpinJsonTreeNodeException"); + } catch (SpinJsonException e) { + // expected + } + } + + @Test + public void insertAfterOnNonArray() { + try { + jsonNode.insertBefore("euro", "test"); + fail("Expected: SpinJsonTreeNodeException"); + } catch (SpinJsonException e) { + // expected + } + } + + @Test + public void insertObjectAfterWrongSearchObject() { + try { + currencies.insertAfter(new Date(), "test"); + fail("Expected: SpinJsonTreePropertyException"); + } catch (SpinJsonPropertyException e) { + // expected + } + } + + // ----------------- 7) remove ---------------------- + + @Test + public void removeObject() { + Integer oldSize = currencies.elements().size(); + + currencies.remove("euro"); + + Integer newSize = currencies.elements().size(); + SpinJsonNode node = currencies.elements().get(0); + + assertThat(oldSize).isNotEqualTo(newSize); + assertThat(oldSize - 1).isEqualTo(newSize); + assertThat(node.stringValue()).isEqualTo("dollar"); + } + + @Test + public void removeNonExistentObject() { + try { + currencies.remove("test"); + fail("Expected: SpinJsonTreePropertyException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void removeObjectInNonExistentArray() { + try { + jsonNode.remove("test"); + fail("Expected: SpinJsonTreePropertyException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void removeNullObject() { + try { + jsonNode.remove(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + // ----------------- 8) removeLast ---------------------- + + @Test + public void removeLastNullObject() { + try { + currencies.removeLast(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void removeLastWrongObject() { + try { + currencies.removeLast(new Date()); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void removeLast() { + String testJson = "[\"test\",\"test\",\"new value\",\"test\"]"; + SpinJsonNode testNode = JSON(testJson); + Integer size = testNode.elements().size(); + + testNode.removeLast("test"); + + Integer newSize = testNode.elements().size(); + SpinJsonNode node = testNode.elements().get(newSize - 1); + + assertThat(newSize).isNotEqualTo(size); + assertThat(newSize + 1).isEqualTo(size); + assertThat(node.stringValue()).isEqualTo("new value"); + } + + @Test + public void removeLastNonExistentArray() { + try { + jsonNode.removeLast(1); + fail("Expected: SpinJsonTreeNodeException "); + } catch(SpinJsonException e) { + // expected + } + } + + // ----------------- 9) removeAt ---------------------- + + @Test + public void removeAtWithIndex() { + Integer oldSize = currencies.elements().size(); + + currencies.removeAt(1); + + Integer newSize = currencies.elements().size(); + SpinJsonNode node = currencies.elements().get(newSize - 1); + + assertThat(newSize).isEqualTo(1); + assertThat(newSize + 1).isEqualTo(oldSize); + assertThat(node.stringValue()).isEqualTo("euro"); + } + + @Test + public void removeAtNonArray() { + try { + jsonNode.removeAt(1); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void removeAtWithNegativeIndex() { + Integer oldSize = currencies.elements().size(); + + currencies.removeAt(-2); + + Integer newSize = currencies.elements().size(); + SpinJsonNode node = currencies.elements().get(newSize - 1); + + assertThat(newSize).isEqualTo(1); + assertThat(newSize + 1).isEqualTo(oldSize); + assertThat(node.stringValue()).isEqualTo("dollar"); + } + + @Test + public void removeAtWithIndexOutOfBounds() { + try { + currencies.removeAt(6); + fail("Expected: IndexOutOfBoundsException"); + } catch(IndexOutOfBoundsException e){ + // expected + } + } + + @Test + public void removeAtWithNegativeIndexOutOfBounds() { + try { + currencies.removeAt(-6); + fail("Expected: IndexOutOfBoundsException"); + } catch(IndexOutOfBoundsException e){ + // expected + } + } + + // ----------------- 10) contains ---------------------- + + @Test + public void containsOfNonArray() { + try { + jsonNode.contains("n"); + fail("Expected: SpinJsonTreeNodeException"); + } catch(SpinJsonException e) { + // expected + } + } + + @Test + public void containsWithoutSearchNode() { + try { + jsonNode.contains(null); + fail("Expected: IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void containsNonExistentValue() { + boolean res = customers.contains("n"); + + assertThat(res).isFalse(); + } + + @Test + public void containsOfExistentValue() { + boolean res = currencies.contains("euro"); + + assertThat(res).isTrue(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d3b23d610ae69d570ea03ec192d4137fd4a121ae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathScriptTest.java @@ -0,0 +1,175 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPathException; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class JsonTreeJsonPathScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetElementFromJsonPath() { + SpinJsonNode node = script.getVariable("node"); + + assertThat(node.isObject()).isTrue(); + assertThat(node.prop("article").isString()).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetElementListFromJsonPath() { + SpinList nodeList = script.getVariable("nodeList"); + + assertThat(nodeList).hasSize(3); + assertThat(nodeList.get(0).isObject()).isTrue(); + assertThat(nodeList.get(0).prop("name").isString()).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetBooleanFromJsonPath() { + Boolean bool = script.getVariable("booleanValue"); + + assertThat(bool).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetStringFromJsonPath() { + String string = script.getVariable("stringValue"); + + assertThat(string).isEqualTo("order1"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetNumberFromJsonPath() { + Number number = script.getVariable("numberValue"); + + assertThat(number.doubleValue()).isEqualTo(1234567.13d); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetSingleArrayEntry() { + SpinJsonNode node = script.getVariable("node"); + + assertThat(node.isObject()); + assertThat(node.prop("name").isString()); + assertThat(node.prop("name").stringValue()).isEqualTo("Kermit"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetMultipleArrayEntries() { + SpinList nodeList = script.getVariable("nodeList"); + + assertThat(nodeList).hasSize(2); + assertThat(nodeList.get(0).prop("name").stringValue()).isEqualTo("Kermit"); + assertThat(nodeList.get(1).prop("name").stringValue()).isEqualTo("Waldo"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldGetFilteredResult() { + SpinList nodeList = script.getVariable("emptyList"); + + assertThat(nodeList.size()).isEqualTo(0); + + SpinList nodeList2 = script.getVariable("nodeList"); + + assertThat(nodeList2.size()).isEqualTo(1); + assertThat(nodeList2.get(0).prop("name").stringValue()).isEqualTo("Waldo"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void souldGetMultipleArrayPropertyValues() { + SpinList nodeList = script.getVariable("nodeList"); + + assertThat(nodeList).hasSize(3); + assertThat(nodeList.get(0).stringValue()).isEqualTo("Kermit"); + assertThat(nodeList.get(1).stringValue()).isEqualTo("Waldo"); + assertThat(nodeList.get(2).stringValue()).isEqualTo("Johnny"); + } + + @Test(expected = SpinJsonPathException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadingJsonPath() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonPathException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailAccessNonExistentProperty() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadingElementList() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadingString() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadingNumber() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailReadingBoolean() throws Throwable{ + failingWithException(); + } +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4ec1d9b4eed6acb9d34c45e57aa585f9049d9279 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeJsonPathTest.java @@ -0,0 +1,284 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import org.camunda.spin.SpinList; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPathException; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Stefan Hentschel + */ +public class JsonTreeJsonPathTest { + + protected SpinJsonNode jsonNode; + + @Before + public void readJson() { + jsonNode = JSON(EXAMPLE_JSON); + } + + @Test + public void shouldGetElementFromJsonPath() { + SpinJsonNode node = jsonNode.jsonPath("$.orderDetails").element(); + + assertThat(node.isObject()).isTrue(); + assertThat(node.prop("article").isString()).isTrue(); + } + + @Test + public void shouldGetElementListFromJsonPath() { + SpinList node = jsonNode.jsonPath("$.customers").elementList(); + + assertThat(node).hasSize(3); + assertThat(node.get(0).isObject()).isTrue(); + assertThat(node.get(0).prop("name").isString()).isTrue(); + } + + @Test + public void shouldGetBooleanFromJsonPath() { + Boolean active = jsonNode.jsonPath("$.active").boolValue(); + + assertThat(active).isTrue(); + } + + @Test + public void shouldGetStringFromJsonPath() { + String order = jsonNode.jsonPath("$.order").stringValue(); + + assertThat(order).isEqualTo("order1"); + } + + @Test + public void shouldGetNumberFromJsonPath() { + Number order = jsonNode.jsonPath("$.id").numberValue(); + + assertThat(order.longValue()).isEqualTo(1234567890987654321L); + } + + @Test + public void shouldGetNullNode() { + SpinJsonNode node = jsonNode.jsonPath("$.nullValue").element(); + assertThat(node.isNull()).isTrue(); + } + + @Test + public void shouldGetSingleArrayEntry() { + SpinJsonNode node = jsonNode.jsonPath("$.customers[0]").element(); + + assertThat(node.isObject()); + assertThat(node.prop("name").isString()); + assertThat(node.prop("name").stringValue()).isEqualTo("Kermit"); + } + + @Test + public void shouldGetMultipleArrayEntries() { + SpinList nodeList = jsonNode.jsonPath("$.customers[0:2]").elementList(); + + assertThat(nodeList).hasSize(2); + assertThat(nodeList.get(0).prop("name").stringValue()).isEqualTo("Kermit"); + assertThat(nodeList.get(1).prop("name").stringValue()).isEqualTo("Waldo"); + } + + @Test + public void shouldGetFilteredResult() { + SpinList nodeList = jsonNode.jsonPath("$.customers[?(@.name == 'Klo')]").elementList(); + + assertThat(nodeList.size()).isEqualTo(0); + + nodeList = jsonNode.jsonPath("$.customers[?(@.name == 'Waldo')]").elementList(); + + assertThat(nodeList.size()).isEqualTo(1); + assertThat(nodeList.get(0).prop("name").stringValue()).isEqualTo("Waldo"); + } + + @Test + public void shouldGetMultipleArrayPropertyValues() { + SpinList nodeList = jsonNode.jsonPath("$.customers[*].name").elementList(); + + assertThat(nodeList).hasSize(3); + assertThat(nodeList.get(0).stringValue()).isEqualTo("Kermit"); + assertThat(nodeList.get(1).stringValue()).isEqualTo("Waldo"); + assertThat(nodeList.get(2).stringValue()).isEqualTo("Johnny"); + } + + @Test + public void failReadingJsonPath() { + try { + jsonNode.jsonPath("$.....").element(); + fail("Expected: SpinJsonTreePathException"); + } catch(SpinJsonPathException ex) { + // expected + } + + try { + jsonNode.jsonPath("").element(); + fail("Expected: SpinJsonTreePathException"); + } catch(SpinJsonPathException ex) { + // expected + } + } + + @Test + public void failAccessNonExistentProperty() { + try { + jsonNode.jsonPath("$.order.test").element(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonPathException ex) { + // expected + } + } + + @Test + public void failReadingElementList() { + try { + jsonNode.jsonPath("$.order").elementList(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.id").elementList(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.active").elementList(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$").elementList(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + } + + @Test + public void failReadingStringProperty() { + try { + jsonNode.jsonPath("$.customers").stringValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.active").stringValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.id").stringValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$").stringValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException ex) { + // expected + } + } + + @Test + public void failReadingNumberProperty() { + try { + jsonNode.jsonPath("$.customers").numberValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.active").numberValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.order").numberValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$").numberValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + } + + @Test + public void failReadingBooleanProperty() { + try { + jsonNode.jsonPath("$.customers").boolValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.id").boolValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$.order").boolValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + + try { + jsonNode.jsonPath("$").boolValue(); + fail("Expected: SpinJsonDataFormatException"); + } catch (SpinJsonDataFormatException ex) { + // expected + } + } + + @Test(expected = SpinJsonPathException.class) + public void failOnNonExistingJsonPath() { + SpinJsonNode json = JSON("{\"a\": {\"id\": \"a\"}, \"b\": {\"id\": \"b\"}}"); + json.jsonPath("$.c?(@.id)").element(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJavaToJsonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJavaToJsonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7b4bd139c3ac3b18b560c56ffea310b3d215f39c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJavaToJsonTest.java @@ -0,0 +1,130 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; +import static org.camunda.spin.json.JsonTestConstants.createExampleOrder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.spin.SpinList; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.mapping.Order; +import org.junit.Test; + +public class JsonTreeMapJavaToJsonTest { + + @Test + public void shouldMapJavaObjectToJson() { + Order exampleOrder = createExampleOrder(); + + String json = JSON(exampleOrder).toString(); + + assertThatJson(json).isEqualTo(EXAMPLE_JSON); + } + + @Test + public void shouldMapListToJson() { + List names = new ArrayList(); + names.add("Waldo"); + names.add("Hugo"); + names.add("Kermit"); + + String json = JSON(names).toString(); + + String expectedJson = "[\"Waldo\", \"Hugo\", \"Kermit\"]"; + assertThatJson(json).isEqualTo(expectedJson); + } + + @Test + public void shouldMapArrayToJson() { + String[] names = new String[] { "Waldo", "Hugo", "Kermit" }; + + String json = JSON(names).toString(); + + String expectedJson = "[\"Waldo\", \"Hugo\", \"Kermit\"]"; + assertThatJson(json).isEqualTo(expectedJson); + } + + @Test + public void shouldMapMapToJson() { + Map javaMap = new HashMap(); + javaMap.put("aKey", "aValue"); + javaMap.put("anotherKey", 42); + + String json = JSON(javaMap).toString(); + + String expectedJson = "{\"aKey\" : \"aValue\", \"anotherKey\" : 42}"; + assertThatJson(json).isEqualTo(expectedJson); + } + + @Test + public void shouldFailWithNull() { + try { + JSON(null).toString(); + fail("expected exception"); + } catch (IllegalArgumentException e) { + // happy path + } + } + + @Test + public void shouldMapPrimitiveBooleanToJson() { + SpinJsonNode node = JSON(true); + assertThat(node.isBoolean()).isTrue(); + assertThat(node.isValue()).isTrue(); + assertThat(node.boolValue()).isTrue(); + } + + @Test + public void shouldMapPrimitiveNumberToJson() { + SpinJsonNode node = JSON(42); + assertThat(node.isNumber()).isTrue(); + assertThat(node.isValue()).isTrue(); + assertThat(node.numberValue()).isEqualTo(42); + } + + @Test + public void shouldMapListOfPrimitiveStrings() { + List inputList = new ArrayList(); + inputList.add("Waldo"); + inputList.add("Hugo"); + inputList.add("Kermit"); + + SpinJsonNode node = JSON(inputList); + assertThat(node.isArray()).isTrue(); + + SpinList elements = node.elements(); + assertThat(elements.get(0).stringValue()).isEqualTo("Waldo"); + assertThat(elements.get(1).stringValue()).isEqualTo("Hugo"); + assertThat(elements.get(2).stringValue()).isEqualTo("Kermit"); + } + + protected Map newMap(String key, Object value) { + Map result = new HashMap(); + result.put(key, value); + + return result; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1bdaabb5e65fcb061dc5b82b19b5c59070d3d32d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java @@ -0,0 +1,112 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_COLLECTION; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; +import static org.camunda.spin.json.JsonTestConstants.assertIsExampleOrder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.mapping.Order; +import org.camunda.spin.json.mapping.RegularCustomer; +import org.junit.Test; + +public abstract class JsonTreeMapJsonToJavaScriptTest extends ScriptTest { + + @Test + @Script( + name = "JsonTreeMapJsonToJavaScriptTest.mapToType", + execute = false + ) + @ScriptVariable(name = "input", file=EXAMPLE_JSON_FILE_NAME) + public void shouldMapJsonObjectToJavaObject() throws Throwable { + Map variables = newMap("mapToType", Order.class); + Order order = script.execute(variables).getVariable("result"); + assertIsExampleOrder(order); + } + + @Test(expected = SpinJsonException.class) + @Script( + name = "JsonTreeMapJsonToJavaScriptTest.mapToType", + execute = false + ) + @ScriptVariable(name = "input", file=EXAMPLE_JSON_FILE_NAME) + public void shouldFailMappingToMismatchingClass() throws Throwable { + Map variables = newMap("mapToType", RegularCustomer.class); + failingWithException(variables); + } + + @Test + @Script( + name = "JsonTreeMapJsonToJavaScriptTest.mapToType", + execute = false + ) + @ScriptVariable(name = "input", file=EXAMPLE_JSON_FILE_NAME) + public void shouldMapByCanonicalString() throws Throwable { + Map variables = newMap("mapToType", Order.class.getCanonicalName()); + Order order = script.execute(variables).getVariable("result"); + assertIsExampleOrder(order); + } + + @Test + @Script( + name = "JsonTreeMapJsonToJavaScriptTest.mapToCollection", + execute = false + ) + public void shouldMapListByCanonicalString() throws Throwable { + Map variables = new HashMap(); + variables.put("input", EXAMPLE_JSON_COLLECTION); + variables.put("collectionType", ArrayList.class); + variables.put("mapToType", Order.class); + + List orders = script.execute(variables).getVariable("result"); + + assertThat(orders.size()).isEqualTo(1); + assertIsExampleOrder(orders.get(0)); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script( + name = "JsonTreeMapJsonToJavaScriptTest.mapToType", + variables = { + @ScriptVariable(name = "input", file=EXAMPLE_JSON_FILE_NAME), + @ScriptVariable(name = "mapToType", value = "rubbish") + }, + execute = false + ) + public void shouldFailForMalformedTypeString() throws Throwable { + failingWithException(); + } + + protected Map newMap(String key, Object value) { + Map result = new HashMap(); + result.put(key, value); + + return result; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaTest.java new file mode 100644 index 0000000000000000000000000000000000000000..26a554a7216b2b7ffb34086547c28daf76db2cb3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapJsonToJavaTest.java @@ -0,0 +1,93 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_COLLECTION; +import static org.camunda.spin.json.JsonTestConstants.assertIsExampleOrder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonException; +import org.camunda.spin.json.mapping.Order; +import org.camunda.spin.json.mapping.RegularCustomer; +import org.junit.Test; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.type.TypeFactory; + +public class JsonTreeMapJsonToJavaTest { + + @Test + public void shouldMapJsonObjectToJavaObject() { + Order order = JSON(EXAMPLE_JSON).mapTo(Order.class); + assertIsExampleOrder(order); + } + + @Test + public void shouldFailMappingToMismatchingClass() { + try { + JSON(EXAMPLE_JSON).mapTo(RegularCustomer.class); + fail("Expected SpinJsonTreeNodeException"); + } catch (SpinJsonException e) { + // happy path + } + } + + @Test + public void shouldMapByCanonicalString() { + Order order = JSON(EXAMPLE_JSON).mapTo(Order.class.getCanonicalName()); + assertIsExampleOrder(order); + } + + @Test + public void shouldMapListByCanonicalString() throws JsonProcessingException { + JavaType desiredType = + TypeFactory.defaultInstance().constructCollectionType(ArrayList.class, Order.class); + + List orders = JSON(EXAMPLE_JSON_COLLECTION).mapTo(desiredType.toCanonical()); + + assertThat(orders.size()).isEqualTo(1); + assertIsExampleOrder(orders.get(0)); + } + + @Test + public void shouldFailForMalformedTypeString() { + try { + JSON(EXAMPLE_JSON_COLLECTION).mapTo("rubbish"); + fail("Expected SpinJsonTreeNodeException"); + } catch (SpinJsonDataFormatException e) { + // happy path + } + } + + protected Map newMap(String key, Object value) { + Map result = new HashMap(); + result.put(key, value); + + return result; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapObjectToJsonScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapObjectToJsonScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5fe50ada5c3600cd732fa21db9dbdf6d270ea90a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeMapObjectToJsonScriptTest.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson; +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.json.SpinJsonNode; +import org.junit.Test; + +public abstract class JsonTreeMapObjectToJsonScriptTest extends ScriptTest { + + @Test + @Script + public void shouldMapDictionary() { + + String json = script.getVariable("json"); + assertThat(json).isNotNull(); + assertThatJson(json).isEqualTo(EXAMPLE_JSON); + } + + @Test + @Script + public void shouldMapPrimitives() { + SpinJsonNode json = script.getVariable("stringVar"); + + assertThat(json.isString()).isTrue(); + assertThat(json.stringValue()).isEqualTo("a String"); + + json = script.getVariable("booleanVar"); + + assertThat(json.isBoolean()).isTrue(); + assertThat(json.boolValue()).isFalse(); + + json = script.getVariable("integerVar"); + + assertThat(json.isNumber()).isTrue(); + assertThat(json.numberValue().intValue()).isEqualTo(42); + + SpinJsonNode jsonList = script.getVariable("listVar"); + + assertThat(jsonList.isArray()).isTrue(); + SpinList elements = jsonList.elements(); + assertThat(elements.get(0).stringValue()).isEqualTo("Waldo"); + assertThat(elements.get(1).stringValue()).isEqualTo("Hugo"); + assertThat(elements.get(2).stringValue()).isEqualTo("Kermit"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0324af90408d0372fba17860896c4f7b7239998e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyScriptTest.java @@ -0,0 +1,330 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import org.camunda.spin.Spin; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class JsonTreeReadPropertyScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadProperty() { + SpinJsonNode property = script.getVariable("property"); + String value = script.getVariable("value"); + + assertThat(property).isNotNull(); + assertThat(value).isEqualTo("order1"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldCheckStringValue() { + Boolean value1 = script.getVariable("value1"); + Boolean value2 = script.getVariable("value2"); + Boolean value3 = script.getVariable("value3"); + Boolean value4 = script.getVariable("value4"); + Boolean value5 = script.getVariable("value5"); + + assertThat(value1).isTrue(); + assertThat(value2).isFalse(); + assertThat(value3).isFalse(); + assertThat(value4).isFalse(); + assertThat(value5).isFalse(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldCheckNumberValue() { + Boolean value1 = script.getVariable("value1"); + Boolean value2 = script.getVariable("value2"); + Boolean value3 = script.getVariable("value3"); + Boolean value4 = script.getVariable("value4"); + Boolean value5 = script.getVariable("value5"); + + assertThat(value1).isFalse(); + assertThat(value2).isTrue(); + assertThat(value3).isFalse(); + assertThat(value4).isFalse(); + assertThat(value5).isFalse(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldCheckBooleanValue() { + Boolean value1 = script.getVariable("value1"); + Boolean value2 = script.getVariable("value2"); + Boolean value3 = script.getVariable("value3"); + Boolean value4 = script.getVariable("value4"); + Boolean value5 = script.getVariable("value5"); + + assertThat(value1).isFalse(); + assertThat(value2).isFalse(); + assertThat(value3).isFalse(); + assertThat(value4).isFalse(); + assertThat(value5).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldCheckArrayValue() { + Boolean value1 = script.getVariable("value1"); + Boolean value2 = script.getVariable("value2"); + Boolean value3 = script.getVariable("value3"); + Boolean value4 = script.getVariable("value4"); + Boolean value5 = script.getVariable("value5"); + + assertThat(value1).isFalse(); + assertThat(value2).isFalse(); + assertThat(value3).isTrue(); + assertThat(value4).isFalse(); + assertThat(value5).isFalse(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldCheckValue() { + Object orderValue = script.getVariable("value1"); + Object dueUntilValue = script.getVariable("value2"); + + assertThat(orderValue) + .isInstanceOf(String.class) + .isEqualTo("order1"); + + assertThat(dueUntilValue) + .isInstanceOf(Number.class); + + assertThat(((Number) dueUntilValue).longValue()) + .isEqualTo(20150112L); + } + + /** + * One for array + * @throws Throwable + */ + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToCheckObject() throws Throwable{ + failingWithException(); + } + + /** + * One for child node + * @throws Throwable + */ + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToCheckObject2() throws Throwable{ + failingWithException(); + } + + /** + * One for not existent property + * @throws Throwable + */ + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadProperty() throws Throwable{ + failingWithException(); + } + + /** + * One for property argument equals null + * @throws Throwable + */ + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadProperty2() throws Throwable{ + failingWithException(); + } + + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadTextValue() { + String value1 = script.getVariable("value1"); + String value2 = script.getVariable("value2"); + String value3 = script.getVariable("value3"); + + assertThat(value1).isEqualTo("order1"); + assertThat(value2).isEqualTo("Kermit"); + assertThat(value3).isEqualTo("camundaBPM"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadNumberValue() { + Number value1 = script.getVariable("value1"); + Number value2 = script.getVariable("value2"); + Number value3 = script.getVariable("value3"); + + assertThat(value1.longValue()).isEqualTo(20150112L); + + // python returns bigInt instead of Long + assertThat(value2.longValue()).isEqualTo(1234567890987654321L); + assertThat(value3).isEqualTo(1234567.13); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadNumberValue() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadBooleanValue() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadStringValue() throws Throwable { + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadBooleanValue() { + Boolean value1 = script.getVariable("value1"); + + assertThat(value1).isEqualTo(true); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadChildNode() { + SpinJsonNode childNode = script.getVariable("childNode"); + String value = script.getVariable("value"); + + assertThat(childNode).isNotNull(); + assertThat(value).isEqualTo("camundaBPM"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadChildNodeProperty() { + SpinJsonNode property1 = script.getVariable("property1"); + SpinJsonNode property2 = script.getVariable("property2"); + + Number value1 = script.getVariable("value1"); + String value2 = script.getVariable("value2"); + + assertThat(property1).isNotNull(); + assertThat(property2).isNotNull(); + + // Ruby casts this to long instead int + assertThat(value1.longValue()).isEqualTo(1234567L); + assertThat(value2).isEqualTo("dollar"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadObjectInArrayChildNode() { + SpinJsonNode property1 = script.getVariable("property1"); + SpinJsonNode property2 = script.getVariable("property2"); + + String value1 = script.getVariable("value1"); + String value2 = script.getVariable("value2"); + + assertThat(property1).isNotNull(); + assertThat(property2).isNotNull(); + + assertThat(value1).isEqualTo("Kermit"); + assertThat(value2).isEqualTo("Waldo"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReadListOfNodes() { + String value1 = script.getVariable("value1"); + String value2 = script.getVariable("value2"); + String value3 = script.getVariable("value3"); + + assertThat(value1).isEqualTo("order"); + assertThat(value2).isEqualTo("dueUntil"); + assertThat(value3).isEqualTo("orderDetails"); + } + + @Test(expected = SpinJsonDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailToReadObjectInNonArray() throws Throwable{ + failingWithException(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldBeSameAsJavaValue() { + + SpinJsonNode node = Spin.JSON(EXAMPLE_JSON); + SpinJsonNode childNode = node.prop("orderDetails"); + + SpinJsonNode property1 = node.prop("order"); + SpinJsonNode property2 = childNode.prop("price"); + SpinJsonNode property3 = node.prop("active"); + + String javaVariable1 = property1.stringValue(); + Number javaVariable2 = property2.numberValue(); + Boolean javaVariable3 = property3.boolValue(); + + String scriptVariable1 = script.getVariable("stringValue"); + Number scriptVariable2 = script.getVariable("numberValue"); + Boolean scriptVariable3 = script.getVariable("boolValue"); + + assertThat(javaVariable1).isEqualTo(scriptVariable1); + assertThat(javaVariable2).isEqualTo(scriptVariable2); + assertThat(javaVariable3).isEqualTo(scriptVariable3); + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1bf5f85d5400b7c1b8a558eaf71490cbbbf9f2e7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeReadPropertyTest.java @@ -0,0 +1,446 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.json.SpinJsonDataFormatException; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.camunda.spin.spi.SpinDataFormatException; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Stefan Hentschel + */ +public class JsonTreeReadPropertyTest { + + protected SpinJsonNode jsonNode; + protected SpinJsonNode order; + protected SpinJsonNode dueUntil; + protected SpinJsonNode id; + protected SpinJsonNode customers; + protected SpinJsonNode orderDetails; + protected SpinJsonNode active; + protected SpinJsonNode nullValue; + + @Before + public void readJson() { + jsonNode = JSON(EXAMPLE_JSON); + order = jsonNode.prop("order"); + dueUntil = jsonNode.prop("dueUntil"); + id = jsonNode.prop("id"); + customers = jsonNode.prop("customers"); + orderDetails = jsonNode.prop("orderDetails"); + active = jsonNode.prop("active"); + nullValue = jsonNode.prop("nullValue"); + } + + @Test + public void checkForProperty() { + assertThat(jsonNode.hasProp("order")).isTrue(); + assertThat(order.hasProp("order")).isFalse(); + assertThat(dueUntil.hasProp("order")).isFalse(); + assertThat(id.hasProp("order")).isFalse(); + assertThat(customers.hasProp("order")).isFalse(); + assertThat(orderDetails.hasProp("price")).isTrue(); + assertThat(active.hasProp("order")).isFalse(); + assertThat(jsonNode.hasProp("nullValue")).isTrue(); + } + + @Test + public void shouldReadProperty() { + assertThat(jsonNode).isNotNull(); + + SpinJsonNode property = jsonNode.prop("order"); + assertThat(property).isNotNull(); + } + + @Test + public void shouldFailToReadNonProperty() { + try { + jsonNode.prop("nonExisting"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + + try { + order.prop("nonExisting"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + + try { + customers.prop("nonExisting"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + + try { + jsonNode.prop(null); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + order.prop("null"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + + try { + customers.prop("null"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void checkForObjectValue() { + assertThat(jsonNode.isObject()).isTrue(); + assertThat(order.isObject()).isFalse(); + assertThat(dueUntil.isObject()).isFalse(); + assertThat(id.isObject()).isFalse(); + assertThat(customers.isObject()).isFalse(); + assertThat(orderDetails.isObject()).isTrue(); + assertThat(active.isObject()).isFalse(); + } + + @Test + public void shouldReadObjectProperty() { + assertThat(jsonNode.prop("order")).isNotNull(); + assertThat(orderDetails.prop("article")).isNotNull(); + } + + @Test + public void shouldFailToReadNonObject() { + try { + jsonNode.prop("order").prop("nonExisting"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + + try { + orderDetails.prop("roundedPrice").prop("nonExisting"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void checkForStringValue() { + assertThat(jsonNode.isString()).isFalse(); + assertThat(order.isString()).isTrue(); + assertThat(dueUntil.isString()).isFalse(); + assertThat(id.isString()).isFalse(); + assertThat(customers.isString()).isFalse(); + assertThat(orderDetails.isString()).isFalse(); + assertThat(active.isString()).isFalse(); + } + + @Test + public void shouldReadStringValue() { + assertThat(order.stringValue()).isEqualTo("order1"); + assertThat(orderDetails.prop("article").stringValue()).isEqualTo("camundaBPM"); + assertThat(customers.elements().get(0).prop("name").stringValue()).isEqualTo("Kermit"); + } + + @Test + public void shouldFailToReadNonStringValue() { + try { + jsonNode.stringValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + dueUntil.stringValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + orderDetails.prop("currencies").stringValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void checkForNumberValue() { + assertThat(jsonNode.isNumber()).isFalse(); + assertThat(order.isNumber()).isFalse(); + assertThat(dueUntil.isNumber()).isTrue(); + assertThat(id.isNumber()).isTrue(); + assertThat(customers.isNumber()).isFalse(); + assertThat(orderDetails.isNumber()).isFalse(); + assertThat(active.isNumber()).isFalse(); + } + + @Test + public void shouldReadNumberValue() { + assertThat(dueUntil.numberValue()).isEqualTo(20150112); + assertThat(id.numberValue()).isEqualTo(1234567890987654321L); + } + + @Test + public void shouldFailToReadNonNumberValue() { + try { + jsonNode.numberValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + order.numberValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + customers.numberValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void checkForBooleanValue() { + assertThat(jsonNode.isBoolean()).isFalse(); + assertThat(order.isBoolean()).isFalse(); + assertThat(dueUntil.isBoolean()).isFalse(); + assertThat(id.isBoolean()).isFalse(); + assertThat(customers.isBoolean()).isFalse(); + assertThat(orderDetails.isBoolean()).isFalse(); + assertThat(active.isBoolean()).isTrue(); + } + + @Test + public void shouldReadBooleanValue() { + assertThat(active.boolValue()).isTrue(); + assertThat(orderDetails.prop("paid").boolValue()).isFalse(); + } + + @Test + public void shouldFailToReadNonBooleanValue() { + try { + jsonNode.boolValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + order.boolValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + customers.boolValue(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void checkForValue() { + assertThat(jsonNode.isValue()).isFalse(); + assertThat(order.isValue()).isTrue(); + assertThat(dueUntil.isValue()).isTrue(); + assertThat(id.isValue()).isTrue(); + assertThat(customers.isValue()).isFalse(); + assertThat(orderDetails.isValue()).isFalse(); + assertThat(active.isValue()).isTrue(); + } + + @Test + public void shouldReadValue() { + assertThat(order.value()) + .isInstanceOf(String.class) + .isEqualTo("order1"); + + assertThat(dueUntil.value()) + .isInstanceOf(Number.class) + .isEqualTo(20150112); + + assertThat(active.value()) + .isInstanceOf(Boolean.class) + .isEqualTo(true); + } + + @Test + public void shouldFailToReadNonValue() { + try { + jsonNode.value(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + customers.value(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + orderDetails.value(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void checkForArrayValue() { + assertThat(jsonNode.isArray()).isFalse(); + assertThat(order.isArray()).isFalse(); + assertThat(dueUntil.isArray()).isFalse(); + assertThat(id.isArray()).isFalse(); + assertThat(customers.isArray()).isTrue(); + assertThat(orderDetails.isArray()).isFalse(); + assertThat(active.isArray()).isFalse(); + } + + @Test + public void shouldReadArrayValue() { + SpinList customerElements = customers.elements(); + SpinList currenciesElements = orderDetails.prop("currencies").elements(); + + assertThat(customerElements).hasSize(3); + assertThat(currenciesElements).hasSize(2); + + assertThat(customerElements.get(0).prop("name").stringValue()).isEqualTo("Kermit"); + assertThat(currenciesElements.get(0).stringValue()).isEqualTo("euro"); + } + + @Test + public void shouldFailToReadNonArrayValue() { + try { + jsonNode.elements(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + order.elements(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + id.elements(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void checkForNullValue() { + assertThat(nullValue.isNull()).isTrue(); + assertThat(jsonNode.isNull()).isFalse(); + assertThat(order.isNull()).isFalse(); + assertThat(dueUntil.isNull()).isFalse(); + assertThat(id.isNull()).isFalse(); + assertThat(customers.isNull()).isFalse(); + assertThat(orderDetails.isNull()).isFalse(); + assertThat(active.isNull()).isFalse(); + } + + @Test + public void shouldReadNullValue() { + assertThat(nullValue.isValue()).isTrue(); + assertThat(nullValue.value()).isNull(); + } + + @Test + public void shouldReadFieldNames() { + assertThat(jsonNode.fieldNames()).contains("order", "dueUntil", "id", "customers", "orderDetails", "active"); + assertThat(customers.fieldNames()).isEmpty(); + assertThat(orderDetails.fieldNames()).contains("article", "price", "roundedPrice", "currencies", "paid"); + } + + @Test + public void shouldFailToReadNonFieldNames() { + try { + order.fieldNames(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + dueUntil.fieldNames(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinJsonDataFormatException e) { + // expected + } + + try { + active.fieldNames(); + fail("Expected SpinJsonDataFormatException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + + /** + * Tests an issue with Jackson 2.4.1 + * + * The test contains a negative float at character position 8000 which is important + * to provoke Jackson bug #146. + * See also the Jackson bug report. + */ + @Test + public void shouldNotFailWithJackson146Bug() { + // this should not fail + SpinJsonNode node = JSON(SpinIoUtil.fileAsString("org/camunda/spin/json/jackson146.json")); + + // file has 4000 characters in length a + // 20 characters per repeated JSON object + assertThat(node.prop("abcdef").elements()).hasSize(200); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..024a3fa13ff54ed505155e7f38427a25ea6b4efc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyScriptTest.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class JsonTreeRemovePropertyScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldRemovePropertyByName() { + Boolean value = script.getVariable("value"); + + assertThat(value).isFalse(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldRemovePropertyByList() { + Boolean value1 = script.getVariable("value1"); + Boolean value2 = script.getVariable("value2"); + + assertThat(value1).isFalse(); + assertThat(value2).isFalse(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailWhileRemovingPropertyByName() throws Throwable{ + failingWithException(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailWhileRemovingPropertyByList() throws Throwable{ + failingWithException(); + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d271eef96e57c5e0419e4cf8784272979b226d27 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeRemovePropertyTest.java @@ -0,0 +1,94 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Stefan Hentschel + */ +public class JsonTreeRemovePropertyTest { + + protected SpinJsonNode jsonNode; + protected String order; + protected String active; + + @Before + public void readJson() { + jsonNode = JSON(EXAMPLE_JSON); + order = "order"; + active = "active"; + } + + @Test + public void removePropertyByName() { + assertThat(jsonNode.hasProp(order)).isTrue(); + + jsonNode.deleteProp(order); + assertThat(jsonNode.hasProp(order)).isFalse(); + + } + + @Test + public void removePropertyByList() { + List names = new ArrayList(); + names.add(order); + names.add(active); + + assertThat(jsonNode.hasProp(names.get(0))).isTrue(); + assertThat(jsonNode.hasProp(names.get(1))).isTrue(); + + jsonNode.deleteProp(names); + + assertThat(jsonNode.hasProp(names.get(0))).isFalse(); + assertThat(jsonNode.hasProp(names.get(1))).isFalse(); + } + + @Test + public void failWhileRemovePropertyByName() { + try { + jsonNode.deleteProp("waldo"); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void failWhileRemovePropertyByList() { + List names = new ArrayList(); + names.add(active); + names.add("waldo"); + try { + jsonNode.deleteProp(names); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ba4d05eb5da77d63063d6a341ba518397a6a71bc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyScriptTest.java @@ -0,0 +1,259 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public abstract class JsonTreeSetPropertyScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetStringProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + String value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + assertThat(value).isEqualTo("42!"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceStringProperty() { + String oldValue = script.getVariable("oldValue"); + String newValue = script.getVariable("newValue"); + + assertThat(newValue).isNotEqualTo(oldValue); + assertThat(newValue).isEqualTo("new Order"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetIntegerProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Number value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + // Ruby casts Number to long + assertThat(value.intValue()).isEqualTo(42); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceIntegerProperty() { + String oldValue = script.getVariable("oldValue"); + Number newValue = script.getVariable("newValue"); + + assertThat(newValue).isNotEqualTo(oldValue); + // Ruby casts Number to long + assertThat(newValue.intValue()).isEqualTo(42); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetFloatProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Number value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + + // python returns Double, needs to cast to Float + assertThat(value.floatValue()).isEqualTo(42.00F); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceFloatProperty() { + String oldValue = script.getVariable("oldValue"); + Number newValue = script.getVariable("newValue"); + + assertThat(newValue).isNotEqualTo(oldValue); + // Python returns a double instead a float + assertThat(newValue.floatValue()).isEqualTo(42.00F); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetLongProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Number value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + + // python returns BigInt, needs to cast to Long + assertThat(value.floatValue()).isEqualTo(4200000000L); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceLongProperty() { + String oldValue = script.getVariable("oldValue"); + Number newValue = script.getVariable("newValue"); + + assertThat(newValue).isNotEqualTo(oldValue); + // python returns a BigInt, needs to cast it + assertThat(newValue.longValue()).isEqualTo(4200000000L); + } + + /** + * Please note: in jython there is a known issue that Boolean + * and boolean values are casted to long if a matching method + * is found first. See script source code for workaround. + */ + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetBooleanProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Boolean value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + assertThat(value).isFalse(); + } + + /** + * Please note: in jython there is a known issue that Boolean + * and boolean values are casted to long if a matching method + * is found first. See script source code for workaround. + */ + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceBooleanProperty() { + String oldValue = script.getVariable("oldValue"); + Boolean newValue = script.getVariable("newValue"); + + assertThat(newValue).isNotEqualTo(oldValue); + assertThat(newValue).isFalse(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetArrayProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + String value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + assertThat(propertyNode.isArray()).isTrue(); + assertThat(value).isEqualTo("test2"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceArrayProperty() { + SpinJsonNode oldValue = script.getVariable("oldValue"); + SpinJsonNode newValue = script.getVariable("newValue"); + + assertThat(oldValue.isString()).isTrue(); + assertThat(newValue).isNotEqualTo(oldValue); + assertThat(newValue.isArray()).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetObjectProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + String value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + assertThat(propertyNode.isObject()).isTrue(); + assertThat(value).isEqualTo("42!"); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceObjectProperty() { + + SpinJsonNode oldValue = script.getVariable("oldValue"); + SpinJsonNode newValue = script.getVariable("newValue"); + + assertThat(oldValue.isString()).isTrue(); + assertThat(newValue).isNotEqualTo(oldValue); + assertThat(newValue.isObject()).isTrue(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldSetNullProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Object value = script.getVariable("value"); + + assertThat(propertyNode).isNotNull(); + assertThat(propertyNode.isNull()).isTrue(); + assertThat(value).isNull(); + } + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldReplaceNullProperty() { + SpinJsonNode propertyNode = script.getVariable("propertyNode"); + Object newValue = script.getVariable("newValue"); + + assertThat(propertyNode).isNotNull(); + assertThat(propertyNode.isNull()).isTrue(); + assertThat(newValue).isNull(); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailWhileSettingObject() throws Throwable{ + Map variables = new HashMap(); + variables.put("date", new Date()); + failingWithException(variables); + } + + @Test(expected = SpinJsonPropertyException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_JSON_FILE_NAME) + public void shouldFailWhileSettingArray() throws Throwable{ + Map variables = new HashMap(); + variables.put("date", new Date()); + failingWithException(variables); + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..83ee5475bfd0832b4c08efe9ff488822f12b7cdf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/JsonTreeSetPropertyTest.java @@ -0,0 +1,449 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.JSON; +import static org.camunda.spin.json.JsonTestConstants.EXAMPLE_JSON; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.camunda.spin.json.SpinJsonNode; +import org.camunda.spin.json.SpinJsonPropertyException; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Stefan Hentschel + */ +public class JsonTreeSetPropertyTest { + + protected SpinJsonNode jsonNode; + protected SpinJsonNode order; + protected SpinJsonNode dueUntil; + protected SpinJsonNode id; + protected SpinJsonNode customers; + protected SpinJsonNode orderDetails; + protected SpinJsonNode active; + protected SpinJsonNode nullValue; + + @Before + public void readJson() { + jsonNode = JSON(EXAMPLE_JSON); + order = jsonNode.prop("order"); + dueUntil = jsonNode.prop("dueUntil"); + id = jsonNode.prop("id"); + customers = jsonNode.prop("customers"); + orderDetails = jsonNode.prop("orderDetails"); + active = jsonNode.prop("active"); + nullValue = jsonNode.prop("nullValue"); + } + + @Test + public void setStringProperty() { + String newComment = "42!"; + + jsonNode.prop("comment", newComment); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isString()).isTrue(); + assertThat(comment.stringValue()).isEqualTo(newComment); + } + + @Test + public void replaceStringProperty() { + String value = "new Order"; + String oldValue = order.stringValue(); + + assertThat(order.isString()).isTrue(); + assertThat(customers.isArray()).isTrue(); + + // set new values + jsonNode.prop("order", value); + jsonNode.prop("customers", value); + SpinJsonNode newValue1 = jsonNode.prop("order"); + SpinJsonNode newValue2 = jsonNode.prop("customers"); + + assertThat(newValue1.stringValue()).isNotEqualTo(oldValue); + assertThat(newValue1.stringValue()).isEqualTo(value); + + assertThat(newValue2.isArray()).isFalse(); + assertThat(newValue2.stringValue()).isEqualTo(value); + } + + @Test + public void setIntegerProperty() { + Integer newComment = 42; + jsonNode.prop("comment", newComment); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isNumber()).isTrue(); + assertThat(comment.numberValue()).isEqualTo(newComment); + } + + @Test + public void replaceIntegerProperty() { + Integer value = 42; + Integer oldValue = dueUntil.numberValue().intValue(); + + assertThat(customers.isArray()).isTrue(); + assertThat(dueUntil.isNumber()); + + // set new values + jsonNode.prop("dueUntil", value); + jsonNode.prop("customers", value); + SpinJsonNode newValue1 = jsonNode.prop("dueUntil"); + SpinJsonNode newValue2 = jsonNode.prop("customers"); + + assertThat(newValue1.numberValue()).isNotEqualTo(oldValue); + assertThat(newValue1.numberValue()).isEqualTo(value); + + assertThat(newValue2.isArray()).isFalse(); + assertThat(newValue2.isNumber()).isTrue(); + assertThat(newValue2.numberValue()).isEqualTo(value); + } + + @Test + public void setFloatProperty() { + Float floatValue = 42.00F; + jsonNode.prop("comment", floatValue); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isNumber()).isTrue(); + assertThat(comment.numberValue()).isEqualTo(floatValue); + } + + @Test + public void replaceFloatProperty() { + SpinJsonNode price = orderDetails.prop("price"); + Float value = 42.00F; + + Float oldValue = price.numberValue().floatValue(); + + assertThat(customers.isArray()).isTrue(); + assertThat(price.isNumber()); + + // set new values + orderDetails.prop("price", value); + jsonNode.prop("customers", value); + SpinJsonNode newValue1 = orderDetails.prop("price"); + SpinJsonNode newValue2 = jsonNode.prop("customers"); + + assertThat(newValue1.numberValue()).isNotEqualTo(oldValue); + assertThat(newValue1.numberValue()).isEqualTo(value); + + assertThat(newValue2.isArray()).isFalse(); + assertThat(newValue2.isNumber()).isTrue(); + assertThat(newValue2.numberValue()).isEqualTo(value); + } + + @Test + public void setLongProperty() { + Long longValue = 4200000000L; + jsonNode.prop("comment", longValue); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isNumber()).isTrue(); + assertThat(comment.numberValue().longValue()).isEqualTo(longValue); + } + + @Test + public void replaceLongProperty() { + Long value = 4200000000L; + + Long oldValue = id.numberValue().longValue(); + + assertThat(customers.isArray()).isTrue(); + assertThat(id.isNumber()); + + // set new values + jsonNode.prop("id", value); + jsonNode.prop("customers", value); + SpinJsonNode newValue1 = jsonNode.prop("id"); + SpinJsonNode newValue2 = jsonNode.prop("customers"); + + assertThat(newValue1.numberValue()).isNotEqualTo(oldValue); + assertThat(newValue1.numberValue()).isEqualTo(value); + + assertThat(newValue2.isArray()).isFalse(); + assertThat(newValue2.isNumber()).isTrue(); + assertThat(newValue2.numberValue()).isEqualTo(value); + } + + @Test + public void setBooleanProperty() { + jsonNode.prop("comment", true); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isBoolean()).isTrue(); + assertThat(comment.boolValue()).isTrue(); + } + + @Test + public void replaceBooleanProperty() { + SpinJsonNode active = jsonNode.prop("active"); + + Boolean oldValue = active.boolValue(); + Boolean value = !oldValue; + + assertThat(customers.isArray()).isTrue(); + assertThat(active.isBoolean()); + + // set new values + jsonNode.prop("active", value); + jsonNode.prop("customers", value); + SpinJsonNode newValue1 = jsonNode.prop("active"); + SpinJsonNode newValue2 = jsonNode.prop("customers"); + + assertThat(newValue1.boolValue()).isNotEqualTo(oldValue); + assertThat(newValue1.boolValue()).isEqualTo(value); + + assertThat(newValue2.isArray()).isFalse(); + assertThat(newValue2.isBoolean()).isTrue(); + assertThat(newValue2.boolValue()).isEqualTo(value); + } + + @Test + public void setArrayProperty() { + ArrayList list1 = new ArrayList(); + ArrayList list2 = new ArrayList(); + Map map = new HashMap(); + + map.put("id1", "object1"); + map.put("id2", 1337); + + list2.add("n"); + list2.add(32); + + list1.add("test"); + list1.add(42); + list1.add(list2); + list1.add(map); + + + jsonNode.prop("comment", list1); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isArray()).isTrue(); + assertThat(comment.elements()).hasSize(4); + assertThat(comment.elements().get(0).stringValue()).isEqualTo("test"); + assertThat(comment.elements().get(2).elements().get(1).numberValue()).isEqualTo(32); + assertThat(comment.elements().get(3).isObject()).isTrue(); + assertThat(comment.elements().get(3).hasProp("id2")).isTrue(); + } + + @Test + public void replaceArrayProperty() { + + assertThat(customers.isArray()).isTrue(); + assertThat(customers.elements()).hasSize(3); + assertThat(active.isBoolean()).isTrue(); + assertThat(active.boolValue()).isTrue(); + + // Build new values + ArrayList list1 = new ArrayList(); + ArrayList list2 = new ArrayList(); + Map map = new HashMap(); + + map.put("id1", "object1"); + map.put("id2", 1337); + + list2.add("n"); + list2.add(32); + + list1.add("test"); + list1.add(42); + list1.add("filler"); + list1.add(list2); + list1.add(map); + + jsonNode.prop("customers", list1); + jsonNode.prop("active", list1); + SpinJsonNode customers = jsonNode.prop("customers"); + SpinJsonNode active = jsonNode.prop("active"); + + assertThat(customers.isArray()).isTrue(); + assertThat(customers.elements()).hasSize(5); + assertThat(customers.elements().get(0).stringValue()).isEqualTo("test"); + assertThat(customers.elements().get(3).elements().get(1).numberValue()).isEqualTo(32); + assertThat(customers.elements().get(4).isObject()).isTrue(); + assertThat(customers.elements().get(4).hasProp("id2")).isTrue(); + + assertThat(active.isArray()).isTrue(); + assertThat(active.elements()).hasSize(5); + assertThat(active.elements().get(0).stringValue()).isEqualTo("test"); + assertThat(active.elements().get(3).elements().get(1).numberValue()).isEqualTo(32); + assertThat(active.elements().get(4).isObject()).isTrue(); + assertThat(active.elements().get(4).hasProp("id2")).isTrue(); + } + + @Test + public void setObjectProperty() { + Map map = new HashMap(); + map.put("id1", "object1"); + map.put("id2", 1337); + + jsonNode.prop("comment", map); + SpinJsonNode comment = jsonNode.prop("comment"); + + assertThat(comment.isObject()).isTrue(); + assertThat(comment.hasProp("id1")).isTrue(); + assertThat(comment.prop("id2").isNumber()).isTrue(); + assertThat(comment.prop("id2").numberValue()).isEqualTo(1337); + } + + @Test + public void replaceObjectProperty() { + SpinJsonNode childNode = orderDetails; + String oldValue = childNode.prop("article").stringValue(); + + assertThat(oldValue).isEqualTo("camundaBPM"); + + Map map = new HashMap(); + map.put("id1", "object1"); + map.put("id2", 1337); + + jsonNode.prop("orderDetails", map); + SpinJsonNode comment = jsonNode.prop("orderDetails"); + + assertThat(comment.isObject()).isTrue(); + assertThat(comment.hasProp("id1")).isTrue(); + assertThat(comment.prop("id2").isNumber()).isTrue(); + assertThat(comment.prop("id2").numberValue()).isEqualTo(1337); + } + + @Test + public void setPropertyWithJSON() { + String json = "{\"agent\":\"Smith\"}"; + + jsonNode.prop("name", JSON(json)); + SpinJsonNode name = jsonNode.prop("name"); + assertThat(name.isObject()).isTrue(); + assertThat(name.prop("agent").stringValue()).isEqualTo("Smith"); + } + + @Test + public void replacePropertyWithJSON() { + String json = "{\"agent\":\"Smith\"}"; + + assertThat(active.isBoolean()).isTrue(); + + jsonNode.prop("active", JSON(json)); + SpinJsonNode active = jsonNode.prop("active"); + assertThat(active.isBoolean()).isFalse(); + assertThat(active.isObject()).isTrue(); + assertThat(active.prop("agent").stringValue()).isEqualTo("Smith"); + } + + @Test + public void failWhileSettingObjectWithMap() { + Date date = new Date(); + Map map = new HashMap(); + map.put("date", date); + + try { + jsonNode.prop("test", map); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void failWhileSettingObjectWithList() { + Date date = new Date(); + ArrayList list = new ArrayList(); + list.add(date); + + try { + jsonNode.prop("test", list); + fail("Expected SpinJsonTreePropertyException"); + } catch(SpinJsonPropertyException e) { + // expected + } + } + + @Test + public void replaceNullProperty() { + jsonNode.prop("order", (String) null); + jsonNode.prop("id", (String) null); + jsonNode.prop("nullValue", (String) null); + + assertThat(jsonNode.prop("order").isNull()).isTrue(); + assertThat(jsonNode.prop("order").value()).isNull(); + + assertThat(jsonNode.prop("id").isNull()).isTrue(); + assertThat(jsonNode.prop("id").value()).isNull(); + + assertThat(jsonNode.prop("nullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("nullValue").value()).isNull(); + } + + @Test + public void setNullStringProperty() { + + jsonNode.prop("newNullValue", (String) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } + + @Test + public void setNullMapProperty() { + jsonNode.prop("newNullValue", (Map) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } + + @Test + public void setNullListProperty() { + jsonNode.prop("newNullValue", (List) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } + + @Test + public void setNullBooleanProperty() { + jsonNode.prop("newNullValue", (Boolean) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } + + @Test + public void setNullNumberProperty() { + jsonNode.prop("newNullValue", (Number) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } + + @Test + public void setNullSpinJsonNodeProperty() { + jsonNode.prop("newNullValue", (SpinJsonNode) null); + + assertThat(jsonNode.prop("newNullValue").isNull()).isTrue(); + assertThat(jsonNode.prop("newNullValue").value()).isNull(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/type/JsonJacksonTreeTypeDetectionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/type/JsonJacksonTreeTypeDetectionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..009a9956b23fd44661e378f4650e35780a5be4b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/json/tree/type/JsonJacksonTreeTypeDetectionTest.java @@ -0,0 +1,225 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.json.tree.type; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.DataFormats.json; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormat; +import org.camunda.spin.impl.json.jackson.format.MapJacksonJsonTypeDetector; +import org.camunda.spin.impl.json.jackson.format.SetJacksonJsonTypeDetector; +import org.camunda.spin.json.mapping.Customer; +import org.camunda.spin.json.mapping.RegularCustomer; +import org.junit.Before; +import org.junit.Test; + +public class JsonJacksonTreeTypeDetectionTest { + + public JacksonJsonDataFormat dataFormatWithSetTypeDetector = + new JacksonJsonDataFormat(DataFormats.JSON_DATAFORMAT_NAME); + + public JacksonJsonDataFormat dataFormatWithMapTypeDetector = + new JacksonJsonDataFormat(DataFormats.JSON_DATAFORMAT_NAME); + + @Before + public void configure() { + dataFormatWithSetTypeDetector.addTypeDetector(SetJacksonJsonTypeDetector.INSTANCE); + dataFormatWithMapTypeDetector.addTypeDetector(MapJacksonJsonTypeDetector.INSTANCE); + } + + @Test + public void shouldDetectTypeFromObject() { + RegularCustomer customer = new RegularCustomer(); + String canonicalTypeString = json().getMapper().getCanonicalTypeName(customer); + assertThat(canonicalTypeString).isEqualTo("org.camunda.spin.json.mapping.RegularCustomer"); + } + + @Test + public void shouldDetectListType() { + List customers = new ArrayList<>(); + customers.add(new RegularCustomer()); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.ArrayList"); + } + + @Test + public void shouldDetectListTypeFromEmptyList() { + List customers = new ArrayList<>(); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.ArrayList"); + } + + @Test + public void shouldDetectSetType() { + Set customers = new HashSet<>(); + customers.add(new RegularCustomer()); + + String canonicalTypeString = dataFormatWithSetTypeDetector.getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet"); + } + + @Test + public void shouldDetectSetTypeFromEmptySet() { + Set customers = new HashSet<>(); + + String canonicalTypeString = dataFormatWithSetTypeDetector.getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet"); + } + + @Test + public void shouldDetectMapType() { + Map customers = new HashMap<>(); + customers.put("foo", new RegularCustomer()); + + String canonicalTypeString = dataFormatWithMapTypeDetector.getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.Map"); + } + + @Test + public void shouldDetectMapTypeFromEmptyMap() { + Map customers = new HashMap<>(); + + String canonicalTypeString = dataFormatWithMapTypeDetector.getCanonicalTypeName(customers); + assertThat(canonicalTypeString).isEqualTo("java.util.HashMap"); + } + + @Test + public void shouldHandleNullParameter() { + try { + json().getMapper().getCanonicalTypeName(null); + fail("Expected IllegalArgumentException"); + } catch (IllegalArgumentException e) { + // happy path + } + } + + @Test + public void shouldHandleListOfLists() { + List> nestedCustomers = new ArrayList<>(); + List customers = new ArrayList<>(); + customers.add(new RegularCustomer()); + nestedCustomers.add(customers); + + String canonicalTypeString = json().getMapper().getCanonicalTypeName(nestedCustomers); + assertThat(canonicalTypeString).isEqualTo("java.util.ArrayList>"); + } + + @Test + public void shouldHandleSetOfSets() { + Set> nestedCustomers = new HashSet<>(); + Set customers = new HashSet<>(); + customers.add(new RegularCustomer()); + nestedCustomers.add(customers); + + String canonicalTypeString = + dataFormatWithSetTypeDetector.getCanonicalTypeName(nestedCustomers); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet>"); + } + + @Test + public void shouldHandleSetOfLists() { + Set> nestedCustomers = new HashSet<>(); + List customers = new ArrayList<>(); + customers.add(new RegularCustomer()); + nestedCustomers.add(customers); + + String canonicalTypeString = + dataFormatWithSetTypeDetector.getCanonicalTypeName(nestedCustomers); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet>"); + } + + @Test + public void shouldHandleMapOfMaps() { + Map> nestedCustomers = new HashMap<>(); + Map customers = new HashMap<>(); + customers.put(42, new RegularCustomer()); + nestedCustomers.put("foo", customers); + + String canonicalTypeString = + dataFormatWithMapTypeDetector.getCanonicalTypeName(nestedCustomers); + assertThat(canonicalTypeString).isEqualTo("java.util.Map>"); + } + + @Test + public void shouldHandleMapWithNullAndStringValue() { + Map map = new HashMap<>(); + map.put("bar", null); + map.put("foo", "baz"); + + String canonicalTypeString = dataFormatWithMapTypeDetector.getCanonicalTypeName(map); + assertThat(canonicalTypeString).isEqualTo("java.util.Map"); + } + + @Test + public void shouldHandleMapWithNullAndNullValue() { + Map map = new HashMap<>(); + map.put("foo", null); + map.put("bar", null); + + String canonicalTypeString = dataFormatWithMapTypeDetector.getCanonicalTypeName(map); + assertThat(canonicalTypeString).isEqualTo("java.util.Map"); + } + + @Test + public void shouldHandleMapWithSingleNullValue() { + Map map = new HashMap<>(); + map.put("bar", null); + + String canonicalTypeString = dataFormatWithMapTypeDetector.getCanonicalTypeName(map); + assertThat(canonicalTypeString).isEqualTo("java.util.Map"); + } + + @Test + public void shouldHandleSetWithSingleStringValue() { + Set set = new HashSet<>(); + set.add("foo"); + + String canonicalTypeString = dataFormatWithSetTypeDetector.getCanonicalTypeName(set); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet"); + } + + @Test + public void shouldHandleSetWithNullAndStringValue() { + Set set = new HashSet<>(); + set.add(null); + set.add("foo"); + + String canonicalTypeString = dataFormatWithSetTypeDetector.getCanonicalTypeName(set); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet"); + } + + @Test + public void shouldHandleSetWithNullValue() { + Set set = new HashSet<>(); + set.add(null); + + String canonicalTypeString = dataFormatWithSetTypeDetector.getCanonicalTypeName(set); + assertThat(canonicalTypeString).isEqualTo("java.util.HashSet"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c82d2d4605db0452fd05e758271d16501c88d9cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeCreateScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeCreatePythonTest extends JsonTreeCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f0cc9e0bd63be12566b7b200aab850acedf7ba9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeEditListPropertyScriptTest; + +/** + * @author Stefan Hentschel + * + */ +@ScriptEngine("python") +public class JsonTreeEditListPropertyPythonTest extends JsonTreeEditListPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..30fb562287893f4e2b06d346f3c7d868db15f8d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeJsonPathScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeJsonPathPythonTest extends JsonTreeJsonPathScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..792fc4ab939b72ddde7ea168cf1d745a71cc9081 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaPythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapJsonToJavaScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("python") +public class JsonTreeMapJsonToJavaPythonTest extends JsonTreeMapJsonToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c596d9198a0e177402ce728c7c5af1de3edb1ffd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapObjectToJsonScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeMapObjectToJsonPythonTest extends JsonTreeMapObjectToJsonScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..41128c647014e54858e7783f3775014a73806357 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeReadPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeReadPropertyPythonTest extends JsonTreeReadPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5dbc4c8bbf5ca12a72a33205914a29acfeade8f1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeRemovePropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeRemovePropertyPythonTest extends JsonTreeRemovePropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..469891a03930e8d57c2ba4a7e09a932d1224dce3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeSetPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("python") +public class JsonTreeSetPropertyPythonTest extends JsonTreeSetPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..84663337cf618d12f7155f4fbeeeed130412b669 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeCreateScriptTest; + +/** + * @author Daniel Meyer + * + */ +@ScriptEngine("ruby") +public class JsonTreeCreateRubyTest extends JsonTreeCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..87a2dbe19488c15470b11078a4fdfc0c04735e28 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeEditListPropertyScriptTest; + +/** + * @author Stefan Hentschel + * + */ +@ScriptEngine("ruby") +public class JsonTreeEditListPropertyRubyTest extends JsonTreeEditListPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ac1f54bd49e82230628f5d15c29f8de358c4c9b2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeJsonPathScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("ruby") +public class JsonTreeJsonPathRubyTest extends JsonTreeJsonPathScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..f50c1bd118a35f0b6d75e7072dff39f94c37d154 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapJsonToJavaScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("ruby") +public class JsonTreeMapJsonToJavaRubyTest extends JsonTreeMapJsonToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..663f534bcaa8b3fe73090791b2e3535129f76125 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeMapObjectToJsonScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("ruby") +public class JsonTreeMapObjectToJsonRubyTest extends JsonTreeMapObjectToJsonScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..afdd4f84e578cf2027c1691195d86ce76f104158 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeReadPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("ruby") +public class JsonTreeReadPropertyRubyTest extends JsonTreeReadPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c209596b16f02045c8242cd64ab8fadd0a571817 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeRemovePropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("ruby") +public class JsonTreeRemovePropertyRubyTest extends JsonTreeRemovePropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6107c8e2a452951b88e117dbb915b593b634b589 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/java/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.json.tree; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.json.tree.JsonTreeSetPropertyScriptTest; + +/** + * @author Thorben Lindhauer + * + */ +@ScriptEngine("ruby") +public class JsonTreeSetPropertyRubyTest extends JsonTreeSetPropertyScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldBeIdempotent.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldBeIdempotent.groovy new file mode 100644 index 0000000000000000000000000000000000000000..07a0af5f2a7476a6a106bec6f16f66cc13a52564 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldBeIdempotent.groovy @@ -0,0 +1,3 @@ +wrappedJson = S(input, "application/json") + +json = S(wrappedJson); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForReader.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForReader.groovy new file mode 100644 index 0000000000000000000000000000000000000000..97ab0b1e6f24b229e8646653726ea4e871bdf2f9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForReader.groovy @@ -0,0 +1,5 @@ +json1 = S(input1, org.camunda.spin.DataFormats.json()) + +json2 = S(input2, "application/json") + +json3 = S(input3) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForString.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForString.groovy new file mode 100644 index 0000000000000000000000000000000000000000..db0c95822fc15b96d60e4650b4c7a289966cd3fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeCreateGroovyTest.shouldCreateForString.groovy @@ -0,0 +1,5 @@ +json1 = S(input, org.camunda.spin.DataFormats.json()) + +json2 = S(input, "application/json") + +json3 = S(input) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldAppendNodeToArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldAppendNodeToArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..cead69afd30ffee7a05f86abc1bd65536f540c93 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldAppendNodeToArray.groovy @@ -0,0 +1,10 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); +oldSize = currencies.elements().size(); + +currencies.append("Testcustomer"); + +newSize = currencies.elements().size() +value = currencies.elements().get(oldSize).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendNullNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendNullNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..b45e144fc88170a4c2940351d1440e923d893bb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendNullNode.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); +customers.append(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendToNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendToNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ae8c408a81128ed8d46857e727ed096d898bfc86 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendToNonArray.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.append("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendWrongNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendWrongNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..6698ebbf2cdc97b113196c1dd05588a78468ed0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailAppendWrongNode.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); +customers.append(new Date()); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterNonExistentSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterNonExistentSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..4cbe5e998289567032a608fac558084e998ed007 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterNonExistentSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterOnNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterOnNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..bb26bbee7c222d2e09fae034b4f64d08107d57af --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterOnNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.insertAfter("euro", "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWithNullAsSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWithNullAsSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..2b8145343e177d578198cdc68c01b90fcbb6ddf5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWithNullAsSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWrongSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWrongSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..75d31f494b4c1f4df37b682b84ac75946a78c7da --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAfterWrongSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d885549a67469b0ab4cfb86ae84a6665fc429100 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.insertAt(1, "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithIndexOutOfBounds.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithIndexOutOfBounds.groovy new file mode 100644 index 0000000000000000000000000000000000000000..88b247dacf904ab8ec51234dc6512935ec0a11f8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithIndexOutOfBounds.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.groovy new file mode 100644 index 0000000000000000000000000000000000000000..a9693566973fc683d17488c2fd726a87b6c9554c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(-6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNullObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNullObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ad693ea9eb42effb2f3dd72790afcb7f38a5f993 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithNullObject.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); +customers.insertAt(1, null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithWrongObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithWrongObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..3dc9fa78a6955bcb29a20fcb6a5f72ed9e551c6e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertAtWithWrongObject.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); +customers.insertAt(1, new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeNonExistentSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeNonExistentSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..29566802e7809dba0d87704898b5aef2c55a66a1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeNonExistentSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeOnNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeOnNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..398ccac15f6b3fb7fbfbbbdf118a9843b4f5762b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeOnNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.insertBefore("euro", "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWithNullAsSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWithNullAsSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d96318e661b43916a77961de0dd72a28246c7a53 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWithNullAsSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWrongSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWrongSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1947c3a99c5f2e991dde788821b2e76091dc32e9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertBeforeWrongSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectAfterSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectAfterSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e635041f7005dd89d9388763702042cbffee7d70 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectAfterSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectBeforeSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectBeforeSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0cb213d149c4b83098705fc369827c6f737c2250 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertNullObjectBeforeSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectAfterSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectAfterSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0335a3ae4fc0b6b221ac1d0b95cbeed2e400dcea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectAfterSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectBeforeSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectBeforeSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..3a656104496cf19f5839bad7798734773b789ba8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailInsertWrongObjectBeforeSearchObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..11224987f7f1808cc9bbcc8f443e419bc17f8d82 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonArray.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonExistentValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonExistentValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..22500b2e79f7d68b4689fc916551ba58126ee4c6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfNonExistentValue.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.prop("customers").indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfWithoutSearchNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfWithoutSearchNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..2537d811bee2ff6858f2cf7a670f798a76d6fbc2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadIndexOfWithoutSearchNode.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.prop("customers").indexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..6962c400ba306e7cef0b37a15f00dad600ce4e73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonArray.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonExistentValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonExistentValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..147c6b89d86bbc0702656fcd1ba6570f3dc16a2c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfNonExistentValue.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.prop("customers").lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfWithoutSearchNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfWithoutSearchNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..a86740fd571bc880b628be1cb435c532fe649a02 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailReadLastIndexOfWithoutSearchNode.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +node.prop("customers").lastIndexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..befcecf3f89b797e99b4458847e35d24f51296f0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.removeAt(1); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithIndexOutOfBounds.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithIndexOutOfBounds.groovy new file mode 100644 index 0000000000000000000000000000000000000000..5b7744fba521796622328e4df711007cbb41abcd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithIndexOutOfBounds.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.groovy new file mode 100644 index 0000000000000000000000000000000000000000..6f0023ffad7d8acafd9b1a501796a54be4a24e66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(-6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1a8eba4adfc0e0e00c078098cc8ee8a629aa66c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonExistentObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonExistentObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0d2109cb3a4997a975bd8e873ec96b2807d91740 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNonExistentObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeLast("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNullObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNullObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..576d263de5b7eb6c222de6f49975f65807c35dd3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastNullObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); + +customers.removeLast(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastWrongObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastWrongObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e759d63421aebab5a56f6b99eef29ede69737c92 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveLastWrongObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); + +customers.removeLast(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1a8eba4adfc0e0e00c078098cc8ee8a629aa66c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonArray.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonExistentObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonExistentObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..859e57d9ad74dc2ad5e6ddd449803ab557851381 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNonExistentObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +currencies.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNullObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNullObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..80761749fa15358ed6e464b6473787e7f1a37dee --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveNullObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); + +customers.remove(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveWrongObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveWrongObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..8ca4cf2770bf3ce904d50c81c4c884ad637c2c5b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldFailRemoveWrongObject.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +customers = node.prop("customers"); + +customers.remove(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAfterSearchObjectOnEnding.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAfterSearchObjectOnEnding.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e0e3ca3d405ff89f231454cd44d997d425ea1173 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAfterSearchObjectOnEnding.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertAfter(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(2).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithIndex.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithIndex.groovy new file mode 100644 index 0000000000000000000000000000000000000000..970bc41ad1b4926b41fa43e69e29827236912552 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithIndex.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(1, "test1"); + +newSize = currencies.elements().size() +newPosition = currencies.indexOf("dollar") +value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithNegativeIndex.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithNegativeIndex.groovy new file mode 100644 index 0000000000000000000000000000000000000000..71fe0717865c282e0285d8f460c61ab6fee1e4a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertAtWithNegativeIndex.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(-1, "test1"); + +newSize = currencies.elements().size() +newPosition = currencies.indexOf("dollar") +value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0f79d1f2e46513a8fd0cde3a1aa8e6b9fca32ab7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObject.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(1).stringValue(); +oldValueOnNewPosition = currencies.elements().get(2).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObjectOnBeginning.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObjectOnBeginning.groovy new file mode 100644 index 0000000000000000000000000000000000000000..8085211040345c84d92470ba0baf8875674f4492 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldInsertBeforeSearchObjectOnBeginning.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(0).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadIndexOf.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadIndexOf.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1a8908e582409ec1dd640091077604b583a976c2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadIndexOf.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.indexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadLastIndexOf.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadLastIndexOf.groovy new file mode 100644 index 0000000000000000000000000000000000000000..a147fd30fc9ea7ea9cd63656103aa4023626781d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldReadLastIndexOf.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.lastIndexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithIndex.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithIndex.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d2354d8daa022386b6078e2e137b27639dcf1dec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithIndex.groovy @@ -0,0 +1,11 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(1); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithNegativeIndex.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithNegativeIndex.groovy new file mode 100644 index 0000000000000000000000000000000000000000..be918634944676ade092b685a3f9b3b940acdf4f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveAtWithNegativeIndex.groovy @@ -0,0 +1,11 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(-2); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveLast.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveLast.groovy new file mode 100644 index 0000000000000000000000000000000000000000..f434975bba4b6aa6a9f2a3afb2f93a5839594ac9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveLast.groovy @@ -0,0 +1,11 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +oldSize = node.elements().size(); +oldValue = node.elements().get(oldSize - 1).stringValue(); + +node.removeLast("test"); + +newSize = node.elements().size(); +newValue = node.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..f3dab17b6cf72434f2cee001e0330bfd6235ebb9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeEditListPropertyGroovyTest.shouldRemoveObject.groovy @@ -0,0 +1,12 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.remove("euro"); + +newValue = currencies.elements().get(0).stringValue(); +newSize = currencies.elements().size(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailAccessNonExistentProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailAccessNonExistentProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1434ca6d6fe3ac48568a04d9299ff4892adebe21 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailAccessNonExistentProperty.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order.task').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingBoolean.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingBoolean.groovy new file mode 100644 index 0000000000000000000000000000000000000000..40fd5e50762ee0c90324c5b58e69b97f683abe0d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingBoolean.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingElementList.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingElementList.groovy new file mode 100644 index 0000000000000000000000000000000000000000..5367c44054eab24bcf467d472caf6584b43a307e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingElementList.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..2e8c932b87643ff68e2302a257718ad5ed2e80cc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.....').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingNumber.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingNumber.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d87977804922a1cec2e5fdb6b55548e24d09c039 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingNumber.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.active').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingString.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingString.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0108f0dd272e8c508bbf454ea9702b0e960c4533 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldFailReadingString.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.id').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetBooleanFromJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetBooleanFromJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1185728621a91d3c5645efbf695096002408578f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetBooleanFromJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +booleanValue = jsonNode.jsonPath('$.active').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementFromJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementFromJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..aa8fd22b9b4c31c94d850da8afaa687a2d9ab417 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementFromJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.orderDetails').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementListFromJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementListFromJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..64a301b8ff0309dfe6bfa9cb12aca0ed784e673f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetElementListFromJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetFilteredResult.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetFilteredResult.groovy new file mode 100644 index 0000000000000000000000000000000000000000..b7fbc0936b5897003334a300ec69823d55d6409a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetFilteredResult.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +emptyList = jsonNode.jsonPath("customers[?(@.name == 'Klo')]").elementList(); +nodeList = jsonNode.jsonPath("customers[?(@.name == 'Waldo')]").elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetMultipleArrayEntries.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetMultipleArrayEntries.groovy new file mode 100644 index 0000000000000000000000000000000000000000..2b24b5e13aa211f43663fb71605d067fac61c235 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetMultipleArrayEntries.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[0:2]').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetNumberFromJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetNumberFromJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..5efa276f821c1022f2c4c016354308afdbac2d4a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetNumberFromJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +numberValue = jsonNode.jsonPath('$.orderDetails.price').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetSingleArrayEntry.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetSingleArrayEntry.groovy new file mode 100644 index 0000000000000000000000000000000000000000..7f7f6712e5128b219a4f439125bad8c29849abb5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetSingleArrayEntry.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.customers[0]').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetStringFromJsonPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetStringFromJsonPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..69be84fb92769901b5068282a791d93d881e6fa0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.shouldGetStringFromJsonPath.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +stringValue = jsonNode.jsonPath('$.order').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.souldGetMultipleArrayPropertyValues.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.souldGetMultipleArrayPropertyValues.groovy new file mode 100644 index 0000000000000000000000000000000000000000..3a399a1461b4e54c80f64270e282c6f17f1257c1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeJsonPathGroovyTest.souldGetMultipleArrayPropertyValues.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[*].name').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.groovy new file mode 100644 index 0000000000000000000000000000000000000000..22c56e8c1015ec113e49bfc5d32a046b2a7a4cc1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.groovy @@ -0,0 +1,6 @@ +import com.fasterxml.jackson.databind.type.TypeFactory + +desiredType = TypeFactory.defaultInstance().constructCollectionType(collectionType, mapToType) + +result = S(input, "application/json").mapTo(desiredType.toCanonical()) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1cf6f05a68eed15a7c23e38a42609c47488d9c89 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.groovy @@ -0,0 +1 @@ +result = S(input).mapTo(mapToType) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapDictionary.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapDictionary.groovy new file mode 100644 index 0000000000000000000000000000000000000000..95bc1ebe714dd1c1b3015fe75ecc64de39af6c5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapDictionary.groovy @@ -0,0 +1,13 @@ +def customer(name, date) { + return ["name": name, "contractStartDate": date] +} + +order = ["order" : "order1", "dueUntil": 20150112, "id": 1234567890987654321, "active": true, "nullValue": null] + +customers = [customer("Kermit", 1354539722), customer("Waldo", 1320325322), customer("Johnny", 1286110922)] +order["customers"] = customers + +orderDetails = ["article": "camundaBPM", "price": 1234567.13, "roundedPrice": 1234567, "currencies": ["euro", "dollar"], "paid": false] +order["orderDetails"] = orderDetails + +json = S(order, "application/json").toString() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapPrimitives.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapPrimitives.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c162ed0b8a5aa17f57a074cd9b11bd413c19d8c0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeMapObjectToJsonGroovyTest.shouldMapPrimitives.groovy @@ -0,0 +1,7 @@ +stringVar = S('"a String"', "application/json") + +booleanVar = S(false, "application/json") + +integerVar = S(42, "application/json") + +listVar = S(["Waldo", "Hugo", "Kermit"], "application/json") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldBeSameAsJavaValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldBeSameAsJavaValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1b2868ff32529c2200d8056b3136f46525cf3784 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldBeSameAsJavaValue.groovy @@ -0,0 +1,12 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode = node.prop("orderDetails") + +property1 = node.prop("order") +property2 = childNode.prop("price") +property3 = node.prop("active") + +stringValue = property1.stringValue() +numberValue = property2.numberValue() +boolValue = property3.boolValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckArrayValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckArrayValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..cd5ff6d6597f7e8e421fd4fdf29d552664ee7863 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckArrayValue.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isArray() +value2 = property2.isArray() +value3 = property3.isArray() +value4 = property4.isArray() +value5 = property5.isArray() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckBooleanValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckBooleanValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0b8470c394e40b9797ef66b10a910393a2d8d534 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckBooleanValue.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isBoolean() +value2 = property2.isBoolean() +value3 = property3.isBoolean() +value4 = property4.isBoolean() +value5 = property5.isBoolean() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckNumberValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckNumberValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ae98c28679c54afea306253073bb865dfacb76ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckNumberValue.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isNumber() +value2 = property2.isNumber() +value3 = property3.isNumber() +value4 = property4.isNumber() +value5 = property5.isNumber() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckStringValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckStringValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..eb0c012e2929e57479370562ccfe528dd4abaa2c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckStringValue.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isString() +value2 = property2.isString() +value3 = property3.isString() +value4 = property4.isString() +value5 = property5.isString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..958059f3182689e3e7156745e9183e80b364ee54 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldCheckValue.groovy @@ -0,0 +1,9 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("dueUntil") + +value1 = property1.value() +value2 = property2.value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1e74b2ee131f6390355199be5c24bd7ce907cd5d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property = node.prop("customers"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject2.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject2.groovy new file mode 100644 index 0000000000000000000000000000000000000000..9270f73dbad02e2eb81111ea475f1adb42f44e9e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToCheckObject2.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property = node.prop("orderDetails"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadBooleanValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadBooleanValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..93ab3d4031a625db87d50646a5bf335e909aff57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadBooleanValue.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +property1 = node.prop("order"); + +value1 = property1.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadNumberValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadNumberValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..6f0671600f3f7990f5e4367a5af791e91248f774 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadNumberValue.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadObjectInNonArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadObjectInNonArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..cc4303f7a361fd94b6848c747d2514cfc54d1e8c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadObjectInNonArray.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property = node.prop("order"); + +value = property.elements(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c7b194187a5b5f151e18ab9d4971a06839c9c5e6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property = node.prop("42"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty2.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty2.groovy new file mode 100644 index 0000000000000000000000000000000000000000..7ce444c0947a59d01bda631b0c3cf998c6c4fd50 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadProperty2.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property = node.prop(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadStringValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadStringValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e938af97aaf5b93b24e0b7b673155447c1ad09cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldFailToReadStringValue.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadBooleanValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadBooleanValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e30bbf1a3af3b0549aa8a623050d5fe802fab73c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadBooleanValue.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") + +property1 = node.prop("active") + +value1 = property1.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..43578a673077eec2b3363cec2ef8d1c84271b454 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNode.groovy @@ -0,0 +1,8 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode = node.prop("orderDetails") + +property = childNode.prop("article") + +value = property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNodeProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNodeProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..db279781ee39e5d16bf9b5fb0839663e6fe12b22 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadChildNodeProperty.groovy @@ -0,0 +1,13 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode = node.prop("orderDetails") +childNode2 = childNode.prop("currencies") +list = childNode2.elements() + +property1 = childNode.prop("roundedPrice") +property2 = list.get(1) + +value1 = property1.numberValue() +value2 = property2.stringValue() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadListOfNodes.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadListOfNodes.groovy new file mode 100644 index 0000000000000000000000000000000000000000..56753d104d9860a12dd8b7fac5a4aa0e7a5139fd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadListOfNodes.groovy @@ -0,0 +1,8 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +list = node.fieldNames() + +value1 = list.get(0) +value2 = list.get(1) +value3 = list.get(4) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadNumberValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadNumberValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..58ef08f93c448f2c0b0318dce32cbb67cfcdf50a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadNumberValue.groovy @@ -0,0 +1,12 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode1 = node.prop("orderDetails") + +property1 = node.prop("dueUntil") +property2 = node.prop("id") +property3 = childNode1.prop("price") + +value1 = property1.numberValue() +value2 = property2.numberValue() +value3 = property3.numberValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadObjectInArrayChildNode.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadObjectInArrayChildNode.groovy new file mode 100644 index 0000000000000000000000000000000000000000..3ba8a7ea6efd63734599e488319fbb923ceeb6a6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadObjectInArrayChildNode.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode = node.prop("customers") +list = childNode.elements() + +property1 = list.get(0) +property2 = list.get(1) + +customer1 = property1.prop("name") +customer2 = property2.prop("name") + +value1 = customer1.stringValue(); +value2 = customer2.stringValue(); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..87013ec56236fb7e8304010885971558821273da --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadProperty.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +property = node.prop("order") +value = property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadTextValue.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadTextValue.groovy new file mode 100644 index 0000000000000000000000000000000000000000..b91b0678678c17c542af3746a46865a57513e287 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeReadPropertyGroovyTest.shouldReadTextValue.groovy @@ -0,0 +1,15 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +childNode1 = node.prop("customers") +childNode2 = node.prop("orderDetails") +list = childNode1.elements() +customerNode = list.get(0) + +property1 = node.prop("order") +property2 = customerNode.prop("name") +property3 = childNode2.prop("article") + +value1 = property1.stringValue() +value2 = property2.stringValue() +value3 = property3.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByList.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByList.groovy new file mode 100644 index 0000000000000000000000000000000000000000..985f62500c55c757785265d2dea1cf40a5080947 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByList.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +def list = ["order", "comment"] +node.deleteProp(list) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..20fea97880b69c366559f2117176c3194a94fe3e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldFailWhileRemovingPropertyByName.groovy @@ -0,0 +1,4 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +node.deleteProp("comment") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByList.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByList.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ad4cb7cbcbf7e24e140d1b7dec648730ce67d1ae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByList.groovy @@ -0,0 +1,8 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +def list = ["order", "active"] +node.deleteProp(list) + +value1 = node.hasProp("order") +value2 = node.hasProp("active") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d215385fa9dc6e0cab326d526243be595c6b9557 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeRemovePropertyGroovyTest.shouldRemovePropertyByName.groovy @@ -0,0 +1,5 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json") +node.deleteProp("order") +value = node.hasProp("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingArray.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingArray.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1052889863f2256cf8a8dd56fe462e9f8ec5083a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingArray.groovy @@ -0,0 +1,7 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +Date date = new Date(); +def list = [date] + +node.prop("comment", list); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingObject.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingObject.groovy new file mode 100644 index 0000000000000000000000000000000000000000..f55e1b5bc65bfab451fa506ce37159f1a4ae6e29 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldFailWhileSettingObject.groovy @@ -0,0 +1,9 @@ +package org.camunda.spin.groovy.json.tree + +node = S(input, "application/json"); +Date date = new Date(); +def object = [ + date: date +]; + +node.prop("comment", object); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceArrayProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceArrayProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1db1ed4f9098c5f4520d6c894bf2aac902447ce5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceArrayProperty.groovy @@ -0,0 +1,10 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +def list = new ArrayList(); +list.push("test"); +list.push("test2"); + +node.prop("order", list); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceBooleanProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceBooleanProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..f4ce9ae38bc41dc410d91ab0646ba164b7b8072f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceBooleanProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", false); +newValue = node.prop("order").boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceFloatProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceFloatProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..90b8d32a131bf7eefe7c3e010ffc70268ddf0442 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceFloatProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42.00); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceIntegerProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceIntegerProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..01858da6f45c602985b737108188cc941daf0da2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceIntegerProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceLongProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceLongProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..167f74c14401420bbd070dda5110f1fb80f82fbb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceLongProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 4200000000); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceNullProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceNullProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0f77e1ab3bdee0d46c4e617ff255fc519be4d471 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceNullProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("order", (String) null); + +propertyNode = node.prop("order"); +newValue = node.prop("order").value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceObjectProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceObjectProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..99b17bd2400bf000de218b415b4b09b3d7a5710a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceObjectProperty.groovy @@ -0,0 +1,11 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +def object = [ + name: "test", + comment: "test2" +] + +node.prop("order", object); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceStringProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceStringProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..377feb0d2d0ccf6d7f2f8520f51d554c43d0dfce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldReplaceStringProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", "new Order"); +newValue = node.prop("order").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetArrayProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetArrayProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c1457781a289dfc36e610afddee846af5bf3aacd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetArrayProperty.groovy @@ -0,0 +1,6 @@ +node = S(input, "application/json"); +ArrayList list = ["test", "test2"]; +node.prop("comment", list); + +propertyNode = node.prop("comment"); +value = propertyNode.elements().get(1).stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetBooleanProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetBooleanProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..bbf9498d6bcee5f2cb43f883f611582ecdd98d65 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetBooleanProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", false); + +propertyNode = node.prop("comment"); +value = propertyNode.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetFloatProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetFloatProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..9541c2c74c1946756f77fe816b9300e82bdac295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetFloatProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42.00); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetIntegerProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetIntegerProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..4805f2e16b6dab5b662889391452fff6e9a05bbf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetIntegerProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetLongProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetLongProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..6898555623d6ebe13f23f90ef9d099e35da96cfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetLongProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 4200000000); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetNullProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetNullProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..de1573c723295704cde166f9ca77f5216d03481b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetNullProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", (String) null); + +propertyNode = node.prop("comment"); +value = propertyNode.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetObjectProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetObjectProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..010c5cba0a6e9d082163d87a224082d206c3fd1c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetObjectProperty.groovy @@ -0,0 +1,10 @@ +node = S(input, "application/json"); +def object = [ + name: "test", + comment: "42!", +]; + +node.prop("comment", object); + +propertyNode = node.prop("comment"); +value = propertyNode.prop("comment").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetStringProperty.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetStringProperty.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0d9769fa3e05474d17a62f3574e0974255ec3e58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/groovy/json/tree/JsonTreeSetPropertyGroovyTest.shouldSetStringProperty.groovy @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", "42!"); + +propertyNode = node.prop("comment"); +value = propertyNode.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js new file mode 100644 index 0000000000000000000000000000000000000000..696b3ff12ba23507428106602d206e8f24e471c1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js @@ -0,0 +1,5 @@ +var wrappedJson = S(input, "application/json"); + +json = S(wrappedJson); + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0539e5cf729cc892581a64ed0e8be535c2378e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js @@ -0,0 +1,5 @@ +json1 = S(input1, org.camunda.spin.DataFormats.json()); + +json2 = S(input2, "application/json"); + +json3 = S(input3); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js new file mode 100644 index 0000000000000000000000000000000000000000..55c0124d4051de181eec28fdb0b81e94cf18491e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js @@ -0,0 +1,5 @@ +json1 = S(input, org.camunda.spin.DataFormats.json()); + +json2 = S(input, "application/json"); + +json3 = S(input); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js new file mode 100644 index 0000000000000000000000000000000000000000..68c06cb54540eed01bead82657b42d0e35f1e756 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js @@ -0,0 +1,8 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); +oldSize = currencies.elements().size(); + +currencies.append("Testcustomer"); + +newSize = currencies.elements().size(); +value = currencies.elements().get(oldSize).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js new file mode 100644 index 0000000000000000000000000000000000000000..bffbdcdf749f981e6c0f8011e6bc622962bba29f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.append(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..965978098f2a64923dd551dfa6f8d78b207c5e09 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.append("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js new file mode 100644 index 0000000000000000000000000000000000000000..5e31316657373b9d7ce9805dcf026d72a14d4125 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.append(new Date()); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..00852b1fb1850b0123f51f45ddbe1c278d4df92d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..3969ff2d95356b12c4520460c86289e39eeabdc3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.insertAfter("euro", "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..7ed083a5ccc40449a172c3e3d05c1f0bfd9bcdc1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..e1749c1e54000659285cb5a6aee9381f0ede8d08 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..879f4bff60e4c5338cf4fe5e82f90f9263589ecc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.insertAt(1, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..58522ec55f8b0bc088c0584edfcbf4b9c913436b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..c4e28685920d18408e94f24612f062e54eaaf453 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(-6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..87700f50f3656e4f3084686ad57bfe791ac3eb5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.insertAt(1, null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..88fae3ba2dcf050ce6982433cc90a52e89044103 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); +customers.insertAt(1, new Date()); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..6a51cb145ac64868fc36eadde1036e3254d5ae8a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..91a0542a891c372349759b6a1c0ad7f23e3d04ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.insertBefore("euro", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..3ab553428f8e01bdb4db459234eaed456a68e92e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..e2c81a4613fed3e4693a11753660b5381106705d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..19ba3e35957d1f343cf7ef269d1e7d545ef5886a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..059407e052d0110f937d72ce30988e7473b2d150 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..41d2d92f8c183f2c6dca07ab8e6f9ae583b3f458 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..3138e4c1a82e9b6716e76be642fdc1f971f3d9ef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..9b424423cf88005b2627d0889350d3f9abbb13ff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js new file mode 100644 index 0000000000000000000000000000000000000000..cc130e69fb9f05ad1a6a34f109a4ad3dd4d24808 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js new file mode 100644 index 0000000000000000000000000000000000000000..ee3516d74b4ffdf8ded100338f71b7cdee97ed48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").indexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..b8f15814d14049a58981c8481b09650560ed7a8f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js new file mode 100644 index 0000000000000000000000000000000000000000..2ad925c2684395e12a96c650e8340e44c7d9d220 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js new file mode 100644 index 0000000000000000000000000000000000000000..eed60977238ac403f458251570b04ae9690cffa8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").lastIndexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..e45b9b23d91e3dfc32821f199ab4f4b420852473 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.removeAt(1); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..f4c2443ac5bb592d81b26e76b43643b1df319753 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..a7daec960cdda52948beda13b1315d586d45e9d7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(-6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..1af1f1131cc2a242cbc0b4d84a01081816cd5abe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js new file mode 100644 index 0000000000000000000000000000000000000000..08ed847c4af435d87f7b8af64b2c3883f70c776c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeLast("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..1d091aac8bdd3d37bead9c534236d3b6434ccc13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.removeLast(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..c81eb4210be00e70842e48c8f155dd3936518c52 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.removeLast(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..1af1f1131cc2a242cbc0b4d84a01081816cd5abe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js new file mode 100644 index 0000000000000000000000000000000000000000..c8fec27888d8474f22d81e757f72592f2f17f1b2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..5bef6c5aa5627337b179e4774a39d7cbf4e35c34 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.remove(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..40244e470d5cf7017d120b6a4c0c701d44aca200 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.remove(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js new file mode 100644 index 0000000000000000000000000000000000000000..b4191e6ee9cf8c835b4bc1934f952958e2f0e9e4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertAfter(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(2).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..8c6f585beff39e0040f85ad23c28d0a235138403 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(1, "test1"); + +newSize = currencies.elements().size(); +newPosition = currencies.indexOf("dollar"); +value = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..0e94173e4aded83af61ec0a75ce8eccf732d245b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(-1, "test1"); + +newSize = currencies.elements().size(); +newPosition = currencies.indexOf("dollar"); +value = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..472a2c3c98344e0be80aa0ace51d6bc77d542437 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(1).stringValue(); +oldValueOnNewPosition = currencies.elements().get(2).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js new file mode 100644 index 0000000000000000000000000000000000000000..8c1efed733568e9ef82e3d9bc6d4929f73ee2242 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(0).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..7ccd893f094d39339c7c861d6ce7db0086364037 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.indexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..c8abde4a99978873bbf4988a4c925e744920b20d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.lastIndexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..0c31ec46ab2b79d0ac7b0a0558c68e4d9236cb4c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(1); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..04ee3d3469afda85bd0787dc80e05f42d01382aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(-2); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js new file mode 100644 index 0000000000000000000000000000000000000000..fcc1f359e7f30c0e301dce939961882c96f4603d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); + +oldSize = node.elements().size(); +oldValue = node.elements().get(oldSize - 1).stringValue(); + +node.removeLast("test"); + +newSize = node.elements().size(); +newValue = node.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js new file mode 100644 index 0000000000000000000000000000000000000000..d3ed3106a5367daaa31fa2ed8f5555dbcd62576f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js @@ -0,0 +1,10 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.remove("euro"); + +newValue = currencies.elements().get(0).stringValue(); +newSize = currencies.elements().size(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..6491cc4c1097453a11a3fc23f58670c67b350a7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order.task').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js new file mode 100644 index 0000000000000000000000000000000000000000..cfd3c292a7af5e44b7a9fa7a59a7326ef5da0fe2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js new file mode 100644 index 0000000000000000000000000000000000000000..566cc24834dde46741d711bf9a5339377dcd1ea0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..dc04009f9dfd96e4cc2ba13c45cd9c9e6bbf4553 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.....').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..1361fd5512a23007a56ef16bb4f6dc8daf201152 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.active').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js new file mode 100644 index 0000000000000000000000000000000000000000..43fa640fca0cb66838d90f35a229f4af385c4b77 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.id').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..12915aceb170fc183e2e924cedecf822b2be8b02 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +booleanValue = jsonNode.jsonPath('$.active').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..66ad3633ad608aa492f70594ecf2a1baac43fbec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.orderDetails').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..f549e4783a0b25c5516603463ece7b80d1171db2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js new file mode 100644 index 0000000000000000000000000000000000000000..952c79f9e4f46cf515809449f0ffba875bf2ad1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js @@ -0,0 +1,4 @@ +var jsonNode = S(input, "application/json"); + +emptyList = jsonNode.jsonPath("customers[?(@.name == 'Klo')]").elementList(); +nodeList = jsonNode.jsonPath("customers[?(@.name == 'Waldo')]").elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js new file mode 100644 index 0000000000000000000000000000000000000000..331f1d974bc7db65d6d1902bec25807cf62ec0a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[0:2]').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..36b06a4a6633514d92bbdff6cc5b474793847398 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +numberValue = jsonNode.jsonPath('$.orderDetails.price').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js new file mode 100644 index 0000000000000000000000000000000000000000..6b40c83a2f174a22b2200b5b05b1759d63b59577 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.customers[0]').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..b004852f4fa96362a900b70e19c319bbaed829f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +stringValue = jsonNode.jsonPath('$.order').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js new file mode 100644 index 0000000000000000000000000000000000000000..cec7eda2a65503dc72fba893092363b5d02d5aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[*].name').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js new file mode 100644 index 0000000000000000000000000000000000000000..b42d26d79657b5ce041db980c0a177322f288523 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js @@ -0,0 +1,4 @@ +desiredType = com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance().constructCollectionType(collectionType, mapToType); + +result = S(input, "application/json").mapTo(desiredType.toCanonical()); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js new file mode 100644 index 0000000000000000000000000000000000000000..d01ac2a52cd934ed913712d526ecd536c05f4d7c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js @@ -0,0 +1 @@ +result = S(input).mapTo(mapToType); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js new file mode 100644 index 0000000000000000000000000000000000000000..b477afaddc0e0251d94d756144c8650d6e0caddc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js @@ -0,0 +1,13 @@ +customer = function(name, date) { + return {name: name, contractStartDate: date} +} + +order = {order : "order1", dueUntil: 20150112, id: 1234567890987654321, active: true, nullValue: null} + +customers = [customer("Kermit", 1354539722), customer("Waldo", 1320325322), customer("Johnny", 1286110922)] +order.customers = customers + +orderDetails = {article: "camundaBPM", price: 32000.45, roundedPrice: 32000, currencies: ["euro", "dollar"], paid: false} +order.orderDetails = orderDetails + +json = S(order, "application/json").toString() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js new file mode 100644 index 0000000000000000000000000000000000000000..c162ed0b8a5aa17f57a074cd9b11bd413c19d8c0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js @@ -0,0 +1,7 @@ +stringVar = S('"a String"', "application/json") + +booleanVar = S(false, "application/json") + +integerVar = S(42, "application/json") + +listVar = S(["Waldo", "Hugo", "Kermit"], "application/json") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js new file mode 100644 index 0000000000000000000000000000000000000000..ffd545cd8335d8e27a03b27a4133627acf036ae9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); + +property1 = node.prop("order"); +property2 = childNode.prop("price"); +property3 = node.prop("active"); + +stringValue = property1.stringValue(); +numberValue = property2.numberValue(); +boolValue = property3.boolValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js new file mode 100644 index 0000000000000000000000000000000000000000..d631e02d90403bf2a67cf226d52500c38dadee37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isArray(); +value2 = property2.isArray(); +value3 = property3.isArray(); +value4 = property4.isArray(); +value5 = property5.isArray(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..1979d662fc9459dad4d62f9ef1d87160438318ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isBoolean(); +value2 = property2.isBoolean(); +value3 = property3.isBoolean(); +value4 = property4.isBoolean(); +value5 = property5.isBoolean(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..63d81dbcdc58924cf87bc85ede9d1e63372b0ad1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isNumber(); +value2 = property2.isNumber(); +value3 = property3.isNumber(); +value4 = property4.isNumber(); +value5 = property5.isNumber(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js new file mode 100644 index 0000000000000000000000000000000000000000..dbbd8a9ae21257bab93152afc009af4547ca048a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isString(); +value2 = property2.isString(); +value3 = property3.isString(); +value4 = property4.isString(); +value5 = property5.isString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js new file mode 100644 index 0000000000000000000000000000000000000000..f6ddefffb2a596b2b967559cb948ac979ccee290 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js @@ -0,0 +1,9 @@ +node = S(input, "application/json"); + +property = node.prop("order"); + +property1 = node.prop("order"); +property2 = node.prop("dueUntil"); + +value1 = property1.value(); +value2 = property2.value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js new file mode 100644 index 0000000000000000000000000000000000000000..cc813ad9db1bdd606dfd331c5db6a59ae0d7a26a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("customers"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js new file mode 100644 index 0000000000000000000000000000000000000000..4f4f773b795141c690ecda1c4738dcf376be05c5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("orderDetails"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..073b14eea119d183964301837b29bcd5d0e3fd67 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); + +value1 = property1.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..b58347db33df089a55752b44240a70728cd21667 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..66e6c11aec1d6d7f037584c8af35404787e92f80 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("order"); + +value = property.elements(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..081926edc5005ae05c8983f3ab76026c478ee510 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); + +property = node.prop("42"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js new file mode 100644 index 0000000000000000000000000000000000000000..12df223cce93ee0a64449d852dc0b35faeee5a7d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); + +property = node.prop(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js new file mode 100644 index 0000000000000000000000000000000000000000..aff2fab32b2e4bb513c27f3acc386b3311649146 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..7e19af3cb6fd358bd331e8eacaf58153d21dff1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js new file mode 100644 index 0000000000000000000000000000000000000000..499fa827503da2fb5752ee0273550e0d8d9f0561 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); + +property = childNode.prop("article"); + +value = property.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..b3dff492f8b5fdfdb504b41ec583cbdedd955bf8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js @@ -0,0 +1,11 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); +childNode2 = childNode.prop("currencies"); +list = childNode2.elements(); + +property1 = childNode.prop("roundedPrice"); +property2 = list.get(1); + +value1 = property1.numberValue(); +value2 = property2.stringValue(); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js new file mode 100644 index 0000000000000000000000000000000000000000..7a66b602bc38dcadd562991d9dcedcea50081e99 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); +list = node.fieldNames(); + +value1 = list.get(0); +value2 = list.get(1); +value3 = list.get(4); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..e160bd9f0b5abc60361082874c176fa7b1f2d7ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); +childNode1 = node.prop("orderDetails"); + +property1 = node.prop("dueUntil"); +property2 = node.prop("id"); +property3 = childNode1.prop("price"); + +value1 = property1.numberValue(); +value2 = property2.numberValue(); +value3 = property3.numberValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js new file mode 100644 index 0000000000000000000000000000000000000000..d3fc842bc33be6b92f7b40fefcd78b0c0cc7bdb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); +childNode = node.prop("customers"); +list = childNode.elements(); + +property1 = list.get(0); +property2 = list.get(1); + +customer1 = property1.prop("name"); +customer2 = property2.prop("name"); + +value1 = customer1.stringValue(); +value2 = customer2.stringValue(); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..ed899f1b8297cb98d83fea7ce9f680aed5513139 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); +property = node.prop("order"); +value = property.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js new file mode 100644 index 0000000000000000000000000000000000000000..9dcfcc330a78d874e364a521947f3c76103d3d6d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); +childNode1 = node.prop("customers"); +childNode2 = node.prop("orderDetails"); +list = childNode1.elements(); +customerNode = list.get(0); + +property1 = node.prop("order"); +property2 = customerNode.prop("name"); +property3 = childNode2.prop("article"); + +value1 = property1.stringValue(); +value2 = property2.stringValue(); +value3 = property3.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js new file mode 100644 index 0000000000000000000000000000000000000000..b895825bbc456037956c7f5690ccb7c2ff9e0914 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +var list = ["order", "comment"]; +node.deleteProp(list); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js new file mode 100644 index 0000000000000000000000000000000000000000..693283c7bcb435742e255965f947eb4497b1bd4d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.deleteProp("comment"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js new file mode 100644 index 0000000000000000000000000000000000000000..d962473b94947ca92d5f49ab30250348cdc98fe9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js @@ -0,0 +1,6 @@ +var node = S(input, "application/json"); +var list = ["order", "active"]; +node.deleteProp(list); + +value1 = node.hasProp("order"); +value2 = node.hasProp("active"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js new file mode 100644 index 0000000000000000000000000000000000000000..03db9c9bf60f8daee488319b52832f47bf63abc4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +node.deleteProp("order"); +value = node.hasProp("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js new file mode 100644 index 0000000000000000000000000000000000000000..f3290751b5637831cec3d238171704fd299b808e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +list = [date]; + +node.propList("comment", list); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js new file mode 100644 index 0000000000000000000000000000000000000000..07013dc67045ce53482304e6a445322dcb16fc21 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js @@ -0,0 +1,7 @@ +var node = S(input, "application/json"); + +var object = { + date: date +}; + +node.prop("comment", object); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..430534dd1a850918882cb6b82b85d59853ebdafc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +var list = []; +list.push("test"); +list.push("test2"); + +node.propList("order", list); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..f4ce9ae38bc41dc410d91ab0646ba164b7b8072f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", false); +newValue = node.prop("order").boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..90b8d32a131bf7eefe7c3e010ffc70268ddf0442 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42.00); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..01858da6f45c602985b737108188cc941daf0da2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..167f74c14401420bbd070dda5110f1fb80f82fbb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 4200000000); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..5653754537bfa7267c3c38901e901223c20c1295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node["prop(java.lang.String,java.lang.String)"]("order", null); + +propertyNode = node.prop("order"); +newValue = node.prop("order").value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..5c6fa516930856c9fecacd6105f4e2f03678c347 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js @@ -0,0 +1,12 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +var object = { + name: "test", + comment: "42!" +}; + + +node.prop("order", object); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..377feb0d2d0ccf6d7f2f8520f51d554c43d0dfce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", "new Order"); +newValue = node.prop("order").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..21c9660117b17211cf32e73f04b8375adf889060 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js @@ -0,0 +1,8 @@ +node = S(input, "application/json"); +var list = []; +list.push("test"); +list.push("test2"); +node.propList("comment", list); + +propertyNode = node.prop("comment"); +value = propertyNode.elements().get(1).stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..bbf9498d6bcee5f2cb43f883f611582ecdd98d65 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", false); + +propertyNode = node.prop("comment"); +value = propertyNode.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..9541c2c74c1946756f77fe816b9300e82bdac295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42.00); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..4805f2e16b6dab5b662889391452fff6e9a05bbf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..6898555623d6ebe13f23f90ef9d099e35da96cfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 4200000000); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..fa6946a509d9f660c7838f91827c400193ff381a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node["prop(java.lang.String,java.lang.String)"]("comment", null); + +propertyNode = node.prop("comment"); +newValue = node.prop("comment").value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..8a6e7361c96bdccad11fb5b1f670d33c82ae1a2d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js @@ -0,0 +1,8 @@ +node = S(input, "application/json"); +var object = {}; +object.name = "test"; +object.comment = "42!"; +node.prop("comment", object); + +propertyNode = node.prop("comment"); +value = propertyNode.prop("comment").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..0d9769fa3e05474d17a62f3574e0974255ec3e58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", "42!"); + +propertyNode = node.prop("comment"); +value = propertyNode.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js new file mode 100644 index 0000000000000000000000000000000000000000..696b3ff12ba23507428106602d206e8f24e471c1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldBeIdempotent.js @@ -0,0 +1,5 @@ +var wrappedJson = S(input, "application/json"); + +json = S(wrappedJson); + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js new file mode 100644 index 0000000000000000000000000000000000000000..4d0539e5cf729cc892581a64ed0e8be535c2378e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForReader.js @@ -0,0 +1,5 @@ +json1 = S(input1, org.camunda.spin.DataFormats.json()); + +json2 = S(input2, "application/json"); + +json3 = S(input3); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js new file mode 100644 index 0000000000000000000000000000000000000000..55c0124d4051de181eec28fdb0b81e94cf18491e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeCreateJavascriptTest.shouldCreateForString.js @@ -0,0 +1,5 @@ +json1 = S(input, org.camunda.spin.DataFormats.json()); + +json2 = S(input, "application/json"); + +json3 = S(input); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js new file mode 100644 index 0000000000000000000000000000000000000000..68c06cb54540eed01bead82657b42d0e35f1e756 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldAppendNodeToArray.js @@ -0,0 +1,8 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); +oldSize = currencies.elements().size(); + +currencies.append("Testcustomer"); + +newSize = currencies.elements().size(); +value = currencies.elements().get(oldSize).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js new file mode 100644 index 0000000000000000000000000000000000000000..bffbdcdf749f981e6c0f8011e6bc622962bba29f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendNullNode.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.append(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..965978098f2a64923dd551dfa6f8d78b207c5e09 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendToNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.append("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js new file mode 100644 index 0000000000000000000000000000000000000000..5e31316657373b9d7ce9805dcf026d72a14d4125 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailAppendWrongNode.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.append(new Date()); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..00852b1fb1850b0123f51f45ddbe1c278d4df92d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterNonExistentSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..3969ff2d95356b12c4520460c86289e39eeabdc3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterOnNonArray.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.insertAfter("euro", "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..7ed083a5ccc40449a172c3e3d05c1f0bfd9bcdc1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWithNullAsSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..e1749c1e54000659285cb5a6aee9381f0ede8d08 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAfterWrongSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..879f4bff60e4c5338cf4fe5e82f90f9263589ecc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtNonArray.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.insertAt(1, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..58522ec55f8b0bc088c0584edfcbf4b9c913436b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..c4e28685920d18408e94f24612f062e54eaaf453 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAt(-6, "test1"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..87700f50f3656e4f3084686ad57bfe791ac3eb5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.insertAt(1, null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..88fae3ba2dcf050ce6982433cc90a52e89044103 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertAtWithWrongObject.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); +customers.insertAt(1, new Date()); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..6a51cb145ac64868fc36eadde1036e3254d5ae8a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeNonExistentSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("test", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..91a0542a891c372349759b6a1c0ad7f23e3d04ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeOnNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.insertBefore("euro", "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..3ab553428f8e01bdb4db459234eaed456a68e92e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWithNullAsSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(null, "test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..e2c81a4613fed3e4693a11753660b5381106705d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertBeforeWrongSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore(new Date(), "test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..19ba3e35957d1f343cf7ef269d1e7d545ef5886a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectAfterSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..059407e052d0110f937d72ce30988e7473b2d150 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertNullObjectBeforeSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", null); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..41d2d92f8c183f2c6dca07ab8e6f9ae583b3f458 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectAfterSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertAfter("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..3138e4c1a82e9b6716e76be642fdc1f971f3d9ef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailInsertWrongObjectBeforeSearchObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.insertBefore("euro", new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..9b424423cf88005b2627d0889350d3f9abbb13ff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js new file mode 100644 index 0000000000000000000000000000000000000000..cc130e69fb9f05ad1a6a34f109a4ad3dd4d24808 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfNonExistentValue.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").indexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js new file mode 100644 index 0000000000000000000000000000000000000000..ee3516d74b4ffdf8ded100338f71b7cdee97ed48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadIndexOfWithoutSearchNode.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").indexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..b8f15814d14049a58981c8481b09650560ed7a8f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js new file mode 100644 index 0000000000000000000000000000000000000000..2ad925c2684395e12a96c650e8340e44c7d9d220 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfNonExistentValue.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").lastIndexOf("test"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js new file mode 100644 index 0000000000000000000000000000000000000000..eed60977238ac403f458251570b04ae9690cffa8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailReadLastIndexOfWithoutSearchNode.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.prop("customers").lastIndexOf(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..e45b9b23d91e3dfc32821f199ab4f4b420852473 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.removeAt(1); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..f4c2443ac5bb592d81b26e76b43643b1df319753 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js new file mode 100644 index 0000000000000000000000000000000000000000..a7daec960cdda52948beda13b1315d586d45e9d7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeAt(-6); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..1af1f1131cc2a242cbc0b4d84a01081816cd5abe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js new file mode 100644 index 0000000000000000000000000000000000000000..08ed847c4af435d87f7b8af64b2c3883f70c776c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNonExistentObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.removeLast("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..1d091aac8bdd3d37bead9c534236d3b6434ccc13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.removeLast(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..c81eb4210be00e70842e48c8f155dd3936518c52 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveLastWrongObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.removeLast(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..1af1f1131cc2a242cbc0b4d84a01081816cd5abe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonArray.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); + +node.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js new file mode 100644 index 0000000000000000000000000000000000000000..c8fec27888d8474f22d81e757f72592f2f17f1b2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNonExistentObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +currencies.remove("test"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js new file mode 100644 index 0000000000000000000000000000000000000000..5bef6c5aa5627337b179e4774a39d7cbf4e35c34 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveNullObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.remove(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js new file mode 100644 index 0000000000000000000000000000000000000000..40244e470d5cf7017d120b6a4c0c701d44aca200 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldFailRemoveWrongObject.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var customers = node.prop("customers"); + +customers.remove(new Date()); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js new file mode 100644 index 0000000000000000000000000000000000000000..b4191e6ee9cf8c835b4bc1934f952958e2f0e9e4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAfterSearchObjectOnEnding.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertAfter(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(2).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..8c6f585beff39e0040f85ad23c28d0a235138403 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithIndex.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(1, "test1"); + +newSize = currencies.elements().size(); +newPosition = currencies.indexOf("dollar"); +value = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..0e94173e4aded83af61ec0a75ce8eccf732d245b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertAtWithNegativeIndex.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldPosition = currencies.indexOf("dollar"); + +currencies.insertAt(-1, "test1"); + +newSize = currencies.elements().size(); +newPosition = currencies.indexOf("dollar"); +value = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js new file mode 100644 index 0000000000000000000000000000000000000000..472a2c3c98344e0be80aa0ace51d6bc77d542437 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObject.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(1).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(1).stringValue(); +oldValueOnNewPosition = currencies.elements().get(2).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js new file mode 100644 index 0000000000000000000000000000000000000000..8c1efed733568e9ef82e3d9bc6d4929f73ee2242 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldInsertBeforeSearchObjectOnBeginning.js @@ -0,0 +1,11 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.insertBefore(oldValue, "Test"); + +newSize = currencies.elements().size(); +newValue = currencies.elements().get(0).stringValue(); +oldValueOnNewPosition = currencies.elements().get(1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..7ccd893f094d39339c7c861d6ce7db0086364037 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadIndexOf.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.indexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js new file mode 100644 index 0000000000000000000000000000000000000000..c8abde4a99978873bbf4988a4c925e744920b20d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldReadLastIndexOf.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +value = currencies.lastIndexOf("dollar"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..0c31ec46ab2b79d0ac7b0a0558c68e4d9236cb4c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithIndex.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(1); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js new file mode 100644 index 0000000000000000000000000000000000000000..04ee3d3469afda85bd0787dc80e05f42d01382aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveAtWithNegativeIndex.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); + +currencies.removeAt(-2); + +newSize = currencies.elements().size(); +value = currencies.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js new file mode 100644 index 0000000000000000000000000000000000000000..fcc1f359e7f30c0e301dce939961882c96f4603d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveLast.js @@ -0,0 +1,9 @@ +var node = S(input, "application/json"); + +oldSize = node.elements().size(); +oldValue = node.elements().get(oldSize - 1).stringValue(); + +node.removeLast("test"); + +newSize = node.elements().size(); +newValue = node.elements().get(newSize - 1).stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js new file mode 100644 index 0000000000000000000000000000000000000000..d3ed3106a5367daaa31fa2ed8f5555dbcd62576f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeEditListPropertyJavascriptTest.shouldRemoveObject.js @@ -0,0 +1,10 @@ +var node = S(input, "application/json"); +var currencies = node.prop("orderDetails").prop("currencies"); + +oldSize = currencies.elements().size(); +oldValue = currencies.elements().get(0).stringValue(); + +currencies.remove("euro"); + +newValue = currencies.elements().get(0).stringValue(); +newSize = currencies.elements().size(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..6491cc4c1097453a11a3fc23f58670c67b350a7f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailAccessNonExistentProperty.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order.task').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js new file mode 100644 index 0000000000000000000000000000000000000000..cfd3c292a7af5e44b7a9fa7a59a7326ef5da0fe2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingBoolean.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js new file mode 100644 index 0000000000000000000000000000000000000000..566cc24834dde46741d711bf9a5339377dcd1ea0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingElementList.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.order').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..dc04009f9dfd96e4cc2ba13c45cd9c9e6bbf4553 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.....').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js new file mode 100644 index 0000000000000000000000000000000000000000..1361fd5512a23007a56ef16bb4f6dc8daf201152 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingNumber.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.active').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js new file mode 100644 index 0000000000000000000000000000000000000000..43fa640fca0cb66838d90f35a229f4af385c4b77 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldFailReadingString.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +jsonNode.jsonPath('$.id').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..12915aceb170fc183e2e924cedecf822b2be8b02 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetBooleanFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +booleanValue = jsonNode.jsonPath('$.active').boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..66ad3633ad608aa492f70594ecf2a1baac43fbec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.orderDetails').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..f549e4783a0b25c5516603463ece7b80d1171db2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetElementListFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js new file mode 100644 index 0000000000000000000000000000000000000000..952c79f9e4f46cf515809449f0ffba875bf2ad1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetFilteredResult.js @@ -0,0 +1,4 @@ +var jsonNode = S(input, "application/json"); + +emptyList = jsonNode.jsonPath("customers[?(@.name == 'Klo')]").elementList(); +nodeList = jsonNode.jsonPath("customers[?(@.name == 'Waldo')]").elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js new file mode 100644 index 0000000000000000000000000000000000000000..331f1d974bc7db65d6d1902bec25807cf62ec0a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetMultipleArrayEntries.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[0:2]').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..36b06a4a6633514d92bbdff6cc5b474793847398 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetNumberFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +numberValue = jsonNode.jsonPath('$.orderDetails.price').numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js new file mode 100644 index 0000000000000000000000000000000000000000..6b40c83a2f174a22b2200b5b05b1759d63b59577 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetSingleArrayEntry.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +node = jsonNode.jsonPath('$.customers[0]').element(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js new file mode 100644 index 0000000000000000000000000000000000000000..b004852f4fa96362a900b70e19c319bbaed829f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.shouldGetStringFromJsonPath.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +stringValue = jsonNode.jsonPath('$.order').stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js new file mode 100644 index 0000000000000000000000000000000000000000..cec7eda2a65503dc72fba893092363b5d02d5aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeJsonPathJavascriptTest.souldGetMultipleArrayPropertyValues.js @@ -0,0 +1,3 @@ +var jsonNode = S(input, "application/json"); + +nodeList = jsonNode.jsonPath('$.customers[*].name').elementList(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js new file mode 100644 index 0000000000000000000000000000000000000000..b42d26d79657b5ce041db980c0a177322f288523 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.js @@ -0,0 +1,4 @@ +desiredType = com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance().constructCollectionType(collectionType, mapToType); + +result = S(input, "application/json").mapTo(desiredType.toCanonical()); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js new file mode 100644 index 0000000000000000000000000000000000000000..d01ac2a52cd934ed913712d526ecd536c05f4d7c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.js @@ -0,0 +1 @@ +result = S(input).mapTo(mapToType); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js new file mode 100644 index 0000000000000000000000000000000000000000..b477afaddc0e0251d94d756144c8650d6e0caddc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapDictionary.js @@ -0,0 +1,13 @@ +customer = function(name, date) { + return {name: name, contractStartDate: date} +} + +order = {order : "order1", dueUntil: 20150112, id: 1234567890987654321, active: true, nullValue: null} + +customers = [customer("Kermit", 1354539722), customer("Waldo", 1320325322), customer("Johnny", 1286110922)] +order.customers = customers + +orderDetails = {article: "camundaBPM", price: 32000.45, roundedPrice: 32000, currencies: ["euro", "dollar"], paid: false} +order.orderDetails = orderDetails + +json = S(order, "application/json").toString() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js new file mode 100644 index 0000000000000000000000000000000000000000..c162ed0b8a5aa17f57a074cd9b11bd413c19d8c0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeMapObjectToJsonJavascriptTest.shouldMapPrimitives.js @@ -0,0 +1,7 @@ +stringVar = S('"a String"', "application/json") + +booleanVar = S(false, "application/json") + +integerVar = S(42, "application/json") + +listVar = S(["Waldo", "Hugo", "Kermit"], "application/json") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js new file mode 100644 index 0000000000000000000000000000000000000000..ffd545cd8335d8e27a03b27a4133627acf036ae9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldBeSameAsJavaValue.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); + +property1 = node.prop("order"); +property2 = childNode.prop("price"); +property3 = node.prop("active"); + +stringValue = property1.stringValue(); +numberValue = property2.numberValue(); +boolValue = property3.boolValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js new file mode 100644 index 0000000000000000000000000000000000000000..d631e02d90403bf2a67cf226d52500c38dadee37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckArrayValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isArray(); +value2 = property2.isArray(); +value3 = property3.isArray(); +value4 = property4.isArray(); +value5 = property5.isArray(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..1979d662fc9459dad4d62f9ef1d87160438318ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckBooleanValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isBoolean(); +value2 = property2.isBoolean(); +value3 = property3.isBoolean(); +value4 = property4.isBoolean(); +value5 = property5.isBoolean(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..63d81dbcdc58924cf87bc85ede9d1e63372b0ad1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckNumberValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isNumber(); +value2 = property2.isNumber(); +value3 = property3.isNumber(); +value4 = property4.isNumber(); +value5 = property5.isNumber(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js new file mode 100644 index 0000000000000000000000000000000000000000..dbbd8a9ae21257bab93152afc009af4547ca048a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckStringValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); +property2 = node.prop("id"); +property3 = node.prop("customers"); +property4 = node.prop("orderDetails"); +property5 = node.prop("active"); + +value1 = property1.isString(); +value2 = property2.isString(); +value3 = property3.isString(); +value4 = property4.isString(); +value5 = property5.isString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js new file mode 100644 index 0000000000000000000000000000000000000000..f6ddefffb2a596b2b967559cb948ac979ccee290 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldCheckValue.js @@ -0,0 +1,9 @@ +node = S(input, "application/json"); + +property = node.prop("order"); + +property1 = node.prop("order"); +property2 = node.prop("dueUntil"); + +value1 = property1.value(); +value2 = property2.value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js new file mode 100644 index 0000000000000000000000000000000000000000..cc813ad9db1bdd606dfd331c5db6a59ae0d7a26a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("customers"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js new file mode 100644 index 0000000000000000000000000000000000000000..4f4f773b795141c690ecda1c4738dcf376be05c5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToCheckObject2.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("orderDetails"); + +value = property.value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..073b14eea119d183964301837b29bcd5d0e3fd67 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadBooleanValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("order"); + +value1 = property1.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..b58347db33df089a55752b44240a70728cd21667 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadNumberValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js new file mode 100644 index 0000000000000000000000000000000000000000..66e6c11aec1d6d7f037584c8af35404787e92f80 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadObjectInNonArray.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property = node.prop("order"); + +value = property.elements(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..081926edc5005ae05c8983f3ab76026c478ee510 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); + +property = node.prop("42"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js new file mode 100644 index 0000000000000000000000000000000000000000..12df223cce93ee0a64449d852dc0b35faeee5a7d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadProperty2.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); + +property = node.prop(null); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js new file mode 100644 index 0000000000000000000000000000000000000000..aff2fab32b2e4bb513c27f3acc386b3311649146 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldFailToReadStringValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js new file mode 100644 index 0000000000000000000000000000000000000000..7e19af3cb6fd358bd331e8eacaf58153d21dff1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadBooleanValue.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); + +property1 = node.prop("active"); + +value1 = property1.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js new file mode 100644 index 0000000000000000000000000000000000000000..499fa827503da2fb5752ee0273550e0d8d9f0561 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNode.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); + +property = childNode.prop("article"); + +value = property.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..b3dff492f8b5fdfdb504b41ec583cbdedd955bf8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadChildNodeProperty.js @@ -0,0 +1,11 @@ +node = S(input, "application/json"); +childNode = node.prop("orderDetails"); +childNode2 = childNode.prop("currencies"); +list = childNode2.elements(); + +property1 = childNode.prop("roundedPrice"); +property2 = list.get(1); + +value1 = property1.numberValue(); +value2 = property2.stringValue(); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js new file mode 100644 index 0000000000000000000000000000000000000000..7a66b602bc38dcadd562991d9dcedcea50081e99 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadListOfNodes.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); +list = node.fieldNames(); + +value1 = list.get(0); +value2 = list.get(1); +value3 = list.get(4); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js new file mode 100644 index 0000000000000000000000000000000000000000..e160bd9f0b5abc60361082874c176fa7b1f2d7ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadNumberValue.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); +childNode1 = node.prop("orderDetails"); + +property1 = node.prop("dueUntil"); +property2 = node.prop("id"); +property3 = childNode1.prop("price"); + +value1 = property1.numberValue(); +value2 = property2.numberValue(); +value3 = property3.numberValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js new file mode 100644 index 0000000000000000000000000000000000000000..d3fc842bc33be6b92f7b40fefcd78b0c0cc7bdb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadObjectInArrayChildNode.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); +childNode = node.prop("customers"); +list = childNode.elements(); + +property1 = list.get(0); +property2 = list.get(1); + +customer1 = property1.prop("name"); +customer2 = property2.prop("name"); + +value1 = customer1.stringValue(); +value2 = customer2.stringValue(); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..ed899f1b8297cb98d83fea7ce9f680aed5513139 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadProperty.js @@ -0,0 +1,3 @@ +node = S(input, "application/json"); +property = node.prop("order"); +value = property.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js new file mode 100644 index 0000000000000000000000000000000000000000..9dcfcc330a78d874e364a521947f3c76103d3d6d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeReadPropertyJavascriptTest.shouldReadTextValue.js @@ -0,0 +1,13 @@ +node = S(input, "application/json"); +childNode1 = node.prop("customers"); +childNode2 = node.prop("orderDetails"); +list = childNode1.elements(); +customerNode = list.get(0); + +property1 = node.prop("order"); +property2 = customerNode.prop("name"); +property3 = childNode2.prop("article"); + +value1 = property1.stringValue(); +value2 = property2.stringValue(); +value3 = property3.stringValue(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js new file mode 100644 index 0000000000000000000000000000000000000000..b895825bbc456037956c7f5690ccb7c2ff9e0914 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByList.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +var list = ["order", "comment"]; +node.deleteProp(list); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js new file mode 100644 index 0000000000000000000000000000000000000000..693283c7bcb435742e255965f947eb4497b1bd4d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldFailWhileRemovingPropertyByName.js @@ -0,0 +1,2 @@ +var node = S(input, "application/json"); +node.deleteProp("comment"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js new file mode 100644 index 0000000000000000000000000000000000000000..d962473b94947ca92d5f49ab30250348cdc98fe9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByList.js @@ -0,0 +1,6 @@ +var node = S(input, "application/json"); +var list = ["order", "active"]; +node.deleteProp(list); + +value1 = node.hasProp("order"); +value2 = node.hasProp("active"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js new file mode 100644 index 0000000000000000000000000000000000000000..03db9c9bf60f8daee488319b52832f47bf63abc4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeRemovePropertyJavascriptTest.shouldRemovePropertyByName.js @@ -0,0 +1,3 @@ +var node = S(input, "application/json"); +node.deleteProp("order"); +value = node.hasProp("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js new file mode 100644 index 0000000000000000000000000000000000000000..661610d32373482df628ddd73470a2484940a6b8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingArray.js @@ -0,0 +1,4 @@ +var node = S(input, "application/json"); +list = [date]; + +node.prop("comment", list); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js new file mode 100644 index 0000000000000000000000000000000000000000..07013dc67045ce53482304e6a445322dcb16fc21 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldFailWhileSettingObject.js @@ -0,0 +1,7 @@ +var node = S(input, "application/json"); + +var object = { + date: date +}; + +node.prop("comment", object); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..0810d561841d002e62e8779d2cf6c817aad6300c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceArrayProperty.js @@ -0,0 +1,10 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +var list = []; +list.push("test"); +list.push("test2"); + +node.prop("order", list); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..f4ce9ae38bc41dc410d91ab0646ba164b7b8072f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceBooleanProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", false); +newValue = node.prop("order").boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..90b8d32a131bf7eefe7c3e010ffc70268ddf0442 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceFloatProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42.00); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..01858da6f45c602985b737108188cc941daf0da2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceIntegerProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 42); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..167f74c14401420bbd070dda5110f1fb80f82fbb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceLongProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", 4200000000); +newValue = node.prop("order").numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..5653754537bfa7267c3c38901e901223c20c1295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceNullProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node["prop(java.lang.String,java.lang.String)"]("order", null); + +propertyNode = node.prop("order"); +newValue = node.prop("order").value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..5c6fa516930856c9fecacd6105f4e2f03678c347 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceObjectProperty.js @@ -0,0 +1,12 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order"); + +var object = { + name: "test", + comment: "42!" +}; + + +node.prop("order", object); +newValue = node.prop("order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..377feb0d2d0ccf6d7f2f8520f51d554c43d0dfce --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldReplaceStringProperty.js @@ -0,0 +1,6 @@ +node = S(input, "application/json"); + +oldValue = node.prop("order").stringValue(); + +node.prop("order", "new Order"); +newValue = node.prop("order").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..df7580793aa22cc584120e20ccc5b3e693e69019 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetArrayProperty.js @@ -0,0 +1,8 @@ +node = S(input, "application/json"); +var list = []; +list.push("test"); +list.push("test2"); +node.prop("comment", list); + +propertyNode = node.prop("comment"); +value = propertyNode.elements().get(1).stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..bbf9498d6bcee5f2cb43f883f611582ecdd98d65 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetBooleanProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", false); + +propertyNode = node.prop("comment"); +value = propertyNode.boolValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..9541c2c74c1946756f77fe816b9300e82bdac295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetFloatProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42.00); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..4805f2e16b6dab5b662889391452fff6e9a05bbf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetIntegerProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..6898555623d6ebe13f23f90ef9d099e35da96cfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetLongProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 4200000000); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..fa6946a509d9f660c7838f91827c400193ff381a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetNullProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node["prop(java.lang.String,java.lang.String)"]("comment", null); + +propertyNode = node.prop("comment"); +newValue = node.prop("comment").value(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..8a6e7361c96bdccad11fb5b1f670d33c82ae1a2d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetObjectProperty.js @@ -0,0 +1,8 @@ +node = S(input, "application/json"); +var object = {}; +object.name = "test"; +object.comment = "42!"; +node.prop("comment", object); + +propertyNode = node.prop("comment"); +value = propertyNode.prop("comment").stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js new file mode 100644 index 0000000000000000000000000000000000000000..0d9769fa3e05474d17a62f3574e0974255ec3e58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/javascript/nashorn/json/tree/JsonTreeSetPropertyJavascriptTest.shouldSetStringProperty.js @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", "42!"); + +propertyNode = node.prop("comment"); +value = propertyNode.stringValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example.json b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example.json new file mode 100644 index 0000000000000000000000000000000000000000..23b04618f3aedae7e41a3931a073322d7f497091 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example.json @@ -0,0 +1,31 @@ +{ + "order": "order1", + "dueUntil": 20150112, + "id": 1234567890987654321, + "customers": [ + { + "name": "Kermit", + "contractStartDate": 1354539722 + }, + { + "name": "Waldo", + "contractStartDate": 1320325322 + }, + { + "name": "Johnny", + "contractStartDate": 1286110922 + } + ], + "orderDetails": { + "article": "camundaBPM", + "price": 1234567.13, + "roundedPrice": 1234567, + "currencies": [ + "euro", + "dollar" + ], + "paid": false + }, + "active": true, + "nullValue": null +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson.json b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson.json new file mode 100644 index 0000000000000000000000000000000000000000..6450264efff2d744388556f6edffb441f4c59254 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson.json @@ -0,0 +1,8 @@ +{ + "number": 001, + // a comment + 'a single quote key': '\'non-standard escapes\'', + # a yaml comment + "number2": NaN, + anUnquotedFieldName: "a Value" +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson_types.json b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson_types.json new file mode 100644 index 0000000000000000000000000000000000000000..626c0fa9ae5bfbf71bceaebf4e6c6fa550b24652 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/example_jackson_types.json @@ -0,0 +1,9 @@ +{ + "amount": 2000, + "customer": { + "name": "Kermit", + "contractStartDate": 20130505, + "@class": "org.camunda.spin.json.mapping.RegularCustomer" + }, + "@class": "org.camunda.spin.json.mapping.Invoice" +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/jackson146.json b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/jackson146.json new file mode 100644 index 0000000000000000000000000000000000000000..4fc516e00a25d4bae99a651739255d87617e5d55 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/json/jackson146.json @@ -0,0 +1 @@ +{"abcdef":[{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"},{"a":-4E+1,"b":"c"}]} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldBeIdempotent.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldBeIdempotent.py new file mode 100644 index 0000000000000000000000000000000000000000..e92f8dbb9795d6bf7c1a8357dadff3072e59f43b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldBeIdempotent.py @@ -0,0 +1,4 @@ +wrappedJson = S(input, "application/json") + +json = S(wrappedJson) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForReader.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForReader.py new file mode 100644 index 0000000000000000000000000000000000000000..82d45b48a669ded6a76a43eb3cd33533e1fac8d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForReader.py @@ -0,0 +1,7 @@ +import org.camunda.spin.DataFormats.json as json; + +json1 = S(input1, json()) + +json2 = S(input2, "application/json") + +json3 = S(input3) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForString.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForString.py new file mode 100644 index 0000000000000000000000000000000000000000..6d9b7b72b946da3e931c6fa990917b79f20ce915 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeCreatePythonTest.shouldCreateForString.py @@ -0,0 +1,7 @@ +import org.camunda.spin.DataFormats.json as json; + +json1 = S(input, json()) + +json2 = S(input, "application/json") + +json3 = S(input) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldAppendNodeToArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldAppendNodeToArray.py new file mode 100644 index 0000000000000000000000000000000000000000..395dddd2f72177b772c8966069a7ed42f74a6c93 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldAppendNodeToArray.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() + +currencies.append("Testcustomer") + +newSize = currencies.elements().size() +value = currencies.elements().get(oldSize).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendNullNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendNullNode.py new file mode 100644 index 0000000000000000000000000000000000000000..30c689fd7c88c600c7efe664765ed2f4b73d01d9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendNullNode.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") +customers = node.prop("customers") +customers.append(None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendToNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendToNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..e7fbf419350ddc9e6afeaa79ef8403e967644c95 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendToNonArray.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.append("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendWrongNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendWrongNode.py new file mode 100644 index 0000000000000000000000000000000000000000..7290cd757c977932727054e9c7e1c8faef4d87de --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailAppendWrongNode.py @@ -0,0 +1,6 @@ +class TestObject: + pass + +node = S(input, "application/json") +customers = node.prop("customers") +customers.append(TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterNonExistentSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterNonExistentSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..f45fbb0383d738a573f3d01e7c22c2b6ac40d0b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterNonExistentSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("test", "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterOnNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterOnNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..29436c84a490743d7cf9f7d8ac410ee9698ac066 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterOnNonArray.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.insertAfter("euro", "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWithNullAsSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWithNullAsSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..85706171a5b87726d03d41f84d444cc1a655562d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWithNullAsSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter(None, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWrongSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWrongSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..dfbb69ffd0f2134ad1922ead9a3deaf0e101dd0f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAfterWrongSearchObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter(TestObject(), "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..0cb711f592320d5780161eddf30957561a9cf3aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtNonArray.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.insertAt(1, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithIndexOutOfBounds.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithIndexOutOfBounds.py new file mode 100644 index 0000000000000000000000000000000000000000..48ab02d61cc3d53cef938dbc3673b578944033c5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithIndexOutOfBounds.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAt(6, "test1") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.py new file mode 100644 index 0000000000000000000000000000000000000000..ac8b1e437616d013c92d4051b7136d82d22de737 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAt(-6, "test1") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNullObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNullObject.py new file mode 100644 index 0000000000000000000000000000000000000000..3e3860cfcce70a41e79cc1144d6f1a9056ac4081 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithNullObject.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") +customers = node.prop("customers") +customers.insertAt(1, None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithWrongObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithWrongObject.py new file mode 100644 index 0000000000000000000000000000000000000000..b390087d90d9c74870dd91c95a4e898927a2eb79 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertAtWithWrongObject.py @@ -0,0 +1,6 @@ +class TestObject: + pass + +node = S(input, "application/json") +customers = node.prop("customers") +customers.insertAt(1, TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeNonExistentSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeNonExistentSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..8777b183883a40c9a0cd6bc3bb2335adea711240 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeNonExistentSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("test", "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeOnNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeOnNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..c597f95a34a2ac879941852c509d454aa336026e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeOnNonArray.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.insertBefore("euro", "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWithNullAsSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWithNullAsSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..be63a3867d2936dc3b4be3a3a22ca634bf0c3b1b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWithNullAsSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore(None, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWrongSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWrongSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..3eacc5628f0753ae668da4370a43c52d5ee98eb4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertBeforeWrongSearchObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore(TestObject(), "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectAfterSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectAfterSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..866e7bddf9419e2438a1c68e20f360669c497cb3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectAfterSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("euro", None) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectBeforeSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectBeforeSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..2d039b7276c7415f60ac78d800122b16560cf3cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertNullObjectBeforeSearchObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("euro", None) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectAfterSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectAfterSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..245efd9610dc9dc3b49216f6f1722051c5afbd7e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectAfterSearchObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("euro", TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectBeforeSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectBeforeSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..b98931fdaec685659b049292aea9ef9894c1b3e7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailInsertWrongObjectBeforeSearchObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("euro", TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..d76c287c2580f14667f5359b1a730a10ac3d0a74 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonArray.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.indexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonExistentValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonExistentValue.py new file mode 100644 index 0000000000000000000000000000000000000000..3bb1706f7b7f0aa37900770e87dc9dae08a8dd5c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfNonExistentValue.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.prop("customers").indexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfWithoutSearchNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfWithoutSearchNode.py new file mode 100644 index 0000000000000000000000000000000000000000..03ba08fd927ae6e2b659ca8633a4416899865df5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadIndexOfWithoutSearchNode.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.prop("customers").indexOf(None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..d86a62db0a24d3093b0712002feb6694f0dc2cb9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonArray.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.lastIndexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonExistentValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonExistentValue.py new file mode 100644 index 0000000000000000000000000000000000000000..ce5e9c44f59ba9cfa5d36a8004a6a8d4e874166f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfNonExistentValue.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.prop("customers").lastIndexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfWithoutSearchNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfWithoutSearchNode.py new file mode 100644 index 0000000000000000000000000000000000000000..021be10b22164b2370e6052ac51c7d94122f06d8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailReadLastIndexOfWithoutSearchNode.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +node.prop("customers").lastIndexOf(None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..a43d5c69846abeef87468f7b7c5eb3c2c4693c4c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtNonArray.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.removeAt(1) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithIndexOutOfBounds.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithIndexOutOfBounds.py new file mode 100644 index 0000000000000000000000000000000000000000..cac9e990795a8e13ce6213be9b27954f0165abea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithIndexOutOfBounds.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeAt(6) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.py new file mode 100644 index 0000000000000000000000000000000000000000..9a48f7cefcbacc2794a9f04a13eae1743a8d3e5b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeAt(-6) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..3079cfe595f8e9da967b25d134609a0bed15b45f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonArray.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonExistentObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonExistentObject.py new file mode 100644 index 0000000000000000000000000000000000000000..1e39c6c30f14c8193d72a6050209bc936cad26d6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNonExistentObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeLast("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNullObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNullObject.py new file mode 100644 index 0000000000000000000000000000000000000000..232c6c05a59ab1f070d66ad99c3584145711e038 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastNullObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +customers = node.prop("customers") + +customers.removeLast(None); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastWrongObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastWrongObject.py new file mode 100644 index 0000000000000000000000000000000000000000..56ecf10dd14d8d58100745573fa24bb283838a62 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveLastWrongObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +customers = node.prop("customers") + +customers.removeLast(TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..3079cfe595f8e9da967b25d134609a0bed15b45f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonArray.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonExistentObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonExistentObject.py new file mode 100644 index 0000000000000000000000000000000000000000..1985d1e438a76bc0fe84d746e152210cb9693fb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNonExistentObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNullObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNullObject.py new file mode 100644 index 0000000000000000000000000000000000000000..0cd2656e5a638f6933b8ef5f379435318b165d41 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveNullObject.py @@ -0,0 +1,4 @@ +node = S(input, "application/json") +customers = node.prop("customers") + +customers.remove(None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveWrongObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveWrongObject.py new file mode 100644 index 0000000000000000000000000000000000000000..195a08544c3ea203f76067f2ccf3479c46c05c1d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldFailRemoveWrongObject.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +customers = node.prop("customers") + +customers.remove(TestObject()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAfterSearchObjectOnEnding.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAfterSearchObjectOnEnding.py new file mode 100644 index 0000000000000000000000000000000000000000..844df010f8e8ab5243292226f3351afe8cd1ce57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAfterSearchObjectOnEnding.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldValue = currencies.elements().get(1).stringValue() + +currencies.insertAfter(oldValue, "Test") + +newSize = currencies.elements().size() +newValue = currencies.elements().get(2).stringValue() +oldValueOnNewPosition = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithIndex.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithIndex.py new file mode 100644 index 0000000000000000000000000000000000000000..dcc050139e451c8d2190b09ed8e719fc52f282ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithIndex.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldPosition = currencies.indexOf("dollar") + +currencies.insertAt(1, "test1") + +newSize = currencies.elements().size() +newPosition = currencies.indexOf("dollar") +value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithNegativeIndex.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithNegativeIndex.py new file mode 100644 index 0000000000000000000000000000000000000000..0670f104926bc9caa6511db0c485b69fd311a7ab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertAtWithNegativeIndex.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldPosition = currencies.indexOf("dollar") + +currencies.insertAt(-1, "test1") + +newSize = currencies.elements().size() +newPosition = currencies.indexOf("dollar") +value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObject.py new file mode 100644 index 0000000000000000000000000000000000000000..2751663319da98ed41df2e004944beb279e78c43 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObject.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldValue = currencies.elements().get(1).stringValue() + +currencies.insertBefore(oldValue, "Test") + +newSize = currencies.elements().size() +newValue = currencies.elements().get(1).stringValue() +oldValueOnNewPosition = currencies.elements().get(2).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObjectOnBeginning.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObjectOnBeginning.py new file mode 100644 index 0000000000000000000000000000000000000000..23d1399b9d0d06543b0da9cee381abe5fc462d97 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldInsertBeforeSearchObjectOnBeginning.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldValue = currencies.elements().get(0).stringValue() + +currencies.insertBefore(oldValue, "Test") + +newSize = currencies.elements().size() +newValue = currencies.elements().get(0).stringValue() +oldValueOnNewPosition = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadIndexOf.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadIndexOf.py new file mode 100644 index 0000000000000000000000000000000000000000..66687bd4db3bec5f30b3a35d4cb42c5c69f66a94 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadIndexOf.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +currencies = node.prop("orderDetails").prop("currencies") + +value = currencies.indexOf("dollar") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadLastIndexOf.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadLastIndexOf.py new file mode 100644 index 0000000000000000000000000000000000000000..0d5965d9b0d0e3199a1b95f00fb7a8c55970a30d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldReadLastIndexOf.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +currencies = node.prop("orderDetails").prop("currencies") + +value = currencies.lastIndexOf("dollar") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithIndex.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithIndex.py new file mode 100644 index 0000000000000000000000000000000000000000..fb7b50f5fb56872268334ee0649fbb2bf2f2a1c3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithIndex.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() + +currencies.removeAt(1) + +newSize = currencies.elements().size() +value = currencies.elements().get(newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithNegativeIndex.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithNegativeIndex.py new file mode 100644 index 0000000000000000000000000000000000000000..d34ed6e16b5a68409e2526bc9f43a9fbcc8e2280 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveAtWithNegativeIndex.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() + +currencies.removeAt(-2) + +newSize = currencies.elements().size() +value = currencies.elements().get(newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveLast.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveLast.py new file mode 100644 index 0000000000000000000000000000000000000000..03c3c5e3fe89a289343ad7f615ad2887928927d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveLast.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") + +oldSize = node.elements().size() +oldValue = node.elements().get(oldSize - 1).stringValue() + +node.removeLast("test") + +newSize = node.elements().size() +newValue = node.elements().get(newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveObject.py new file mode 100644 index 0000000000000000000000000000000000000000..55b429d37b00253796cde07f0ac8e45f9ba21953 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeEditListPropertyPythonTest.shouldRemoveObject.py @@ -0,0 +1,10 @@ +node = S(input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +oldSize = currencies.elements().size() +oldValue = currencies.elements().get(0).stringValue() + +currencies.remove("euro") + +newValue = currencies.elements().get(0).stringValue() +newSize = currencies.elements().size() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailAccessNonExistentProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailAccessNonExistentProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..ff61a869c8014667c0284728559b574b2e388bba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailAccessNonExistentProperty.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.order.task').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingBoolean.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingBoolean.py new file mode 100644 index 0000000000000000000000000000000000000000..066cf06c8c793d28dd6d17c8216ce7b4b8bd5d4e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingBoolean.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.order').boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingElementList.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingElementList.py new file mode 100644 index 0000000000000000000000000000000000000000..bba7656559c22b5000ae3c062b9eeafa217a4cfa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingElementList.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.order').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..035dffb4bf4281db85267278f506c69c64cc8a59 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.....').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingNumber.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingNumber.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0c242772bccb0853b5e94c856db86b99e8bf3e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingNumber.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.active').numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingString.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingString.py new file mode 100644 index 0000000000000000000000000000000000000000..795095b487efdfc4cdf95863e2f22eedec9c1e77 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldFailReadingString.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +jsonNode.jsonPath('$.id').stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetBooleanFromJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetBooleanFromJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..b62c4dbfbc5167f7ef0a0e02eaf495f10a8b6ac1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetBooleanFromJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +booleanValue = jsonNode.jsonPath('$.active').boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementFromJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementFromJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..71979196894a3f0615008f9dd007a74c694496ba --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementFromJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +node = jsonNode.jsonPath('$.orderDetails').element() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementListFromJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementListFromJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..b823ff060ec7751ad29dd3233a3ce46a73afc22f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetElementListFromJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +nodeList = jsonNode.jsonPath('$.customers').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetFilteredResult.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetFilteredResult.py new file mode 100644 index 0000000000000000000000000000000000000000..48ecc653e03e5ff70d9664b632e5548732f35701 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetFilteredResult.py @@ -0,0 +1,4 @@ +jsonNode = S(input, "application/json") + +emptyList = jsonNode.jsonPath("customers[?(@.name == 'Klo')]").elementList() +nodeList = jsonNode.jsonPath("customers[?(@.name == 'Waldo')]").elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetMultipleArrayEntries.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetMultipleArrayEntries.py new file mode 100644 index 0000000000000000000000000000000000000000..8994476e5f4a78621ee3a93333e24e14e755a304 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetMultipleArrayEntries.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +nodeList = jsonNode.jsonPath('$.customers[0:2]').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetNumberFromJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetNumberFromJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..78ad27404203d1b12d7722be0a2605ae6e773dae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetNumberFromJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +numberValue = jsonNode.jsonPath('$.orderDetails.price').numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetSingleArrayEntry.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetSingleArrayEntry.py new file mode 100644 index 0000000000000000000000000000000000000000..cc4dfa3c1b5ff677d376ab40d0da3a9a6161577c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetSingleArrayEntry.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +node = jsonNode.jsonPath('$.customers[0]').element() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetStringFromJsonPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetStringFromJsonPath.py new file mode 100644 index 0000000000000000000000000000000000000000..ec152c17596cc52430b2ca9444210f071f92c2da --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.shouldGetStringFromJsonPath.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +stringValue = jsonNode.jsonPath('$.order').stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.souldGetMultipleArrayPropertyValues.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.souldGetMultipleArrayPropertyValues.py new file mode 100644 index 0000000000000000000000000000000000000000..1b2d682ad59aef97d2d0758201fce9c07dc207fd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeJsonPathPythonTest.souldGetMultipleArrayPropertyValues.py @@ -0,0 +1,3 @@ +jsonNode = S(input, "application/json") + +nodeList = jsonNode.jsonPath('$.customers[*].name').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.py new file mode 100644 index 0000000000000000000000000000000000000000..be9157bee5192d1a2d9f07aeb94133b217ca311c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.py @@ -0,0 +1,6 @@ +import com.fasterxml.jackson.databind.type.TypeFactory as TypeFactory + +desiredType = TypeFactory.defaultInstance().constructCollectionType(collectionType, mapToType) + +result = S(input, "application/json").mapTo(desiredType.toCanonical()) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.py new file mode 100644 index 0000000000000000000000000000000000000000..1cf6f05a68eed15a7c23e38a42609c47488d9c89 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.py @@ -0,0 +1 @@ +result = S(input).mapTo(mapToType) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapDictionary.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapDictionary.py new file mode 100644 index 0000000000000000000000000000000000000000..dc52665d6e44fe0ad7a07ac7772984b7cf92c480 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapDictionary.py @@ -0,0 +1,12 @@ +def customer(name, date): + return {"name": name, "contractStartDate": date} + +order = {"order" : "order1", "dueUntil": 20150112, "id": 1234567890987654321, "active": True, "nullValue": None} + +customers = [customer("Kermit", 1354539722), customer("Waldo", 1320325322), customer("Johnny", 1286110922)] +order["customers"] = customers + +orderDetails = {"article": "camundaBPM", "price": 1234567.13, "roundedPrice": 1234567, "currencies": ["euro","dollar"], "paid": False} +order["orderDetails"] = orderDetails + +json = S(order, "application/json").toString() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapPrimitives.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapPrimitives.py new file mode 100644 index 0000000000000000000000000000000000000000..ba873f16e602782522fe5f2a908e65483c6fb0ff --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeMapObjectToJsonPythonTest.shouldMapPrimitives.py @@ -0,0 +1,7 @@ +stringVar = S('"a String"', "application/json") + +booleanVar = S(False, "application/json") + +integerVar = S(42, "application/json") + +listVar = S(["Waldo", "Hugo", "Kermit"], "application/json") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldBeSameAsJavaValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldBeSameAsJavaValue.py new file mode 100644 index 0000000000000000000000000000000000000000..99aa103361be99c04aef780db986862f8c2895cb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldBeSameAsJavaValue.py @@ -0,0 +1,10 @@ +node = S(input, "application/json") +childNode = node.prop("orderDetails") + +property1 = node.prop("order") +property2 = childNode.prop("price") +property3 = node.prop("active") + +stringValue = property1.stringValue() +numberValue = property2.numberValue() +boolValue = property3.boolValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckArrayValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckArrayValue.py new file mode 100644 index 0000000000000000000000000000000000000000..b0742d0d03dd6455cbb94b8b914489ec2cd97285 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckArrayValue.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("id") +property3 = node.prop("customers") +property4 = node.prop("orderDetails") +property5 = node.prop("active") + +value1 = property1.isArray() +value2 = property2.isArray() +value3 = property3.isArray() +value4 = property4.isArray() +value5 = property5.isArray() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckBooleanValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckBooleanValue.py new file mode 100644 index 0000000000000000000000000000000000000000..935198ee4419a92d33eea191fc27430c0d2544d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckBooleanValue.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("id") +property3 = node.prop("customers") +property4 = node.prop("orderDetails") +property5 = node.prop("active") + +value1 = property1.isBoolean() +value2 = property2.isBoolean() +value3 = property3.isBoolean() +value4 = property4.isBoolean() +value5 = property5.isBoolean() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckNumberValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckNumberValue.py new file mode 100644 index 0000000000000000000000000000000000000000..debfcf781a6bd11d14f27ca6dfaceca12a814f02 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckNumberValue.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("id") +property3 = node.prop("customers") +property4 = node.prop("orderDetails") +property5 = node.prop("active") + +value1 = property1.isNumber() +value2 = property2.isNumber() +value3 = property3.isNumber() +value4 = property4.isNumber() +value5 = property5.isNumber() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckStringValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckStringValue.py new file mode 100644 index 0000000000000000000000000000000000000000..2971eeeca124f59a13eaf9dee52b3709dd73bc73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckStringValue.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("id") +property3 = node.prop("customers") +property4 = node.prop("orderDetails") +property5 = node.prop("active") + +value1 = property1.isString() +value2 = property2.isString() +value3 = property3.isString() +value4 = property4.isString() +value5 = property5.isString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckValue.py new file mode 100644 index 0000000000000000000000000000000000000000..3e41546b9125061723e51a2a2b366e90e48073fb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldCheckValue.py @@ -0,0 +1,7 @@ +node = S(input, "application/json") + +property1 = node.prop("order") +property2 = node.prop("dueUntil") + +value1 = property1.value() +value2 = property2.value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject.py new file mode 100644 index 0000000000000000000000000000000000000000..1a213ee5afa7763ed487640ad67c342d99ccf00a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property = node.prop("customers") + +value = property.value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject2.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject2.py new file mode 100644 index 0000000000000000000000000000000000000000..0d004bca60bcff2c37a14c22545408774c220272 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToCheckObject2.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property = node.prop("orderDetails") + +value = property.value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadBooleanValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadBooleanValue.py new file mode 100644 index 0000000000000000000000000000000000000000..661d8316990406be9ef4f3bc10497caa4bb3d8b4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadBooleanValue.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property1 = node.prop("order") + +value1 = property1.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadNumberValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadNumberValue.py new file mode 100644 index 0000000000000000000000000000000000000000..969815b7c21a4ab92e4335cbed10d9f3c00c665b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadNumberValue.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property1 = node.prop("active") + +value1 = property1.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadObjectInNonArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadObjectInNonArray.py new file mode 100644 index 0000000000000000000000000000000000000000..8debad172a694f63af3b070a6442dc67b3003b35 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadObjectInNonArray.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property = node.prop("order") + +value = property.elements() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..07e2eed50f2fc217a5849dd51c63bf16f526844e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +property = node.prop("42") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty2.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty2.py new file mode 100644 index 0000000000000000000000000000000000000000..b8481df51718c59cf872e186f72a875c077d966e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadProperty2.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") + +property = node.prop(None) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadStringValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadStringValue.py new file mode 100644 index 0000000000000000000000000000000000000000..63d2cc7fec7512a7a2f2814831308c1692adaf8b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldFailToReadStringValue.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property1 = node.prop("active") + +value1 = property1.stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadBooleanValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadBooleanValue.py new file mode 100644 index 0000000000000000000000000000000000000000..3de3ec428ca2d0bfb83c04f41e402135fa5f8d37 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadBooleanValue.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property1 = node.prop("active") + +value1 = property1.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNode.py new file mode 100644 index 0000000000000000000000000000000000000000..08d1191c89efb3acb898085eb77e3532561cac36 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNode.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") +childNode = node.prop("orderDetails") + +property = childNode.prop("article") + +value = property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNodeProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNodeProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..49b67f8a54a83883ee4b9eaf8169b9c6c259c106 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadChildNodeProperty.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") +childNode = node.prop("orderDetails") +childNode2 = childNode.prop("currencies") +list = childNode2.elements() + +property1 = childNode.prop("roundedPrice") +property2 = list.get(1) + +value1 = property1.numberValue() +value2 = property2.stringValue() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadListOfNodes.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadListOfNodes.py new file mode 100644 index 0000000000000000000000000000000000000000..0beec34210c6ba164bf7cd59baa776077238d158 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadListOfNodes.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") +list = node.fieldNames() + +value1 = list.get(0) +value2 = list.get(1) +value3 = list.get(4) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadNumberValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadNumberValue.py new file mode 100644 index 0000000000000000000000000000000000000000..2ef27a915c9461225501fea2e9c41941a06ae7f1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadNumberValue.py @@ -0,0 +1,10 @@ +node = S(input, "application/json") +childNode1 = node.prop("orderDetails") + +property1 = node.prop("dueUntil") +property2 = node.prop("id") +property3 = childNode1.prop("price") + +value1 = property1.numberValue() +value2 = property2.numberValue() +value3 = property3.numberValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadObjectInArrayChildNode.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadObjectInArrayChildNode.py new file mode 100644 index 0000000000000000000000000000000000000000..5ec89731a98008b332c144a23046d31460e56aa2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadObjectInArrayChildNode.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") +childNode = node.prop("customers") +list = childNode.elements() + +property1 = list.get(0) +property2 = list.get(1) + +customer1 = property1.prop("name") +customer2 = property2.prop("name") + +value1 = customer1.stringValue() +value2 = customer2.stringValue() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..afa7d7e611869e8ccd9a40596c43961e5814ad43 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") + +property = node.prop("order") + +value = property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadTextValue.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadTextValue.py new file mode 100644 index 0000000000000000000000000000000000000000..a193ba5d2a3dded05cc9fca9ba45a097766291d5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeReadPropertyPythonTest.shouldReadTextValue.py @@ -0,0 +1,13 @@ +node = S(input, "application/json") +childNode1 = node.prop("customers") +childNode2 = node.prop("orderDetails") +list = childNode1.elements() +customerNode = list.get(0) + +property1 = node.prop("order") +property2 = customerNode.prop("name") +property3 = childNode2.prop("article") + +value1 = property1.stringValue() +value2 = property2.stringValue() +value3 = property3.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByList.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByList.py new file mode 100644 index 0000000000000000000000000000000000000000..c56f9582dad37bdd8a520787b23ab1fb27380817 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByList.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") +list = ["order", "comment"] +node.deleteProp(list) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByName.py new file mode 100644 index 0000000000000000000000000000000000000000..817a1f4386c37c2ca4515d3b944abcd601971249 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldFailWhileRemovingPropertyByName.py @@ -0,0 +1,2 @@ +node = S(input, "application/json") +node.deleteProp("comment") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByList.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByList.py new file mode 100644 index 0000000000000000000000000000000000000000..cc6239d16be4f8c8ea7224e7e51098af7dce2d58 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByList.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") +list = ["order", "active"] +node.deleteProp(list) + +value1 = node.hasProp("order") +value2 = node.hasProp("active") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByName.py new file mode 100644 index 0000000000000000000000000000000000000000..50791e8fe036e07e0643f53c65a47599ea8e9bc2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeRemovePropertyPythonTest.shouldRemovePropertyByName.py @@ -0,0 +1,3 @@ +node = S(input, "application/json") +node.deleteProp("order") +value = node.hasProp("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingArray.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingArray.py new file mode 100644 index 0000000000000000000000000000000000000000..6e3cee89b7087f786c7edd3e57f1996be82962c7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingArray.py @@ -0,0 +1,7 @@ +class TestObject: + pass + +node = S(input, "application/json") +list = [TestObject()] + +node.prop("comment", list) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingObject.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingObject.py new file mode 100644 index 0000000000000000000000000000000000000000..3dd9d61458283ae73c48b7bc8729c3bf6b3d3591 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldFailWhileSettingObject.py @@ -0,0 +1,10 @@ +class TestObject: + pass + + +node = S(input, "application/json") +object = { + "date": TestObject() +} + +node.prop("comment", object) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceArrayProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceArrayProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..bc6875ef1c0945d282fc0411f398c8ae2a1ae1aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceArrayProperty.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") + +oldValue = node.prop("order") + +list = [ + "test", + "test2" +] + +node.prop("order", list) +newValue = node.prop("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceBooleanProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceBooleanProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..3dc58db1b88e69874025f29eeca5d3acd37643e0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceBooleanProperty.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") + +oldValue = node.prop("order").stringValue() + +node.prop("order", False) + +# Known jython issue. Boolean and boolean values are casted to long +# if a matching method is found first. +newValue = bool(node.prop("order").value()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceFloatProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceFloatProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..3922fd199d2c1a91fb783ee0bcdcb6770dd46d6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceFloatProperty.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") + +oldValue = node.prop("order").stringValue() + +node.prop("order", 42.00) +newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceIntegerProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceIntegerProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..1fc139c001cdda7ab6a2a2fb5d8de61b5f46ab97 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceIntegerProperty.py @@ -0,0 +1,7 @@ +node = S(input, "application/json") + +oldValue = node.prop("order").stringValue() + +node.prop("order", 42) + +newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceLongProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceLongProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..cdcf2c196d2ceabababe3d87761d338b6fdaf77a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceLongProperty.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") + +oldValue = node.prop("order").stringValue() + +node.prop("order", 4200000000) +newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceNullProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceNullProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..7ed0e0ee1db642c298d02eac203c2267ed6e2ba7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceNullProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") +node.prop("order", None) + +propertyNode = node.prop("order") +newValue = node.prop("order").value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceObjectProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceObjectProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..7a19be530f5cea0c8e3abb4854d0dbd9712c508a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceObjectProperty.py @@ -0,0 +1,11 @@ +node = S(input, "application/json") + +oldValue = node.prop("order") + +jsonObject = { + "name": "test", + "comment": "42!" +} + +node.prop("order", jsonObject) +newValue = node.prop("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceStringProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceStringProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..a974413e3f20ac9b0cc92bc78320ba20800dcf89 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldReplaceStringProperty.py @@ -0,0 +1,6 @@ +node = S(input, "application/json") + +oldValue = node.prop("order").stringValue() + +node.prop("order", "new Order") +newValue = node.prop("order").stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetArrayProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetArrayProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..dd540ae707daa470e850f42e3b1b7de24e8a1254 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetArrayProperty.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") +list = [ + "test", + "test2" +] +node.prop("comment", list) + +propertyNode = node.prop("comment") +value = propertyNode.elements().get(1).stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetBooleanProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetBooleanProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..dbaf3610424a2fbfda9cdab90b8d0642b3ca2ec1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetBooleanProperty.py @@ -0,0 +1,8 @@ +node = S(input, "application/json") +node.prop("comment", False) + +propertyNode = node.prop("comment") + +# Known jython issue. Boolean and boolean values are casted to long +# if a matching method is found first. +value = bool(propertyNode.value()) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetFloatProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetFloatProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..9541c2c74c1946756f77fe816b9300e82bdac295 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetFloatProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json"); +node.prop("comment", 42.00); + +propertyNode = node.prop("comment"); +value = propertyNode.numberValue(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetIntegerProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetIntegerProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..8ab5fbc9bfc1a8a4a30b5b374b4e8b1500805dda --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetIntegerProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") +node.prop("comment", 42) + +propertyNode = node.prop("comment") +value = propertyNode.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetLongProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetLongProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..dcd50a5be2c43efb57ea3ede7c4c6968138f8bb1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetLongProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") +node.prop("comment", 4200000000) + +propertyNode = node.prop("comment") +value = propertyNode.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetNullProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetNullProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..8197f7be95e3406cfeaa86d7df207df5100200c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetNullProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") +node.prop("comment", None) + +propertyNode = node.prop("comment") +newValue = node.prop("comment").value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetObjectProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetObjectProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..1809d2381b6ad1441aab11242054875b0deb5c76 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetObjectProperty.py @@ -0,0 +1,9 @@ +node = S(input, "application/json") +object = { + "name": "test", + "comment": "42!" +} +node.prop("comment", object) + +propertyNode = node.prop("comment") +value = propertyNode.prop("comment").stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetStringProperty.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetStringProperty.py new file mode 100644 index 0000000000000000000000000000000000000000..8cdaea88c4f5a949d857f240cd50ced20688ce8b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/python/json/tree/JsonTreeSetPropertyPythonTest.shouldSetStringProperty.py @@ -0,0 +1,5 @@ +node = S(input, "application/json") +node.prop("comment", "42!") + +propertyNode = node.prop("comment") +value = propertyNode.stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldBeIdempotent.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldBeIdempotent.rb new file mode 100644 index 0000000000000000000000000000000000000000..112be6601638ece5fbdca3ded5a0e48a396cdc3f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldBeIdempotent.rb @@ -0,0 +1,4 @@ +$wrappedJson = S($input, "application/json") + +$json = S($wrappedJson) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForReader.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForReader.rb new file mode 100644 index 0000000000000000000000000000000000000000..365dd0bc7db5531aa6eff6f823d44cb757991d03 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForReader.rb @@ -0,0 +1,5 @@ +$json1 = S($input1, org.camunda.spin.DataFormats.json()) + +$json2 = S($input2, "application/json") + +$json3 = S($input3) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForString.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForString.rb new file mode 100644 index 0000000000000000000000000000000000000000..20aa0a3a0ac069b99aff0c95ee01c76abd4129f5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeCreateRubyTest.shouldCreateForString.rb @@ -0,0 +1,5 @@ +$json1 = S($input, org.camunda.spin.DataFormats.json()) + +$json2 = S($input, "application/json") + +$json3 = S($input) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldAppendNodeToArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldAppendNodeToArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..d49d871ea585b366051206c15b4f51fe29143137 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldAppendNodeToArray.rb @@ -0,0 +1,9 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() + +currencies.append("Testcustomer") + +$newSize = currencies.elements().size() +$value = currencies.elements().get($oldSize).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendNullNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendNullNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..fef622558b250b5002f414c4c54b5d91cc4ce33c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendNullNode.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +customers = node.prop("customers") + +customers.append(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendToNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendToNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..3e0a53ce4b4e1debec2c4b92ea73892758744f03 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendToNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.append("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendWrongNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendWrongNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..4af8f429ac3c066adfa683eacb9d13bbc2fd0f10 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailAppendWrongNode.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +customers = node.prop("customers") + +customers.append(Date.today) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterNonExistentSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterNonExistentSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..b7f0a045ebd26e7ab332385bc862da4360d40301 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterNonExistentSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("test", "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterOnNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterOnNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..6554595b75a4c0fad2cc9e2d1891aa7402ac3bfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterOnNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.insertAfter("euro", "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWithNullAsSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWithNullAsSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..8b6ca387bd433ec1d51670433c001d55707a88bb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWithNullAsSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter(nil, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWrongSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWrongSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..7035e8e7531cd8f2deb9391cb93fb95a59fd8648 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAfterWrongSearchObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter(Date.today, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..8785d2487a2430d673733ef44b46794f605b64ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.insertAt(1, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithIndexOutOfBounds.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithIndexOutOfBounds.rb new file mode 100644 index 0000000000000000000000000000000000000000..d45b395d658e279610494aae4ee93f5c8b003dec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithIndexOutOfBounds.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAt(6, "test1") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.rb new file mode 100644 index 0000000000000000000000000000000000000000..bd3f93dc7fc6bcad54040ebfe7e10bd87ec1c39a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNegativeIndexOutOfBounds.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAt(-6, "test1") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNullObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNullObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..b6334abd826f513660aafc6fb0251715bcaa872e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithNullObject.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") +customers = node.prop("customers") +customers.insertAt(1, nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithWrongObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithWrongObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..40cdcb36b38d5b524f6a1d3ca5be95c41602a748 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertAtWithWrongObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +customers = node.prop("customers") + +customers.insertAt(1, Date.today) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeNonExistentSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeNonExistentSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..d1a971af2d07a33579ffa08c7b14b8978426771a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeNonExistentSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("test", "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeOnNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeOnNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..4f47afd57df0f17ebe12c8d2a0b6ca8fc0314139 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeOnNonArray.rb @@ -0,0 +1,2 @@ +node = S($input, "application/json") +node.insertBefore("euro", "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWithNullAsSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWithNullAsSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..c4bf6edf41e3fefb71a87e032578eb5479e011b6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWithNullAsSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore(nil, "test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWrongSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWrongSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..ea197f9d6b965e941a292f15f63b8c8f81878631 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertBeforeWrongSearchObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore(Date.today, "test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectAfterSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectAfterSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..ddf22d28d55033264c34ad02260ebbc17e5ee3d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectAfterSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("euro", nil) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectBeforeSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectBeforeSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..117df7ee160b7859e72a1f892cc7dab620ef9aec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertNullObjectBeforeSearchObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("euro", nil) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectAfterSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectAfterSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..2183db6b9817501f6cbe798730f5b6232f04510a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectAfterSearchObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertAfter("euro", Date.today) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectBeforeSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectBeforeSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..76f50971731517351227055324a511dd464307e2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailInsertWrongObjectBeforeSearchObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.insertBefore("euro", Date.today) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..e4d37af2fb6dc831fbedfa74169c8685c51f31c8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.indexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonExistentValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonExistentValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..79595d39e21d63412682c3250b86ae7fe947f38d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfNonExistentValue.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.prop("customers").indexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfWithoutSearchNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfWithoutSearchNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..f54843117c6e58c4caf56f56d2caa2509496951a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadIndexOfWithoutSearchNode.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.prop("customers").indexOf(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..1a40147e7158891d8b2c0d0768a9fef6845f090f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.lastIndexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonExistentValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonExistentValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..e7f7844b846ba9f2e8766e3214574ea09a66df9c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfNonExistentValue.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.prop("customers").lastIndexOf("test") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfWithoutSearchNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfWithoutSearchNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..65facf1d8fa0c0c5d060c714d02290c295d02d88 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailReadLastIndexOfWithoutSearchNode.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.prop("customers").lastIndexOf(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..e86bc9fe452eb72d1a839ddc1fb891d6d0840675 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.removeAt(1) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithIndexOutOfBounds.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithIndexOutOfBounds.rb new file mode 100644 index 0000000000000000000000000000000000000000..9c7642d7ae67dbbb075e3afb43c5f6da4692b385 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithIndexOutOfBounds.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeAt(6) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.rb new file mode 100644 index 0000000000000000000000000000000000000000..6f6bcfdc7c3474042fdcd7905b9ed0ec769d91a9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveAtWithNegativeIndexOutOfBounds.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeAt(-6) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..a22d9edc0030eafdf075fe42c46822f465242d6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonExistentObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonExistentObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..7073d1e1dbc7dcca46b4a1f3e4df26f993e6cc0c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNonExistentObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.removeLast("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNullObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNullObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..0183d443b534b9d1f676c28d59389d6fa2723130 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastNullObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +customers = node.prop("customers") + +customers.removeLast(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastWrongObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastWrongObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..cd2093d563ceb214720604af15c3a2c883ce9532 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveLastWrongObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +customers = node.prop("customers") + +customers.removeLast(Date.today) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..a22d9edc0030eafdf075fe42c46822f465242d6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonArray.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +node.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonExistentObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonExistentObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..07401a30b3ed5fced8f0d3ab6874476cdfdf31a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNonExistentObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +currencies.remove("test") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNullObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNullObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..f7f53754a8c79992048f00c3648ba1a23a3d5900 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveNullObject.rb @@ -0,0 +1,4 @@ +node = S($input, "application/json") +customers = node.prop("customers") + +customers.remove(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveWrongObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveWrongObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..6a80d5e62fb40833c135dc210ba7ed349550486f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldFailRemoveWrongObject.rb @@ -0,0 +1,6 @@ +require 'date' + +node = S($input, "application/json") +customers = node.prop("customers") + +customers.remove(Date.today) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAfterSearchObjectOnEnding.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAfterSearchObjectOnEnding.rb new file mode 100644 index 0000000000000000000000000000000000000000..9b220a9e77d8faaebe45699442cff69b109892ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAfterSearchObjectOnEnding.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldValue = currencies.elements().get(1).stringValue() + +currencies.insertAfter($oldValue, "Test") + +$newSize = currencies.elements().size() +$newValue = currencies.elements().get(2).stringValue() +$oldValueOnNewPosition = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithIndex.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithIndex.rb new file mode 100644 index 0000000000000000000000000000000000000000..653bb3d798a6160b2d056f46557068b9283d8282 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithIndex.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldPosition = currencies.indexOf("dollar") + +currencies.insertAt(1, "test1") + +$newSize = currencies.elements().size() +$newPosition = currencies.indexOf("dollar") +$value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithNegativeIndex.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithNegativeIndex.rb new file mode 100644 index 0000000000000000000000000000000000000000..e33a222dd0a76049310a413f718c9c6f52855a75 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertAtWithNegativeIndex.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldPosition = currencies.indexOf("dollar") + +currencies.insertAt(-1, "test1") + +$newSize = currencies.elements().size() +$newPosition = currencies.indexOf("dollar") +$value = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..6237566c7f6035c9700908b26c3cb571920a8a99 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObject.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldValue = currencies.elements().get(1).stringValue() + +currencies.insertBefore($oldValue, "Test") + +$newSize = currencies.elements().size() +$newValue = currencies.elements().get(1).stringValue() +$oldValueOnNewPosition = currencies.elements().get(2).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObjectOnBeginning.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObjectOnBeginning.rb new file mode 100644 index 0000000000000000000000000000000000000000..e5fe588a76af017e98426e31b355f508b5f274f7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldInsertBeforeSearchObjectOnBeginning.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldValue = currencies.elements().get(0).stringValue() + +currencies.insertBefore($oldValue, "Test") + +$newSize = currencies.elements().size() +$newValue = currencies.elements().get(0).stringValue() +$oldValueOnNewPosition = currencies.elements().get(1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadIndexOf.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadIndexOf.rb new file mode 100644 index 0000000000000000000000000000000000000000..223ca8e44946b52ac9b17353082fce65a99e26eb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadIndexOf.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +currencies = node.prop("orderDetails").prop("currencies") + +$value = currencies.indexOf("dollar") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadLastIndexOf.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadLastIndexOf.rb new file mode 100644 index 0000000000000000000000000000000000000000..a090ac0382c0e1f932c32ad409aee2e9ddc646d2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldReadLastIndexOf.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +currencies = node.prop("orderDetails").prop("currencies") + +$value = currencies.lastIndexOf("dollar") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithIndex.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithIndex.rb new file mode 100644 index 0000000000000000000000000000000000000000..24501a388876e2a94964aee2abf00030f811ec26 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithIndex.rb @@ -0,0 +1,9 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() + +currencies.removeAt(1) + +$newSize = currencies.elements().size() +$value = currencies.elements().get($newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithNegativeIndex.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithNegativeIndex.rb new file mode 100644 index 0000000000000000000000000000000000000000..0a31d6286faf35a6f7a0fbcc7e46f385d1ce6a11 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveAtWithNegativeIndex.rb @@ -0,0 +1,9 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() + +currencies.removeAt(-2) + +$newSize = currencies.elements().size() +$value = currencies.elements().get($newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveLast.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveLast.rb new file mode 100644 index 0000000000000000000000000000000000000000..b566f695e399323c539c6807571c21d1f16630f2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveLast.rb @@ -0,0 +1,9 @@ +node = S($input, "application/json") + +$oldSize = node.elements().size() +$oldValue = node.elements().get($oldSize - 1).stringValue() + +node.removeLast("test") + +$newSize = node.elements().size() +$newValue = node.elements().get($newSize - 1).stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..e860acd196958e0da1c906413716a474e8b283ef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeEditListPropertyRubyTest.shouldRemoveObject.rb @@ -0,0 +1,10 @@ +node = S($input, "application/json") +currencies = node.prop("orderDetails").prop("currencies") + +$oldSize = currencies.elements().size() +$oldValue = currencies.elements().get(0).stringValue() + +currencies.remove("euro") + +$newValue = currencies.elements().get(0).stringValue() +$newSize = currencies.elements().size() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailAccessNonExistentProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailAccessNonExistentProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..a22c03205b368cbf550c66ba70f7a7678ea6158a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailAccessNonExistentProperty.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.order.task').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingBoolean.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingBoolean.rb new file mode 100644 index 0000000000000000000000000000000000000000..a64f142e880be0e1bda439efaf30cafe28df5050 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingBoolean.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.order').boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingElementList.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingElementList.rb new file mode 100644 index 0000000000000000000000000000000000000000..1597645976c4b95a0505f2523ed444c264c61ceb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingElementList.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.order').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..1b4ae74b8d6f52415220c960d112f7d9fe27bdaf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.....').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingNumber.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingNumber.rb new file mode 100644 index 0000000000000000000000000000000000000000..b9325a610009034a5cdcdf13fdb29cc77885b03b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingNumber.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.active').numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingString.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingString.rb new file mode 100644 index 0000000000000000000000000000000000000000..5a0af35afa7b179f8b263bd19b8f2a52757d1e73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldFailReadingString.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +jsonNode.jsonPath('$.id').stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetBooleanFromJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetBooleanFromJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..a440df677f8a398ff3d9d889d1c0897e28c8f958 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetBooleanFromJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$booleanValue = jsonNode.jsonPath('$.active').boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementFromJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementFromJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..984bab48c46a9ad601c05bf03cd91c9681448b81 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementFromJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$node = jsonNode.jsonPath('$.orderDetails').element() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementListFromJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementListFromJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..00dfdba4cf0b09482e36d54e0f20c3c505b5ead4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetElementListFromJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$nodeList = jsonNode.jsonPath('$.customers').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetFilteredResult.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetFilteredResult.rb new file mode 100644 index 0000000000000000000000000000000000000000..184bb2e541ec1f36418a15e4e2df0288e2b1c4bc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetFilteredResult.rb @@ -0,0 +1,4 @@ +jsonNode = S($input, "application/json") + +$emptyList = jsonNode.jsonPath("customers[?(@.name == 'Klo')]").elementList() +$nodeList = jsonNode.jsonPath("customers[?(@.name == 'Waldo')]").elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetMultipleArrayEntries.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetMultipleArrayEntries.rb new file mode 100644 index 0000000000000000000000000000000000000000..325ecf23f891d83167504cf538f9261fa90b641b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetMultipleArrayEntries.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$nodeList = jsonNode.jsonPath('$.customers[0:2]').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetNumberFromJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetNumberFromJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..293a44f3cfe38fdf82311987197d8e6b7c83085e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetNumberFromJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$numberValue = jsonNode.jsonPath('$.orderDetails.price').numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetSingleArrayEntry.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetSingleArrayEntry.rb new file mode 100644 index 0000000000000000000000000000000000000000..a3bc2c068e56c3d829ad86085777894a928f7e87 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetSingleArrayEntry.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$node = jsonNode.jsonPath('$.customers[0]').element() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetStringFromJsonPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetStringFromJsonPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..e15194fc2bd641d4eac2dd97c4343e2551757e22 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.shouldGetStringFromJsonPath.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$stringValue = jsonNode.jsonPath('$.order').stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.souldGetMultipleArrayPropertyValues.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.souldGetMultipleArrayPropertyValues.rb new file mode 100644 index 0000000000000000000000000000000000000000..f9b4e1333948a582d3b2ab32cac9f104e8b9ff45 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeJsonPathRubyTest.souldGetMultipleArrayPropertyValues.rb @@ -0,0 +1,3 @@ +jsonNode = S($input, "application/json") + +$nodeList = jsonNode.jsonPath('$.customers[*].name').elementList() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.rb new file mode 100644 index 0000000000000000000000000000000000000000..24c59c5f9fcad629ec6500509fb56b16b3394061 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToCollection.rb @@ -0,0 +1,4 @@ +desiredType = com.fasterxml.jackson.databind.type.TypeFactory.defaultInstance().constructCollectionType($collectionType, $mapToType) + +$result = S($input, "application/json").mapTo(desiredType.toCanonical()) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.rb new file mode 100644 index 0000000000000000000000000000000000000000..9af38f74ec603aef6a665f1c60baa9dd4ef18080 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapJsonToJavaScriptTest.mapToType.rb @@ -0,0 +1 @@ +$result = S($input).mapTo($mapToType) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapDictionary.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapDictionary.rb new file mode 100644 index 0000000000000000000000000000000000000000..a51593c9da6c4295ba7c1bce3b5c4d99eefb65ac --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapDictionary.rb @@ -0,0 +1,13 @@ +def customer(name, date) + return {"name" => name, "contractStartDate" => date} +end + +order = {"order" => "order1", "dueUntil" => 20150112, "id" => 1234567890987654321, "active" => true, "nullValue" => nil} + +customers = [customer("Kermit", 1354539722), customer("Waldo", 1320325322), customer("Johnny", 1286110922)] +order["customers"] = customers + +orderDetails = {"article" => "camundaBPM", "price" => 1234567.13, "roundedPrice" => 1234567, "currencies" => ["euro", "dollar"], "paid" => false} +order["orderDetails"] = orderDetails + +$json = S(order, "application/json").toString() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapPrimitives.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapPrimitives.rb new file mode 100644 index 0000000000000000000000000000000000000000..736108b517e4759193be4dcf09c6b2865311c4d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeMapObjectToJsonRubyTest.shouldMapPrimitives.rb @@ -0,0 +1,7 @@ +$stringVar = S('"a String"', "application/json") + +$booleanVar = S(false, "application/json") + +$integerVar = S(42, "application/json") + +$listVar = S(["Waldo", "Hugo", "Kermit"], "application/json") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldBeSameAsJavaValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldBeSameAsJavaValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..197f11bf4a2f419d4b3ad1542eed85a975932fa9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldBeSameAsJavaValue.rb @@ -0,0 +1,10 @@ +$node = S($input, "application/json") +$childNode = $node.prop("orderDetails") + +$property1 = $node.prop("order") +$property2 = $childNode.prop("price") +$property3 = $node.prop("active") + +$stringValue = $property1.stringValue() +$numberValue = $property2.numberValue() +$boolValue = $property3.boolValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckArrayValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckArrayValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..cd75812d2ea70bce85cf692c1b08074064e92d49 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckArrayValue.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") + +property1 = node.prop('order') +property2 = node.prop('id') +property3 = node.prop('customers') +property4 = node.prop('orderDetails') +property5 = node.prop('active') + +$value1 = property1.isArray() +$value2 = property2.isArray() +$value3 = property3.isArray() +$value4 = property4.isArray() +$value5 = property5.isArray() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckBooleanValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckBooleanValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..67e382d486a213d2e080931221a45003252aa892 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckBooleanValue.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") + +property1 = node.prop('order') +property2 = node.prop('id') +property3 = node.prop('customers') +property4 = node.prop('orderDetails') +property5 = node.prop('active') + +$value1 = property1.isBoolean() +$value2 = property2.isBoolean() +$value3 = property3.isBoolean() +$value4 = property4.isBoolean() +$value5 = property5.isBoolean() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckNumberValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckNumberValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..b165e305ae0bcaa7e4ff140c1d08bffadee18de4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckNumberValue.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") + +property1 = node.prop('order') +property2 = node.prop('id') +property3 = node.prop('customers') +property4 = node.prop('orderDetails') +property5 = node.prop('active') + +$value1 = property1.isNumber() +$value2 = property2.isNumber() +$value3 = property3.isNumber() +$value4 = property4.isNumber() +$value5 = property5.isNumber() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckStringValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckStringValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..3c5091a7df13c2d39728a0e86d415d214f945b6d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckStringValue.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") + +property1 = node.prop('order') +property2 = node.prop('id') +property3 = node.prop('customers') +property4 = node.prop('orderDetails') +property5 = node.prop('active') + +$value1 = property1.isString() +$value2 = property2.isString() +$value3 = property3.isString() +$value4 = property4.isString() +$value5 = property5.isString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..8d1e8f44a3a603e3d5171f3330207cf4c2630c8a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldCheckValue.rb @@ -0,0 +1,7 @@ +node = S($input, "application/json") + +property1 = node.prop('order') +property2 = node.prop('dueUntil') + +$value1 = property1.value() +$value2 = property2.value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..839042c49e54ab41ead35aaa21f30422e4f20a9e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property = node.prop('customers') + +$value = property.value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject2.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject2.rb new file mode 100644 index 0000000000000000000000000000000000000000..73b355f8562a5a3987772ec301475fc78993c1bc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToCheckObject2.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property = node.prop('orderDetails') + +$value = property.value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadBooleanValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadBooleanValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..8843ca273c2a76febbcfc74220a29b3e88444a56 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadBooleanValue.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property1 = node.prop("order") + +$value1 = property1.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadNumberValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadNumberValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..e6a1eb716966bc86745d0c57770744b7c0a9bb2a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadNumberValue.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property1 = node.prop("active") + +$value1 = property1.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadObjectInNonArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadObjectInNonArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..350ff60df87bc1f8284b9fb39c3856d07f4ab45a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadObjectInNonArray.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property = node.prop('order') + +$value = property.elements() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..9dfc6312688a3f60a666d314c7df57e3aec7a809 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +$property = node.prop('42') \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty2.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty2.rb new file mode 100644 index 0000000000000000000000000000000000000000..cbab8a707120f4fd4b9c3c39e83cb50938955e04 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadProperty2.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") + +$property = node.prop(nil) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadStringValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadStringValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..3f135aa8392436cd6bd17cd379638e0f97259a0a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldFailToReadStringValue.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property1 = node.prop("active") + +$value1 = property1.stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadBooleanValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadBooleanValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..6c9ae20e33cf49067095c09e7661680aea8a1503 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadBooleanValue.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +property1 = node.prop("active") + +$value1 = property1.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..d82431f99cbd140f868b637069bc2d5518b0e2c4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNode.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") +$childNode = node.prop("orderDetails") + +$property = $childNode.prop("article") + +$value = $property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNodeProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNodeProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..f2f10b955d8a899547ac7a038f87a8b76c8f9aa4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadChildNodeProperty.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") +childNode = node.prop("orderDetails") +childNode2 = childNode.prop("currencies") +list = childNode2.elements() + +$property1 = childNode.prop("roundedPrice") +$property2 = list.get(1) + +$value1 = $property1.numberValue() +$value2 = $property2.stringValue() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadListOfNodes.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadListOfNodes.rb new file mode 100644 index 0000000000000000000000000000000000000000..d0942cfdd83e62cea47a746a6407c35bd45009c5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadListOfNodes.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") +list = node.fieldNames() + +$value1 = list.get(0) +$value2 = list.get(1) +$value3 = list.get(4) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadNumberValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadNumberValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..b6b96a10c8ad34d9a4f38a8b091b1b89e07fbdfa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadNumberValue.rb @@ -0,0 +1,10 @@ +$node = S($input, "application/json") +$childNode1 = $node.prop("orderDetails") + +$property1 = $node.prop("dueUntil") +$property2 = $node.prop("id") +$property3 = $childNode1.prop("price") + +$value1 = $property1.numberValue() +$value2 = $property2.numberValue() +$value3 = $property3.numberValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadObjectInArrayChildNode.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadObjectInArrayChildNode.rb new file mode 100644 index 0000000000000000000000000000000000000000..061234b10b656e08ac18293bd92e1931aa73af65 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadObjectInArrayChildNode.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") +childNode = node.prop("customers") +list = childNode.elements() + +$property1 = list.get(0) +$property2 = list.get(1) + +customer1 = $property1.prop("name") +customer2 = $property2.prop("name") + +$value1 = customer1.stringValue() +$value2 = customer2.stringValue() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..a76641e10dff2e241ec04fd0cc0fce3faee6a8ea --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") + +$property = node.prop("order") + +$value = $property.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadTextValue.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadTextValue.rb new file mode 100644 index 0000000000000000000000000000000000000000..0f24cfab04696ad5f71ab374b42b1e6e2b4e5a3a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeReadPropertyRubyTest.shouldReadTextValue.rb @@ -0,0 +1,13 @@ +node = S($input, "application/json") +childNode1 = node.prop("customers") +childNode2 = node.prop("orderDetails") +list = childNode1.elements() +customerNode = list.get(0) + +property1 = node.prop("order") +property2 = customerNode.prop("name") +property3 = childNode2.prop("article") + +$value1 = property1.stringValue() +$value2 = property2.stringValue() +$value3 = property3.stringValue() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByList.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByList.rb new file mode 100644 index 0000000000000000000000000000000000000000..26686e343980813d57e46a9626aa3b18570f925b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByList.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") +list = ["order", "comment"] +node.deleteProp(list) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..cea1d6a446d19567f1a360de067774d1095d93bc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldFailWhileRemovingPropertyByName.rb @@ -0,0 +1,2 @@ +node = S($input, "application/json") +node.deleteProp("comment") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByList.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByList.rb new file mode 100644 index 0000000000000000000000000000000000000000..5a957f1cf40ad9c945273b3b5730b3e5feb5e8d9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByList.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") +list = ["order", "active"] +node.deleteProp(list) + +$value1 = node.hasProp("order") +$value2 = node.hasProp("active") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..f762abf3c589f6c6520db875bba0fbc12ba64b57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeRemovePropertyRubyTest.shouldRemovePropertyByName.rb @@ -0,0 +1,3 @@ +node = S($input, "application/json") +node.deleteProp("order") +$value = node.hasProp("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingArray.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingArray.rb new file mode 100644 index 0000000000000000000000000000000000000000..015352a3fc7c119950d2ed0412139942b7068324 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingArray.rb @@ -0,0 +1,5 @@ +require 'date' +node = S($input, "application/json") +list = [Date.today] + +node.prop("comment", list) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingObject.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingObject.rb new file mode 100644 index 0000000000000000000000000000000000000000..de4da550eeec4d374389dc8ff50a10007697d1f8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldFailWhileSettingObject.rb @@ -0,0 +1,7 @@ +require 'date' +node = S($input, "application/json") +object = { + "date" => Date.today +} + +node.prop("comment", object) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceArrayProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceArrayProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..7b8f37445aa1d2b4e0fbca209883d499ff879244 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceArrayProperty.rb @@ -0,0 +1,8 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order") + +list = ["test", "test2"] + +node.prop("order", list) +$newValue = node.prop("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceBooleanProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceBooleanProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..193fe59db605e90347f5b3e599a3ae5964261d15 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceBooleanProperty.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order").stringValue() + +node.prop("order", false) +$newValue = node.prop("order").boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceFloatProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceFloatProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..0806f9557fe1d0fdaab57967f7b9e59e3bf8f695 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceFloatProperty.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order").stringValue() + +node.prop("order", 42.00) +$newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceIntegerProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceIntegerProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..053790815bcbaf60d3a524f62e6e4a4641c91731 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceIntegerProperty.rb @@ -0,0 +1,7 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order").stringValue() + +node.prop("order", 42) + +$newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceLongProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceLongProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..d81eb7af2d8caeb0db9a438097b07b647749548b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceLongProperty.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order").stringValue() + +node.prop("order", 4200000000) +$newValue = node.prop("order").numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceNullProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceNullProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..66eef56f878242656d7efd61017457a4eda3ed54 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceNullProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("order", nil) + +$propertyNode = node.prop("order") +$newValue = node.prop("order").value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceObjectProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceObjectProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..fc5f50f186e936e0266e9c15e71cd9092f3003bc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceObjectProperty.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order") + +json_object = { + "name" => "test", + "comment" => "42!" +} + +node.prop("order", json_object) +$newValue = node.prop("order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceStringProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceStringProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..66243e388418c2088827eab94a55f2e81c2bb664 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldReplaceStringProperty.rb @@ -0,0 +1,6 @@ +node = S($input, "application/json") + +$oldValue = node.prop("order").stringValue() + +node.prop("order", "new Order") +$newValue = node.prop("order").stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetArrayProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetArrayProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..87b1799b4da4c6d8f0ec38dc892467c9b9e9b24f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetArrayProperty.rb @@ -0,0 +1,9 @@ +node = S($input, "application/json") +list = [ + "test", + "test2" +] +node.prop("comment", list) + +$propertyNode = node.prop("comment") +$value = $propertyNode.elements().get(1).stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetBooleanProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetBooleanProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..a8272f8d15c346fbeae83831b1e21c348b15763a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetBooleanProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", false) + +$propertyNode = node.prop("comment") +$value = $propertyNode.boolValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetFloatProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetFloatProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..56ab6435f1cb8364923eb5eea801467a91a4ed0b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetFloatProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", 42.00) + +$propertyNode = node.prop("comment") +$value = $propertyNode.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetIntegerProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetIntegerProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..7de0d2988fa552fb7462a532d555f103756b3523 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetIntegerProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", 42) + +$propertyNode = node.prop("comment") +$value = $propertyNode.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetLongProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetLongProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..9ecf990c3702152820c1bc803a269c494453b6a8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetLongProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", 4200000000) + +$propertyNode = node.prop("comment") +$value = $propertyNode.numberValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetNullProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetNullProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..79325c59bb05979367477f9520470ffbdbf07232 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetNullProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", nil) + +$propertyNode = node.prop("comment") +$newValue = node.prop("comment").value() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetObjectProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetObjectProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..b7d2d8cedc09ee61f6e155dde619105348253916 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetObjectProperty.rb @@ -0,0 +1,11 @@ +node = S($input, "application/json") + +testobject = { + "name" => "test", + "comment" => "42!" +} + +node.prop("comment", testobject) + +$propertyNode = node.prop("comment") +$value = $propertyNode.prop("comment").stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetStringProperty.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetStringProperty.rb new file mode 100644 index 0000000000000000000000000000000000000000..9211a9ae3e2efc7e439b0ac2e1befebc6568faf4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-json-jackson/src/test/resources/org/camunda/spin/ruby/json/tree/JsonTreeSetPropertyRubyTest.shouldSetStringProperty.rb @@ -0,0 +1,5 @@ +node = S($input, "application/json") +node.prop("comment", "42!") + +$propertyNode = node.prop("comment") +$value = $propertyNode.stringValue() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/pom.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e78bf59e00b7a2b4437cf942cbc15a90b3ac6190 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/pom.xml @@ -0,0 +1,260 @@ + + 4.0.0 + + + Note: 7.24.0 is the last community edition release published on Maven Central. This library will not receive any new versions or releases. However, if you are interested in extended maintenance you could look into our enterprise edition. Get in touch with us: https://camunda.com/contact/ + + + + org.camunda.spin + camunda-spin-root + 7.24.0-SNAPSHOT + + + camunda-spin-dataformat-xml-dom + camunda Spin - DOM XML data format + + + + org.camunda.spin + camunda-spin-core + + + + org.camunda.commons + camunda-commons-logging + + + + org.camunda.commons + camunda-commons-utils + + + + junit + junit + test + + + + org.assertj + assertj-core + test + + + + org.apache.groovy + groovy-jsr223 + test + + + + org.apache.groovy + groovy-xml + test + + + + org.python + jython + test + + + + org.jruby + jruby-complete + test + + + + org.graalvm.js + js + test + + + + org.graalvm.js + js-scriptengine + test + + + + ch.qos.logback + logback-classic + test + + + + org.powermock + powermock-module-junit4 + test + + + + org.powermock + powermock-api-mockito2 + test + + + + org.camunda.spin + camunda-spin-core + test-jar + test + + + + + + jdk-9-and-onwards + + [9,) + + + + jakarta.xml.bind + jakarta.xml.bind-api + provided + + + + com.sun.xml.bind + jaxb-impl + test + + + + + + disable-javascript-tests + + (,1.8) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -XX:PermSize=128m -Duser.timezone=GMT+02:00 + + **/javascript/** + + + + + + + + + jdk-15-and-onwards + + [15,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/nashorn/** + + + + + + + + + jdk-16-and-onwards + + [16,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + -XX:MetaspaceSize=128m + + + **/nashorn/** + + + + + + + + + + check-api-compatibility + + (,) + + + + + org.codehaus.mojo + clirr-maven-plugin + 2.8 + + ${spin.version.old} + true + + org/camunda/spin/impl/** + + + + + all + verify + + check-no-fork + + + ${project.build.directory}/clirr-all.txt + false + false + + + + restrictive + verify + + check-no-fork + + + ${project.build.directory}/clirr-restrictive.txt + true + ../.clirr-jenkins-ignore.xml + + + + + + + + + + + + + org.apache.felix + maven-bundle-plugin + + + bundle-manifest + process-classes + + manifest + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttribute.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttribute.java new file mode 100644 index 0000000000000000000000000000000000000000..ae41616ff5c1083f7c73ce181639a61741bfd24f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttribute.java @@ -0,0 +1,132 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import java.io.IOException; +import java.io.Writer; + +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.spi.DataFormatMapper; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +/** + * Wrapper of a xml dom attribute. + * + * @author Sebastian Menski + */ +public class DomXmlAttribute extends SpinXmlAttribute { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + protected final Attr attributeNode; + + protected final DomXmlDataFormat dataFormat; + + /** + * Create a new wrapper. + * + * @param attributeNode the dom xml attribute to wrap + * @param dataFormat the xml dom data format + */ + public DomXmlAttribute(Attr attributeNode, DomXmlDataFormat dataFormat) { + this.attributeNode = attributeNode; + this.dataFormat = dataFormat; + } + + public String getDataFormatName() { + return dataFormat.getName(); + } + + public Attr unwrap() { + return attributeNode; + } + + public String name() { + return attributeNode.getLocalName(); + } + + public String namespace() { + return attributeNode.getNamespaceURI(); + } + + public String prefix() { + return attributeNode.getPrefix(); + } + + public boolean hasPrefix(String prefix) { + String attributePrefix = attributeNode.getPrefix(); + if(attributePrefix == null) { + return prefix == null; + } else { + return attributePrefix.equals(prefix); + } + } + + public boolean hasNamespace(String namespace) { + String attributeNamespace = attributeNode.getNamespaceURI(); + if (attributeNamespace == null) { + return namespace == null; + } + else { + return attributeNamespace.equals(namespace); + } + } + + public String value() { + return attributeNode.getValue(); + } + + public SpinXmlAttribute value(String value) { + if (value == null) { + throw LOG.unableToSetAttributeValueToNull(namespace(), name()); + } + attributeNode.setValue(value); + return this; + } + + public SpinXmlElement remove() { + Element ownerElement = attributeNode.getOwnerElement(); + ownerElement.removeAttributeNode(attributeNode); + return dataFormat.createElementWrapper(ownerElement); + } + + public String toString() { + return value(); + } + + public void writeToWriter(Writer writer) { + try { + writer.write(toString()); + } catch (IOException e) { + throw LOG.unableToWriteAttribute(this, e); + } + } + + public C mapTo(Class javaClass) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(this, javaClass); + } + + public C mapTo(String javaClass) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(this, javaClass); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeIterable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeIterable.java new file mode 100644 index 0000000000000000000000000000000000000000..3eff240a9ad89c66c5b619aabf07575c620bb6f4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeIterable.java @@ -0,0 +1,72 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.w3c.dom.Attr; +import org.w3c.dom.NodeList; + +import java.util.Iterator; + +/** + * @author Sebastian Menski + */ +public class DomXmlAttributeIterable implements Iterable { + + protected final NodeList nodeList; + protected final DomXmlDataFormat dataFormat; + protected final String namespace; + protected final boolean validating; + + public DomXmlAttributeIterable(NodeList nodeList, DomXmlDataFormat dataFormat) { + this.nodeList = nodeList; + this.dataFormat = dataFormat; + this.namespace = null; + validating = false; + } + + public DomXmlAttributeIterable(NodeList nodeList, DomXmlDataFormat dataFormat, String namespace) { + this.nodeList = nodeList; + this.dataFormat = dataFormat; + this.namespace = namespace; + validating = true; + } + + public Iterator iterator() { + return new DomXmlNodeIterator() { + + private NodeList attributes = nodeList; + + protected int getLength() { + return attributes.getLength(); + } + + protected SpinXmlAttribute getCurrent() { + if (attributes != null) { + Attr attribute = (Attr) attributes.item(index); + SpinXmlAttribute current = dataFormat.createAttributeWrapper(attribute); + if (!validating || (current.hasNamespace(namespace))) { + return current; + } + } + return null; + } + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeMapIterable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeMapIterable.java new file mode 100644 index 0000000000000000000000000000000000000000..730bd6a3cc1bd579ad8358b137574c69d4679c23 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlAttributeMapIterable.java @@ -0,0 +1,73 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; + +import java.util.Iterator; + +/** + * @author Sebastian Menski + */ +public class DomXmlAttributeMapIterable implements Iterable { + + protected final Element domElement; + protected final DomXmlDataFormat dataFormat; + protected final String namespace; + protected final boolean validating; + + public DomXmlAttributeMapIterable(Element domElement, DomXmlDataFormat dataFormat) { + this.domElement = domElement; + this.dataFormat = dataFormat; + this.namespace = null; + validating = false; + } + + public DomXmlAttributeMapIterable(Element domElement, DomXmlDataFormat dataFormat, String namespace) { + this.domElement = domElement; + this.dataFormat = dataFormat; + this.namespace = namespace; + validating = true; + } + + public Iterator iterator() { + return new DomXmlNodeIterator() { + + private NamedNodeMap attributes = domElement.getAttributes(); + + protected int getLength() { + return attributes.getLength(); + } + + protected SpinXmlAttribute getCurrent() { + if (attributes != null) { + Attr attribute = (Attr) attributes.item(index); + SpinXmlAttribute current = dataFormat.createAttributeWrapper(attribute); + if (!validating || (current.hasNamespace(namespace))) { + return current; + } + } + return null; + } + }; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElement.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElement.java new file mode 100644 index 0000000000000000000000000000000000000000..c07d73c744ddf76e6ee6531fad277f01aef42751 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElement.java @@ -0,0 +1,410 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; +import static org.camunda.commons.utils.EnsureUtil.ensureParamInstanceOf; +import static org.camunda.spin.impl.xml.dom.util.DomXmlEnsure.ensureChildElement; + +import java.io.StringWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import javax.xml.transform.Transformer; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathFactory; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.SpinListImpl; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.impl.xml.dom.query.DomXPathQuery; +import org.camunda.spin.spi.DataFormatMapper; +import org.camunda.spin.xml.SpinXPathQuery; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * Wrapper for an xml dom element. + * + * @author Sebastian Menski + */ +public class DomXmlElement extends SpinXmlElement { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + protected static Transformer cachedTransformer = null; + + protected static XPathFactory cachedXPathFactory; + + protected final Element domElement; + protected final DomXmlDataFormat dataFormat; + + public DomXmlElement(Element domElement, DomXmlDataFormat dataFormat) { + this.domElement = domElement; + this.dataFormat = dataFormat; + } + + public String getDataFormatName() { + return dataFormat.getName(); + } + + public Element unwrap() { + return domElement; + } + + public String name() { + return domElement.getLocalName(); + } + + public String namespace() { + return domElement.getNamespaceURI(); + } + + public String prefix() { + return domElement.getPrefix(); + } + + public boolean hasPrefix(String prefix) { + String elementPrefix = prefix(); + if(elementPrefix == null) { + return prefix == null; + } else { + return elementPrefix.equals(prefix); + } + } + + public boolean hasNamespace(String namespace) { + String elementNamespace = namespace(); + if (elementNamespace == null) { + return namespace == null; + } + else { + return elementNamespace.equals(namespace); + } + } + + public SpinXmlAttribute attr(String attributeName) { + return attrNs(null, attributeName); + } + + public SpinXmlAttribute attrNs(String namespace, String attributeName) { + ensureNotNull("attributeName", attributeName); + Attr attributeNode = domElement.getAttributeNodeNS(namespace, attributeName); + if (attributeNode == null) { + throw LOG.unableToFindAttributeWithNamespaceAndName(namespace, attributeName); + } + return dataFormat.createAttributeWrapper(attributeNode); + } + + public boolean hasAttr(String attributeName) { + return hasAttrNs(null, attributeName); + } + + public boolean hasAttrNs(String namespace, String attributeName) { + ensureNotNull("attributeName", attributeName); + return domElement.hasAttributeNS(namespace, attributeName); + } + + public SpinList attrs() { + return new SpinListImpl<>(new DomXmlAttributeMapIterable(domElement, dataFormat)); + } + + public SpinList attrs(String namespace) { + return new SpinListImpl<>(new DomXmlAttributeMapIterable(domElement, dataFormat, namespace)); + } + + public List attrNames() { + List attributeNames = new ArrayList<>(); + for (SpinXmlAttribute attribute : attrs()) { + attributeNames.add(attribute.name()); + } + return attributeNames; + } + + public List attrNames(String namespace) { + List attributeNames = new ArrayList<>(); + for (SpinXmlAttribute attribute : attrs(namespace)) { + attributeNames.add(attribute.name()); + } + return attributeNames; + } + + public String textContent() { + return domElement.getTextContent(); + } + + public SpinXmlElement textContent(String textContent) { + ensureNotNull("textContent", textContent); + domElement.setTextContent(textContent); + return this; + } + + public SpinXmlElement childElement(String elementName) { + return childElement(namespace(), elementName); + } + + public SpinXmlElement childElement(String namespace, String elementName) { + ensureNotNull("elementName", elementName); + SpinList childElements = childElements(namespace, elementName); + if (childElements.size() > 1) { + throw LOG.moreThanOneChildElementFoundForNamespaceAndName(namespace, elementName); + } + else { + return childElements.get(0); + } + } + + public SpinList childElements() { + return new SpinListImpl<>(new DomXmlElementIterable(domElement, dataFormat)); + } + + public SpinList childElements(String elementName) { + return childElements(namespace(), elementName); + } + + public SpinList childElements(String namespace, String elementName) { + ensureNotNull("elementName", elementName); + SpinList childs = new SpinListImpl<>(new DomXmlElementIterable(domElement, dataFormat, namespace, elementName)); + if (childs.isEmpty()) { + throw LOG.unableToFindChildElementWithNamespaceAndName(namespace, elementName); + } + return childs; + } + + public SpinXmlElement attr(String attributeName, String value) { + return attrNs(null, attributeName, value); + } + + public SpinXmlElement attrNs(String namespace, String attributeName, String value) { + ensureNotNull("attributeName", attributeName); + ensureNotNull("value", value); + + try { + domElement.setAttributeNS(namespace, attributeName, value); + } + catch (DOMException e) { + throw LOG.unableToSetAttributeInImplementation(this, namespace, attributeName, value, e); + } + + return this; + } + + public SpinXmlElement removeAttr(String attributeName) { + return removeAttrNs(null, attributeName); + } + + public SpinXmlElement removeAttrNs(String namespace, String attributeName) { + ensureNotNull("attributeName", attributeName); + domElement.removeAttributeNS(namespace, attributeName); + return this; + } + + public SpinXmlElement append(SpinXmlElement... childElements) { + ensureNotNull("childElements", childElements); + for (SpinXmlElement childElement : childElements) { + ensureNotNull("childElement", childElement); + DomXmlElement spinDomElement = ensureParamInstanceOf("childElement", childElement, DomXmlElement.class); + adoptElement(spinDomElement); + try { + domElement.appendChild(spinDomElement.domElement); + } + catch (DOMException e) { + throw LOG.unableToAppendElementInImplementation(this, childElement, e); + } + } + return this; + } + + public SpinXmlElement append(SpinXmlElement childElement) { + return append(Arrays.asList(childElement)); + } + + public SpinXmlElement append(Collection childElements) { + ensureNotNull("childElements", childElements); + return append(childElements.toArray(new SpinXmlElement[0])); + } + + public SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement) { + ensureNotNull("childElement", childElement); + ensureNotNull("existingChildElement", existingChildElement); + DomXmlElement childDomElement = ensureParamInstanceOf("childElement", childElement, DomXmlElement.class); + DomXmlElement existingChildDomElement = ensureParamInstanceOf("existingChildElement", existingChildElement, DomXmlElement.class); + ensureChildElement(this, existingChildDomElement); + + adoptElement(childDomElement); + + try { + domElement.insertBefore(childDomElement.domElement, existingChildDomElement.domElement); + } + catch (DOMException e) { + throw LOG.unableToInsertElementInImplementation(this, childElement, e); + } + + return this; + } + + + public SpinXmlElement appendAfter(SpinXmlElement childElement, SpinXmlElement existingChildElement) { + ensureNotNull("childElement", childElement); + ensureNotNull("existingChildElement", existingChildElement); + DomXmlElement childDomElement = ensureParamInstanceOf("childElement", childElement, DomXmlElement.class); + DomXmlElement existingChildDomElement = ensureParamInstanceOf("existingChildElement", existingChildElement, DomXmlElement.class); + ensureChildElement(this, existingChildDomElement); + + adoptElement(childDomElement); + + Node nextSibling = existingChildDomElement.domElement.getNextSibling(); + + try { + if (nextSibling != null) { + domElement.insertBefore(childDomElement.domElement, nextSibling); + } else { + domElement.appendChild(childDomElement.domElement); + } + } + catch (DOMException e) { + throw LOG.unableToInsertElementInImplementation(this, childElement, e); + } + + return this; + } + + public SpinXmlElement remove(SpinXmlElement... childElements) { + ensureNotNull("childElements", childElements); + for (SpinXmlElement childElement : childElements) { + ensureNotNull("childElement", childElement); + DomXmlElement child = ensureParamInstanceOf("childElement", childElement, DomXmlElement.class); + ensureChildElement(this, child); + try { + domElement.removeChild(child.domElement); + } + catch (DOMException e) { + throw LOG.unableToRemoveChildInImplementation(this, childElement, e); + } + } + return this; + } + + public SpinXmlElement remove(SpinXmlElement childElement) { + return remove(Arrays.asList(childElement)); + } + + public SpinXmlElement remove(Collection childElements) { + ensureNotNull("childElements", childElements); + return remove(childElements.toArray(new SpinXmlElement[0])); + } + + public SpinXmlElement replace(SpinXmlElement newElement) { + ensureNotNull("newElement", newElement); + DomXmlElement element = ensureParamInstanceOf("newElement", newElement, DomXmlElement.class); + adoptElement(element); + + Node parentNode = domElement.getParentNode(); + if (parentNode == null) { + throw LOG.elementHasNoParent(this); + } + + try { + parentNode.replaceChild(element.domElement, domElement); + } + catch (DOMException e) { + throw LOG.unableToReplaceElementInImplementation(this, newElement, e); + } + return element; + } + + public SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement) { + ensureNotNull("existingChildElement", existingChildElement); + ensureNotNull("newChildElement", newChildElement); + ensureChildElement(this, (DomXmlElement) existingChildElement); + DomXmlElement existingChild = ensureParamInstanceOf("existingChildElement", existingChildElement, DomXmlElement.class); + DomXmlElement newChild = ensureParamInstanceOf("newChildElement", newChildElement, DomXmlElement.class); + adoptElement(newChild); + + try { + domElement.replaceChild(newChild.domElement, existingChild.domElement); + } + catch (DOMException e) { + throw LOG.unableToReplaceElementInImplementation(existingChild, newChildElement, e); + } + + return this; + } + + public SpinXPathQuery xPath(String expression) { + XPath query = getXPathFactory().newXPath(); + return new DomXPathQuery(this, query, expression, dataFormat); + } + + /** + * Adopts an xml dom element to the owner document of this element if necessary. + * + * @param elementToAdopt the element to adopt + */ + protected void adoptElement(DomXmlElement elementToAdopt) { + Document document = this.domElement.getOwnerDocument(); + Element element = elementToAdopt.domElement; + + if (!document.equals(element.getOwnerDocument())) { + Node node = document.adoptNode(element); + if (node == null) { + throw LOG.unableToAdoptElement(elementToAdopt); + } + } + } + + public String toString() { + StringWriter writer = new StringWriter(); + writeToWriter(writer); + return writer.toString(); + } + + public void writeToWriter(Writer writer) { + dataFormat.getWriter().writeToWriter(writer, this.domElement); + } + + /** + * Returns a XPath Factory + * + * @return the XPath factory + */ + protected XPathFactory getXPathFactory() { + if (cachedXPathFactory == null) { + cachedXPathFactory = XPathFactory.newInstance(); + } + return cachedXPathFactory; + } + + public C mapTo(Class javaClass) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(this.domElement, javaClass); + } + + public C mapTo(String javaClass) { + DataFormatMapper mapper = dataFormat.getMapper(); + return mapper.mapInternalToJava(this.domElement, javaClass); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElementIterable.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElementIterable.java new file mode 100644 index 0000000000000000000000000000000000000000..e5703ba2a4162348c20c301bf1eed8b7bcd3b122 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlElementIterable.java @@ -0,0 +1,90 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.SpinXmlElement; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.Iterator; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +/** + * @author Sebastian Menski + */ +public class DomXmlElementIterable implements Iterable { + + protected final NodeList nodeList; + protected final DomXmlDataFormat dataFormat; + protected final String namespace; + protected final String name; + protected boolean validating; + + public DomXmlElementIterable(Element domElement, DomXmlDataFormat dataFormat) { + this(domElement.getChildNodes(), dataFormat); + } + + public DomXmlElementIterable(NodeList nodeList, DomXmlDataFormat dataFormat) { + this.nodeList = nodeList; + this.dataFormat = dataFormat; + this.namespace = null; + this.name = null; + validating = false; + } + + public DomXmlElementIterable(Element domElement, DomXmlDataFormat dataFormat, String namespace, String name) { + this(domElement.getChildNodes(), dataFormat, namespace, name); + } + + public DomXmlElementIterable(NodeList nodeList, DomXmlDataFormat dataFormat, String namespace, String name) { + ensureNotNull("name", name); + this.nodeList = nodeList; + this.dataFormat = dataFormat; + this.namespace = namespace; + this.name = name; + validating = true; + } + + public Iterator iterator() { + return new DomXmlNodeIterator() { + + private NodeList childs = nodeList; + + protected int getLength() { + return childs.getLength(); + } + + protected SpinXmlElement getCurrent() { + if (childs != null) { + Node item = childs.item(index); + if (item != null && item instanceof Element) { + SpinXmlElement current = dataFormat.createElementWrapper((Element) item); + if (!validating || (current.hasNamespace(namespace) && name.equals(current.name()))) { + return current; + } + } + } + return null; + } + }; + + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlLogger.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlLogger.java new file mode 100644 index 0000000000000000000000000000000000000000..2d5dd50dacdd193cedc27aad0d5ecf7ec5640951 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlLogger.java @@ -0,0 +1,198 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import java.util.NoSuchElementException; +import org.camunda.commons.logging.BaseLogger; +import org.camunda.spin.impl.logging.SpinLogger; +import org.camunda.spin.xml.SpinXPathException; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlAttributeException; +import org.camunda.spin.xml.SpinXmlDataFormatException; +import org.camunda.spin.xml.SpinXmlElement; +import org.camunda.spin.xml.SpinXmlElementException; +import org.camunda.spin.xml.SpinXmlElementImplementationException; +import org.w3c.dom.Node; + +/** + * @author Daniel Meyer + * + */ +public class DomXmlLogger extends SpinLogger { + + public static final String PROJECT_CODE = SpinLogger.PROJECT_CODE + "/DOM-XML"; + public static final DomXmlLogger XML_DOM_LOGGER = BaseLogger.createLogger(DomXmlLogger.class, PROJECT_CODE, "org.camunda.spin.xml", "01"); + + public void usingDocumentBuilderFactory(String name) { + logDebug("001", "Using document builder factory '{}'", name); + } + + public void createdDocumentBuilder() { + logDebug("002", "Successfully created new document builder"); + } + + public void documentBuilderFactoryConfiguration(String property, String value) { + logDebug("003", "DocumentBuilderFactory configuration '{}' '{}'", property, value); + } + + public void parsingInput() { + logDebug("004", "Parsing input into DOM document."); + } + + public SpinXmlDataFormatException unableToCreateParser(Exception cause) { + return new SpinXmlDataFormatException(exceptionMessage("005", "Unable to create DocumentBuilder"), cause); + } + + public SpinXmlAttributeException unableToFindAttributeWithNamespaceAndName(String namespace, String attributeName) { + return new SpinXmlAttributeException(exceptionMessage("006", "Unable to find attribute with namespace '{}' and name '{}'", namespace, attributeName)); + } + + public SpinXmlElementException unableToFindChildElementWithNamespaceAndName(String namespace, String elementName) { + return new SpinXmlElementException(exceptionMessage("007", "Unable to find child element with namespace '{}' and name '{}'", namespace, elementName)); + } + + public SpinXmlElementException moreThanOneChildElementFoundForNamespaceAndName(String namespace, String elementName) { + return new SpinXmlElementException(exceptionMessage("008", "More than one child element was found for namespace '{}' and name '{}'", namespace, elementName)); + } + + public SpinXmlDataFormatException unableToParseInput(Exception e) { + return new SpinXmlDataFormatException(exceptionMessage("009", "Unable to parse input into DOM document"), e); + } + + public SpinXmlAttributeException unableToSetAttributeValueToNull(String namespace, String attributeName) { + return new SpinXmlAttributeException(exceptionMessage("010", "Unable to set value of the attribute '{}:{}' to 'null'", namespace, attributeName)); + } + + public SpinXmlElementException unableToAdoptElement(SpinXmlElement elementToAdopt) { + return new SpinXmlElementException(exceptionMessage("011", "Unable to adopt element '{}:{}'", elementToAdopt.namespace(), elementToAdopt.name())); + } + + public UnsupportedOperationException methodNotSupportedByClass(String methodName, Class implementationClass) { + return new UnsupportedOperationException(exceptionMessage("012", "The method '{}' is not implemented by class '{}'", methodName, implementationClass.getName())); + } + + public NoSuchElementException iteratorHasNoMoreElements(Class iteratorClass) { + return new NoSuchElementException(exceptionMessage("013", "The iterator '{}' has no more elements", iteratorClass.getName())); + } + + public SpinXmlElementException elementHasNoParent(SpinXmlElement element) { + return new SpinXmlElementException(exceptionMessage("014", "The element '{}:{}' has no parent element.", element.namespace(), element.name())); + } + + public SpinXmlElementImplementationException unableToReplaceElementInImplementation(SpinXmlElement existingElement, SpinXmlElement newElement, Exception cause) { + return new SpinXmlElementImplementationException(exceptionMessage("015", "Unable to replace the existing element '{}:{}' by the new element '{}:{}' in the underlying implementation", + existingElement.namespace(), existingElement.name(), newElement.namespace(), newElement.name()), cause); + } + + public SpinXmlElementImplementationException unableToSetAttributeInImplementation(SpinXmlElement element, String namespace, String attributeName, String value, Exception cause) { + return new SpinXmlElementImplementationException(exceptionMessage("016", "Unable to set attribute '{}:{}' to value '{}' on element '{}:{}' in the underlying implementation", + namespace, attributeName, value, element.namespace(), element.name()), cause); + } + + public SpinXmlElementImplementationException unableToAppendElementInImplementation(SpinXmlElement element, SpinXmlElement childElement, Exception cause) { + return new SpinXmlElementImplementationException(exceptionMessage("017", "Unable to append new child element '{}:{}' to element '{}:{}' in the underlying implementation", + childElement.namespace(), childElement.name(), element.namespace(), element.name()), cause); + } + + public SpinXmlElementImplementationException unableToInsertElementInImplementation(SpinXmlElement element, SpinXmlElement childElement, Exception cause) { + return new SpinXmlElementImplementationException(exceptionMessage("018", "Unable to insert new child element '{}:{}' to element '{}:{}' in the underlying implementation", + childElement.namespace(), childElement.name(), element.namespace(), element.name()), cause); + } + + public SpinXmlElementImplementationException unableToRemoveChildInImplementation(SpinXmlElement element, SpinXmlElement childElement, Exception cause) { + return new SpinXmlElementImplementationException(exceptionMessage("019", "Unable to remove child element '{}:{}' from element '{}:{}' in the underlying implementation", + childElement.namespace(), childElement.name(), element.namespace(), element.name()), cause); + } + + public SpinXmlAttributeException unableToWriteAttribute(SpinXmlAttribute attribute, Exception cause) { + return new SpinXmlAttributeException(exceptionMessage("020", "Unable to write attribute '{}:{}'", attribute.namespace(), attribute.name()), cause); + } + + public SpinXmlElementException unableToCreateTransformer(Exception cause) { + return new SpinXmlElementException(exceptionMessage("021", "Unable to create a transformer to write element"), cause); + } + + public SpinXmlElementException unableToTransformElement(Node element, Exception cause) { + return new SpinXmlElementException(exceptionMessage("022", "Unable to transform element '{}:{}'", element.getNamespaceURI(), element.getNodeName()), cause); + } + + public SpinXPathException unableToEvaluateXPathExpressionOnElement(SpinXmlElement element, Exception cause) { + return new SpinXPathException(exceptionMessage("024", "Unable to evaluate XPath expression on element '{}:{}'", element.namespace(), element.name()), cause); + } + + public SpinXPathException unableToCastXPathResultTo(Class castClass, Exception cause) { + return new SpinXPathException(exceptionMessage("025", "Unable to cast XPath expression to class '{}'", castClass.getName()), cause); + } + + public SpinXmlDataFormatException unableToDetectCanonicalType(Object parameter) { + return new SpinXmlDataFormatException(exceptionMessage("026", "Cannot detect canonical data type for parameter '{}'", parameter)); + } + + public SpinXmlDataFormatException unableToMapInput(Object parameter, Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("027", "Unable to map object '{}' to xml element", parameter.toString()), cause); + } + + public SpinXmlDataFormatException unableToDeserialize(Object node, String canonicalClassName, Throwable cause) { + return new SpinXmlDataFormatException( + exceptionMessage("028", "Cannot deserialize '{}...' to java class '{}'", node.toString(), canonicalClassName), cause); + } + + public SpinXmlDataFormatException unableToCreateMarshaller(Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("029", "Cannot create marshaller"), cause); + } + + public SpinXmlDataFormatException unableToCreateContext(Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("030", "Cannot create context"), cause); + } + + public SpinXmlDataFormatException unableToCreateUnmarshaller(Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("031", "Cannot create unmarshaller"), cause); + } + + public SpinXmlDataFormatException unableToSetEventHandler(String className, Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("032", "Cannot set event handler to '{}'", className), cause); + } + + public SpinXmlDataFormatException unableToSetProperty(String propertyName, String className, Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("033", "Cannot set property '{}' to '{}'", propertyName, className), cause); + } + + public SpinXPathException notAllowedXPathExpression(String expression) { + return new SpinXPathException(exceptionMessage("034", "XPath expression '{}' not allowed", expression)); + } + + public SpinXPathException unableToFindXPathExpression(String expression) { + return new SpinXPathException(exceptionMessage("035", "Unable to find XPath expression '{}'", expression)); + } + + public SpinXmlElementException elementIsNotChildOfThisElement(SpinXmlElement existingChildElement, SpinXmlElement parentDomElement) { + return new SpinXmlElementException(exceptionMessage("036", "The element with namespace '{}' and name '{}' " + + "is not a child element of the element with namespace '{}' and name '{}'", + existingChildElement.namespace(), existingChildElement.name(), + parentDomElement.namespace(), parentDomElement.name() + )); + } + + public SpinXmlDataFormatException unableToFindStripSpaceXsl(String expression) { + return new SpinXmlDataFormatException(exceptionMessage("037", "No formatting configuration defined and unable to find the default '{}'", expression)); + } + + public SpinXmlDataFormatException unableToLoadFormattingTemplates(Throwable cause) { + return new SpinXmlDataFormatException(exceptionMessage("038", "Failed to get formatting templates"), cause); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlNodeIterator.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlNodeIterator.java new file mode 100644 index 0000000000000000000000000000000000000000..68338e648319022f41582bcf48bd27bb0650f9b3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/DomXmlNodeIterator.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom; + +import java.util.Iterator; + +import org.camunda.spin.xml.SpinXmlNode; + +/** + * @author Sebastian Menski + */ +public abstract class DomXmlNodeIterator implements Iterator { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + protected int index = 0; + + public boolean hasNext() { + for (; index < getLength() ; index++) { + if (getCurrent() != null) { + return true; + } + } + return false; + } + + public T next() { + if (hasNext()) { + T current = getCurrent(); + index++; + return current; + } + else { + throw LOG.iteratorHasNoMoreElements(DomXmlNodeIterator.class); + } + } + + public void remove() { + throw LOG.methodNotSupportedByClass("remove", DomXmlElementIterable.class); + } + + protected abstract int getLength(); + + protected abstract T getCurrent(); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormat.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormat.java new file mode 100644 index 0000000000000000000000000000000000000000..d046dd5f8c7ff3d44b06faaf4aaf264438da94c9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormat.java @@ -0,0 +1,301 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import java.io.InputStream; +import java.util.Collections; +import java.util.Map; +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.TransformerFactory; +import org.camunda.spin.impl.xml.dom.DomXmlAttribute; +import org.camunda.spin.impl.xml.dom.DomXmlElement; +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.impl.xml.dom.format.spi.DefaultJaxBContextProvider; +import org.camunda.spin.impl.xml.dom.format.spi.JaxBContextProvider; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +/** + * @author Daniel Meyer + */ +public class DomXmlDataFormat implements DataFormat { + + protected static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + protected static final String EXTERNAL_GENERAL_ENTITIES = "http://xml.org/sax/features/external-general-entities"; + protected static final String DISALLOW_DOCTYPE_DECL = "http://apache.org/xml/features/disallow-doctype-decl"; + protected static final String LOAD_EXTERNAL_DTD = "http://apache.org/xml/features/nonvalidating/load-external-dtd"; + protected static final String EXTERNAL_PARAMETER_ENTITIES = "http://xml.org/sax/features/external-parameter-entities"; + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA_SYSTEM_PROPERTY = "javax.xml.accessExternalSchema"; + protected static final String JAXP_ACCESS_EXTERNAL_SCHEMA_ALL = "all"; + + public static final String XXE_PROPERTY = "xxe-processing"; + public static final String SP_PROPERTY = "secure-processing"; + + /** + * the DocumentBuilderFactory used by the reader + */ + protected DocumentBuilderFactory documentBuilderFactory; + + /** + * the TransformerFactory instance used by the writer + */ + protected TransformerFactory transformerFactory; + + /** + * the JaxBContextProvider instance used by this writer. + */ + protected JaxBContextProvider jaxBContextProvider; + + protected DomXmlDataFormatReader reader; + protected DomXmlDataFormatWriter writer; + protected DomXmlDataFormatMapper mapper; + + protected final String name; + + protected boolean prettyPrint; + + protected InputStream formattingConfiguration; + + public DomXmlDataFormat(String name) { + this(name, defaultDocumentBuilderFactory()); + } + + public DomXmlDataFormat(String name, Map configurationProperties) { + this(name, configurableDocumentBuilderFactory(configurationProperties)); + } + + public DomXmlDataFormat(String name, JaxBContextProvider contextProvider) { + this(name, defaultDocumentBuilderFactory(), contextProvider); + } + + public DomXmlDataFormat(String name, + DocumentBuilderFactory documentBuilderFactory, + JaxBContextProvider contextProvider) { + this(name, documentBuilderFactory, defaultTransformerFactory(), contextProvider); + } + + public DomXmlDataFormat(String name, DocumentBuilderFactory documentBuilderFactory) { + this(name, documentBuilderFactory, defaultTransformerFactory(), defaultJaxBContextProvider()); + } + + public DomXmlDataFormat(String name, + DocumentBuilderFactory documentBuilderFactory, + TransformerFactory transformerFactory, + JaxBContextProvider contextProvider) { + this.name = name; + this.documentBuilderFactory = documentBuilderFactory; + this.prettyPrint = true; + this.formattingConfiguration = null; + + LOG.usingDocumentBuilderFactory(documentBuilderFactory.getClass().getName()); + + this.transformerFactory = transformerFactory; + + this.jaxBContextProvider = contextProvider; + init(); + } + + protected void init() { + this.reader = new DomXmlDataFormatReader(this); + this.writer = new DomXmlDataFormatWriter(this); + this.mapper = new DomXmlDataFormatMapper(this); + } + + @Override + public Class getWrapperType() { + return DomXmlElement.class; + } + + @Override + public SpinXmlElement createWrapperInstance(Object parameter) { + return createElementWrapper((Element) parameter); + } + + @Override + public String getName() { + return name; + } + + public SpinXmlElement createElementWrapper(Element element) { + return new DomXmlElement(element, this); + } + + public SpinXmlAttribute createAttributeWrapper(Attr attr) { + return new DomXmlAttribute(attr, this); + } + + @Override + public DomXmlDataFormatReader getReader() { + return reader; + } + + @Override + public DomXmlDataFormatWriter getWriter() { + return writer; + } + + @Override + public DomXmlDataFormatMapper getMapper() { + return mapper; + } + + public DocumentBuilderFactory getDocumentBuilderFactory() { + return documentBuilderFactory; + } + + public TransformerFactory getTransformerFactory() { + return transformerFactory; + } + + public JaxBContextProvider getJaxBContextProvider() { + return jaxBContextProvider; + } + + public void setDocumentBuilderFactory(DocumentBuilderFactory documentBuilderFactory) { + this.documentBuilderFactory = documentBuilderFactory; + } + + public void setTransformerFactory(TransformerFactory transformerFactory) { + this.transformerFactory = transformerFactory; + this.writer.reloadFormattingTemplates(); + } + + public void setJaxBContextProvider(JaxBContextProvider jaxBContextProvider) { + this.jaxBContextProvider = jaxBContextProvider; + } + + public boolean isPrettyPrint() { + return prettyPrint; + } + + public void setPrettyPrint(boolean prettyPrint) { + this.prettyPrint = prettyPrint; + } + + public InputStream getFormattingConfiguration() { + return this.formattingConfiguration; + } + + public void setFormattingConfiguration(InputStream formattingConfiguration) { + this.formattingConfiguration = formattingConfiguration; + //writer need a new formattingTemplate with the new formattingConfiguration + this.writer.setFormattingTemplates(this.writer.reloadFormattingTemplates()); + } + + public static TransformerFactory defaultTransformerFactory() { + return TransformerFactory.newInstance(); + } + + public static DocumentBuilderFactory defaultDocumentBuilderFactory() { + return configurableDocumentBuilderFactory(Collections.emptyMap()); + } + + public static DocumentBuilderFactory configurableDocumentBuilderFactory(Map configurationProperties) { + + DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); + + documentBuilderFactory.setNamespaceAware(true); + LOG.documentBuilderFactoryConfiguration("namespaceAware", "true"); + + documentBuilderFactory.setValidating(false); + LOG.documentBuilderFactoryConfiguration("validating", "false"); + + documentBuilderFactory.setIgnoringComments(true); + LOG.documentBuilderFactoryConfiguration("ignoringComments", "true"); + + documentBuilderFactory.setIgnoringElementContentWhitespace(false); + LOG.documentBuilderFactoryConfiguration("ignoringElementContentWhitespace", "false"); + + if ((boolean) configurationProperties.getOrDefault(XXE_PROPERTY, false) == false) { + disableXxeProcessing(documentBuilderFactory); + } + + if ((boolean) configurationProperties.getOrDefault(SP_PROPERTY, true) == true) { + enableSecureProcessing(documentBuilderFactory); + } + + return documentBuilderFactory; + } + + public static JaxBContextProvider defaultJaxBContextProvider() { + return new DefaultJaxBContextProvider(); + } + + /* + * Configures the DocumentBuilderFactory in a way, that it is protected against + * XML External Entity Attacks. If the implementing parser does not support one or + * multiple features, the failed feature is ignored. The parser might not be protected, + * if the feature assignment fails. + * + * @see OWASP Information of XXE attacks + * + * @param dbf The factory to configure. + */ + protected static void disableXxeProcessing(DocumentBuilderFactory dbf) { + try { + dbf.setFeature(EXTERNAL_GENERAL_ENTITIES, false); + dbf.setFeature(DISALLOW_DOCTYPE_DECL, true); + dbf.setFeature(LOAD_EXTERNAL_DTD, false); + dbf.setFeature(EXTERNAL_PARAMETER_ENTITIES, false); + } catch (ParserConfigurationException ignored) { + // ignore + } + dbf.setXIncludeAware(false); + dbf.setExpandEntityReferences(false); + } + + /* + * Configures the DocumentBuilderFactory to process XML securely. + * If the implementing parser does not support one or multiple features, + * the failed feature is ignored. The parser might not be protected, + * if the feature assignment fails. + * + * @param dbf The factory to configure. + */ + protected static void enableSecureProcessing(DocumentBuilderFactory dbf) { + try { + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setAttribute(JAXP_ACCESS_EXTERNAL_SCHEMA, resolveAccessExternalSchemaProperty()); + } catch (ParserConfigurationException | IllegalArgumentException ignored) { + // ignored + } + } + + /* + * JAXP allows users to override the default value via system properties and + * a central properties file (see https://docs.oracle.com/javase/tutorial/jaxp/properties/scope.html). + * However, both are overridden by an explicit configuration in code, as we apply it. + * Since we want users to customize the value, we take the system property into account. + * The properties file is not supported at the moment. + */ + protected static String resolveAccessExternalSchemaProperty() { + String systemProperty = System.getProperty(JAXP_ACCESS_EXTERNAL_SCHEMA_SYSTEM_PROPERTY); + + if (systemProperty != null) { + return systemProperty; + } else { + return JAXP_ACCESS_EXTERNAL_SCHEMA_ALL; + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatMapper.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..c61b3431998d2feecdd6526928c508a0ffff8e07 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatMapper.java @@ -0,0 +1,173 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +import java.beans.Introspector; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.namespace.QName; +import javax.xml.transform.dom.DOMResult; +import javax.xml.transform.dom.DOMSource; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.SpinRuntimeException; +import org.camunda.spin.impl.util.SpinReflectUtil; +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.impl.xml.dom.format.spi.JaxBContextProvider; +import org.camunda.spin.spi.DataFormatMapper; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +/** + * {@link DataFormatMapper} using JAXB for mapping Java Objects to XML and vice-versa. + * + * @author Stefan Hentschel. + * @author Daniel Meyer + */ +public class DomXmlDataFormatMapper implements DataFormatMapper { + + protected DomXmlDataFormat dataFormat; + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + public DomXmlDataFormatMapper(DomXmlDataFormat format) { + this.dataFormat = format; + } + + @Override + public boolean canMap(Object parameter) { + // TODO: can JAX-B tell us whether it is capable of mapping a class? + return parameter != null; + } + + @Override + public String getCanonicalTypeName(Object object) { + // simply returns the name of the class + return object.getClass().getName(); + } + + @Override + public Object mapJavaToInternal(Object parameter) { + ensureNotNull("Parameter", parameter); + + final Class parameterClass = parameter.getClass(); + final DOMResult domResult = new DOMResult(); + + try { + Marshaller marshaller = getMarshaller(parameterClass); + + boolean isRootElement = parameterClass.getAnnotation(XmlRootElement.class) != null; + if(isRootElement) { + marshalRootElement(parameter, marshaller, domResult); + } + else { + marshalNonRootElement(parameter, marshaller, domResult); + } + + Node node = domResult.getNode(); + return ((Document)node).getDocumentElement(); + + } catch (JAXBException e) { + throw LOG.unableToMapInput(parameter, e); + } + } + + protected void marshalRootElement(Object parameter, Marshaller marshaller, DOMResult domResult) throws JAXBException { + marshaller.marshal(parameter, domResult); + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + protected void marshalNonRootElement(Object parameter, Marshaller marshaller, DOMResult domResult) throws JAXBException { + Class parameterClass = parameter.getClass(); + String simpleName = Introspector.decapitalize(parameterClass.getSimpleName()); + JAXBElement root = new JAXBElement(new QName(simpleName), parameterClass, parameter); + marshaller.marshal(root, domResult); + } + + @Override + public T mapInternalToJava(Object parameter, Class javaClass) { + return mapInternalToJava(parameter, javaClass, null); + } + + @Override + public T mapInternalToJava(Object parameter, Class javaClass, DeserializationTypeValidator validator) { + ensureNotNull("Parameter", parameter); + ensureNotNull("Type", javaClass); + + Node xmlNode = (Node) parameter; + try { + validateType(javaClass, validator); + Unmarshaller unmarshaller = getUnmarshaller(javaClass); + JAXBElement root = unmarshaller.unmarshal(new DOMSource(xmlNode), javaClass); + return root.getValue(); + + } catch (JAXBException e) { + throw LOG.unableToDeserialize(parameter, javaClass.getCanonicalName(), e); + } + } + + protected void validateType(Class type, DeserializationTypeValidator validator) { + if (validator != null) { + // validate the outer class + if (!type.isPrimitive()) { + Class typeToValidate = type; + if (type.isArray()) { + typeToValidate = type.getComponentType(); + } + String className = typeToValidate.getName(); + if (!validator.validate(className)) { + throw new SpinRuntimeException("The class '" + className + "' is not whitelisted for deserialization."); + } + } + } + } + + @Override + public T mapInternalToJava(Object parameter, String classIdentifier) { + return mapInternalToJava(parameter, classIdentifier, null); + } + + @SuppressWarnings("unchecked") + @Override + public T mapInternalToJava(Object parameter, String classIdentifier, DeserializationTypeValidator validator) { + ensureNotNull("Parameter", parameter); + ensureNotNull("classIdentifier", classIdentifier); + + try { + Class javaClass = SpinReflectUtil.loadClass(classIdentifier, dataFormat); + return (T) mapInternalToJava(parameter, javaClass, validator); + } + catch (Exception e) { + throw LOG.unableToDeserialize(parameter, classIdentifier, e); + } + } + + protected Marshaller getMarshaller(Class parameter) throws JAXBException { + JaxBContextProvider jaxBContextProvider = dataFormat.getJaxBContextProvider(); + return jaxBContextProvider.createMarshaller(parameter); + } + + protected Unmarshaller getUnmarshaller(Class parameter) throws JAXBException { + JaxBContextProvider jaxBContextProvider = dataFormat.getJaxBContextProvider(); + return jaxBContextProvider.createUnmarshaller(parameter); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..6ce33264f9fde6dc473daa8b4c0d9d5af45c7af7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatProvider.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import java.util.Map; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.spi.DataFormatProvider; + +/** + * Provides the {@link DomXmlDataFormat} with default configuration. + * + * @author Daniel Meyer + * + */ +public class DomXmlDataFormatProvider implements DataFormatProvider { + + public String getDataFormatName() { + return DataFormats.XML_DATAFORMAT_NAME; + } + + public DataFormat createInstance() { + return new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + } + + @Override + public DataFormat createInstance(Map configurationProperties) { + return new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME, configurationProperties); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatReader.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatReader.java new file mode 100644 index 0000000000000000000000000000000000000000..059169cb3912d750612c8c8f1b825d707c2ca839 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatReader.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import java.io.IOException; +import java.io.Reader; +import java.util.regex.Pattern; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.ParserConfigurationException; + +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.spi.TextBasedDataFormatReader; +import org.w3c.dom.Element; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * @author Daniel Meyer + * + */ +public class DomXmlDataFormatReader extends TextBasedDataFormatReader { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + private static final Pattern INPUT_MATCHING_PATTERN = Pattern.compile("\\A(\\s)*<"); + + protected DomXmlDataFormat dataFormat; + + public DomXmlDataFormatReader(DomXmlDataFormat dataFormat) { + this.dataFormat = dataFormat; + } + + public Element readInput(Reader input) { + + DocumentBuilder documentBuilder = getDocumentBuilder(); + try { + LOG.parsingInput(); + return documentBuilder.parse(new InputSource(input)).getDocumentElement(); + + } catch (SAXException e) { + throw LOG.unableToParseInput(e); + + } catch (IOException e) { + throw LOG.unableToParseInput(e); + + } + } + + /** + * @return the DocumentBuilder used by this reader + */ + protected DocumentBuilder getDocumentBuilder() { + try { + DocumentBuilder docBuilder = dataFormat.getDocumentBuilderFactory().newDocumentBuilder(); + LOG.createdDocumentBuilder(); + return docBuilder; + + } catch (ParserConfigurationException e) { + throw LOG.unableToCreateParser(e); + + } + } + + protected Pattern getInputDetectionPattern() { + return INPUT_MATCHING_PATTERN; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriter.java new file mode 100644 index 0000000000000000000000000000000000000000..ac1f13cce70efd80ac51c185c784affe58e72aaa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriter.java @@ -0,0 +1,147 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Writer; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.spi.DataFormatWriter; +import org.camunda.spin.xml.SpinXmlElementException; +import org.w3c.dom.Node; + +/** + * A writer for XML DOM. + * + * @author Daniel Meyer + */ +public class DomXmlDataFormatWriter implements DataFormatWriter { + + protected static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + protected static final String STRIP_SPACE_XSL = "org/camunda/spin/impl/xml/dom/format/strip-space.xsl"; + + protected DomXmlDataFormat domXmlDataFormat; + protected Templates formattingTemplates; + + public DomXmlDataFormatWriter(DomXmlDataFormat domXmlDataFormat) { + this.domXmlDataFormat = domXmlDataFormat; + this.formattingTemplates = reloadFormattingTemplates(); + } + + @Override + public void writeToWriter(Writer writer, Object input) { + writeResult(new StreamResult(writer), input); + } + + protected void writeResult(StreamResult streamResult, Object input) { + Node node = (Node) input; + DOMSource domSource = new DOMSource(node); + try { + if (domXmlDataFormat.isPrettyPrint()) { + getFormattingTransformer().transform(domSource, streamResult); + } else { + getTransformer().transform(domSource, streamResult); + } + } catch (TransformerException e) { + throw LOG.unableToTransformElement(node, e); + } + } + + /** + * Return a {@link Templates} instance for formatting configuration. + * Uses the configured {@link TransformerFactory} from the {@link DomXmlDataFormat}. + * Uses the formatting configuration from the {@link DomXmlDataFormat} if defined, + * falls back to a default otherwise. + * + * @return the templates instance for the formatting configuration. + */ + protected Templates reloadFormattingTemplates() { + final TransformerFactory transformerFactory = this.domXmlDataFormat.getTransformerFactory(); + + try (final InputStream formattingConfiguration = getFormattingConfiguration()) { + if (formattingConfiguration == null) { + throw LOG.unableToFindStripSpaceXsl(STRIP_SPACE_XSL); + } + return transformerFactory.newTemplates(new StreamSource(formattingConfiguration)); + } catch (final IOException | TransformerConfigurationException ex) { + throw LOG.unableToLoadFormattingTemplates(ex); + } + } + + /** + * Set the {@link Templates} which used for creating the transformer. + * @param formattingTemplates + */ + protected void setFormattingTemplates(Templates formattingTemplates) { + this.formattingTemplates = formattingTemplates; + } + + private InputStream getFormattingConfiguration() { + final InputStream importedConfiguration = this.domXmlDataFormat.getFormattingConfiguration(); + if (importedConfiguration != null) { + return importedConfiguration; + } + // default strip-spaces.xsl + return DomXmlDataFormatWriter.class.getClassLoader().getResourceAsStream(STRIP_SPACE_XSL); + } + + /** + * Returns a configured transformer to write XML and apply indentation (pretty-print) to the xml. + * + * @return the XML configured transformer + * @throws SpinXmlElementException if no new transformer can be created + */ + protected Transformer getFormattingTransformer() { + try { + Transformer transformer = formattingTemplates.newTransformer(); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2"); + return transformer; + } catch (TransformerConfigurationException e) { + throw LOG.unableToCreateTransformer(e); + } + } + + /** + * Returns a configured transformer to write XML as is. + * + * @return the XML configured transformer + * @throws SpinXmlElementException if no new transformer can be created + */ + protected Transformer getTransformer() { + TransformerFactory transformerFactory = domXmlDataFormat.getTransformerFactory(); + try { + Transformer transformer = transformerFactory.newTransformer(); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + return transformer; + } catch (TransformerConfigurationException e) { + throw LOG.unableToCreateTransformer(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/DefaultJaxBContextProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/DefaultJaxBContextProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..0c8461159df4630a0e377400a0b8b3aad72ecb1d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/DefaultJaxBContextProvider.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format.spi; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.camunda.spin.impl.xml.dom.DomXmlLogger; + +/** + * Simple implementation for the JaxBContextProvider interface returning a new context + * each time it is invoked. This implementation does not perform any kind of caching. + * + * @author Daniel Meyer + * + */ +public class DefaultJaxBContextProvider implements JaxBContextProvider { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + public JAXBContext getContext(Class... types) { + try { + return JAXBContext.newInstance(types); + } + catch (JAXBException e) { + throw LOG.unableToCreateContext(e); + } + } + + @Override + public Marshaller createMarshaller(Class... types) { + try { + return getContext(types).createMarshaller(); + } catch (JAXBException e) { + throw LOG.unableToCreateMarshaller(e); + } + } + + @Override + public Unmarshaller createUnmarshaller(Class... types) { + try { + return getContext(types).createUnmarshaller(); + } catch (JAXBException e) { + throw LOG.unableToCreateUnmarshaller(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/JaxBContextProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/JaxBContextProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..d958cac289967c34ead69a55f41eefb0945b8976 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/format/spi/JaxBContextProvider.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format.spi; + +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; + +/** + * Provider for the Marshallers and Unmarshallers the {@link DomXmlDataFormat} uses to + * map Java objects to XML and vice versa. Implementations typically manage a JAXBContext. + * The JAXBContext caches information about the types it is capable of processing. + * Since the context is expensive to create, it is useful to cache + * it. Different applications may require different caching strategies. + * + * @author Daniel Meyer + * + */ +public interface JaxBContextProvider { + + /** + * Obtain a Marshaller that can map the provided types. + * + * @param types the Java Types that are going to be marshalled + * @return the Marshaller of marshalling the provided types to XML. + */ + public Marshaller createMarshaller(Class... types); + + /** + * Obtain an Unmarshaller that can map the provided types. + * + * @param types the Java Types that are going to be unmarshalled + * @return the Marshaller of unmarshalling the provided types from XML. + */ + public Unmarshaller createUnmarshaller(Class... types); + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathNamespaceResolver.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathNamespaceResolver.java new file mode 100644 index 0000000000000000000000000000000000000000..2fa49ce534b13025d84a0092f06ab14df1d11bfb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathNamespaceResolver.java @@ -0,0 +1,161 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.query; + +import static org.camunda.commons.utils.EnsureUtil.ensureNotNull; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import javax.xml.XMLConstants; +import javax.xml.namespace.NamespaceContext; + +import org.camunda.spin.xml.SpinXmlElement; + + +/** + * Resolves the namespaces of the given element. + * + * @author Stefan Hentschel + */ +public class DomXPathNamespaceResolver implements NamespaceContext { + + protected Map namespaces; + protected SpinXmlElement element; + + public DomXPathNamespaceResolver(SpinXmlElement element) { + this.namespaces = new HashMap(); + this.element = element; + } + + public String getNamespaceURI(String prefix) { + ensureNotNull("Prefix", prefix); + + if(prefix.equals(XMLConstants.XML_NS_PREFIX)) { + return XMLConstants.XML_NS_URI; + } + + if(prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) { + return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; + } + + /** + * TODO: This only works for the root element. Every child element with a 'xmlns'-attribute will be ignored + * So you need to specify an own prefix for the child elements default namespace uri + */ + if(prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) { + return element.namespace(); + } + + if(namespaces.containsKey(prefix)) { + return namespaces.get(prefix); + } else { + return XMLConstants.NULL_NS_URI; + } + } + + public String getPrefix(String namespaceURI) { + ensureNotNull("Namespace URI", namespaceURI); + + if(namespaceURI.equals(XMLConstants.XML_NS_URI)) { + return XMLConstants.XML_NS_PREFIX; + } + + if(namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { + return XMLConstants.XMLNS_ATTRIBUTE; + } + + /** + * TODO: This only works for the root element. Every child element with a 'xmlns'-attribute will be ignored. + */ + if (namespaceURI.equals(element.name())) { + return XMLConstants.DEFAULT_NS_PREFIX; + } + + String key = null; + if(namespaces.containsValue(namespaceURI)) { + for(Map.Entry entry : namespaces.entrySet()) { + if(namespaceURI.equals(entry.getValue())) { + key = entry.getKey(); + break; + } + } + } + return key; + + } + + public Iterator getPrefixes(String namespaceURI) { + ensureNotNull("Namespace URI", namespaceURI); + + List list = new ArrayList(); + if(namespaceURI.equals(XMLConstants.XML_NS_URI)) { + list.add(XMLConstants.XML_NS_PREFIX); + return Collections.unmodifiableList(list).iterator(); + } + + + if(namespaceURI.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) { + list.add(XMLConstants.XMLNS_ATTRIBUTE); + return Collections.unmodifiableList(list).iterator(); + } + + // default namespace + if(namespaceURI.equals(element.namespace())) { + list.add(XMLConstants.DEFAULT_NS_PREFIX); + } + + if(namespaces.containsValue(namespaceURI)) { + // all other namespaces + for (Map.Entry entry : namespaces.entrySet()) { + if (namespaceURI.equals(entry.getValue())) { + list.add(entry.getKey()); + } + } + } + + return Collections.unmodifiableList(list).iterator(); + } + + /** + * Maps a single prefix, uri pair as namespace. + * + * @param prefix the prefix to use + * @param namespaceURI the URI to use + * @throws IllegalArgumentException if prefix or namespaceURI is null + */ + public void setNamespace(String prefix, String namespaceURI) { + ensureNotNull("Prefix", prefix); + ensureNotNull("Namespace URI", namespaceURI); + + namespaces.put(prefix, namespaceURI); + } + + /** + * Maps a map of prefix, uri pairs as namespaces. + * + * @param namespaces the map of namespaces + * @throws IllegalArgumentException if namespaces is null + */ + public void setNamespaces(Map namespaces) { + ensureNotNull("Namespaces", namespaces); + this.namespaces = namespaces; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathQuery.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathQuery.java new file mode 100644 index 0000000000000000000000000000000000000000..a52335efac57d40a56906b3b8c3ec63d9fd283de --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/query/DomXPathQuery.java @@ -0,0 +1,162 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.query; + +import static org.camunda.spin.impl.xml.dom.util.DomXmlEnsure.ensureNotDocumentRootExpression; +import static org.camunda.spin.impl.xml.dom.util.DomXmlEnsure.ensureXPathNotEmpty; +import static org.camunda.spin.impl.xml.dom.util.DomXmlEnsure.ensureXPathNotNull; + +import java.util.Map; + +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpressionException; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.SpinListImpl; +import org.camunda.spin.impl.xml.dom.DomXmlAttributeIterable; +import org.camunda.spin.impl.xml.dom.DomXmlElement; +import org.camunda.spin.impl.xml.dom.DomXmlElementIterable; +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.SpinXPathQuery; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + +/** + * @author Sebastian Menski + */ +public class DomXPathQuery extends SpinXPathQuery { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + protected final DomXmlElement domElement; + protected final XPath query; + protected final String expression; + protected final DomXmlDataFormat dataFormat; + protected DomXPathNamespaceResolver resolver; + + public DomXPathQuery(DomXmlElement domElement, XPath query, String expression, DomXmlDataFormat dataFormat) { + this.domElement = domElement; + this.query = query; + this.expression = expression; + this.dataFormat = dataFormat; + this.resolver = new DomXPathNamespaceResolver(this.domElement); + + this.query.setNamespaceContext(this.resolver); + } + + public SpinXmlElement element() { + try { + ensureNotDocumentRootExpression(expression); + Element element = (Element) query.evaluate(expression, domElement.unwrap(), XPathConstants.NODE); + ensureXPathNotNull(element, expression); + return dataFormat.createElementWrapper(element); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(Element.class, e); + } + } + + public SpinList elementList() { + try { + ensureNotDocumentRootExpression(expression); + NodeList nodeList = (NodeList) query.evaluate(expression, domElement.unwrap(), XPathConstants.NODESET); + ensureXPathNotEmpty(nodeList, expression); + return new SpinListImpl(new DomXmlElementIterable(nodeList, dataFormat)); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(NodeList.class, e); + } + } + + public SpinXmlAttribute attribute() { + try { + ensureNotDocumentRootExpression(expression); + Attr attribute = (Attr) query.evaluate(expression, domElement.unwrap(), XPathConstants.NODE); + ensureXPathNotNull(attribute, expression); + return dataFormat.createAttributeWrapper(attribute); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(Attr.class, e); + } + } + + public SpinList attributeList() { + try { + ensureNotDocumentRootExpression(expression); + NodeList nodeList = (NodeList) query.evaluate(expression, domElement.unwrap(), XPathConstants.NODESET); + ensureXPathNotEmpty(nodeList, expression); + return new SpinListImpl(new DomXmlAttributeIterable(nodeList, dataFormat)); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(NodeList.class, e); + } + } + + public String string() { + try { + ensureNotDocumentRootExpression(expression); + return (String) query.evaluate(expression, domElement.unwrap(), XPathConstants.STRING); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(String.class, e); + } + } + + public Double number() { + try { + ensureNotDocumentRootExpression(expression); + return (Double) query.evaluate(expression, domElement.unwrap(), XPathConstants.NUMBER); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(Double.class, e); + } + } + + public Boolean bool() { + try { + ensureNotDocumentRootExpression(expression); + return (Boolean) query.evaluate(expression, domElement.unwrap(), XPathConstants.BOOLEAN); + } catch (XPathExpressionException e) { + throw LOG.unableToEvaluateXPathExpressionOnElement(domElement, e); + } catch (ClassCastException e) { + throw LOG.unableToCastXPathResultTo(Boolean.class, e); + } + } + + public SpinXPathQuery ns(String prefix, String namespace) { + resolver.setNamespace(prefix, namespace); + query.setNamespaceContext(resolver); + return this; + } + + public SpinXPathQuery ns(Map namespaces) { + resolver.setNamespaces(namespaces); + query.setNamespaceContext(resolver); + return this; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/util/DomXmlEnsure.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/util/DomXmlEnsure.java new file mode 100644 index 0000000000000000000000000000000000000000..12c428cec0ce1b37f46a78f26ad92408ec4d51f9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/java/org/camunda/spin/impl/xml/dom/util/DomXmlEnsure.java @@ -0,0 +1,91 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.util; + +import org.camunda.commons.utils.EnsureUtil; +import org.camunda.spin.impl.xml.dom.DomXmlElement; +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.xml.SpinXPathException; +import org.camunda.spin.xml.SpinXmlElementException; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * A list of generally useful source code assertions provided as static helpers. + * + * @author Daniel Meyer + * + */ +public class DomXmlEnsure extends EnsureUtil { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + private static final String ROOT_EXPRESSION = "/"; + + /** + * Ensures that the element is child element of the parent element. + * + * @param parentElement the parent xml dom element + * @param childElement the child element + * @throws SpinXmlElementException if the element is not child of the parent element + */ + public static void ensureChildElement(DomXmlElement parentElement, DomXmlElement childElement) { + Node parent = childElement.unwrap().getParentNode(); + if (parent == null || !parentElement.unwrap().isEqualNode(parent)) { + throw LOG.elementIsNotChildOfThisElement(childElement, parentElement); + } + } + + /** + * Ensures that the expression is not the root expression '/'. + * + * @param expression the expression to ensure to be not the root expression '/' + * @throws SpinXPathException if the expression is the root expression '/' + */ + public static void ensureNotDocumentRootExpression(String expression) { + if (ROOT_EXPRESSION.equals(expression)) { + throw LOG.notAllowedXPathExpression(expression); + } + } + + /** + * Ensure that the node is not null. + * + * @param node the node to ensure to be not null + * @param expression the expression was used to find the node + * @throws SpinXPathException if the node is null + */ + public static void ensureXPathNotNull(Node node, String expression) { + if (node == null) { + throw LOG.unableToFindXPathExpression(expression); + } + } + + /** + * Ensure that the nodeList is either null or empty. + * + * @param nodeList the nodeList to ensure to be either null or empty + * @param expression the expression was used to fine the nodeList + * @throws SpinXPathException if the nodeList is either null or empty + */ + public static void ensureXPathNotEmpty(NodeList nodeList, String expression) { + if (nodeList == null || nodeList.getLength() == 0) { + throw LOG.unableToFindXPathExpression(expression); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider new file mode 100644 index 0000000000000000000000000000000000000000..6c9aac44091bb7b19ddc7a57fff26884e7cde470 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/META-INF/services/org.camunda.spin.spi.DataFormatProvider @@ -0,0 +1 @@ +org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatProvider diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/org/camunda/spin/impl/xml/dom/format/strip-space.xsl b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/org/camunda/spin/impl/xml/dom/format/strip-space.xsl new file mode 100644 index 0000000000000000000000000000000000000000..fa02c1847d6cebb1c64161dfbe087d055fdc2cb5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/main/resources/org/camunda/spin/impl/xml/dom/format/strip-space.xsl @@ -0,0 +1,14 @@ + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomAttributeGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomAttributeGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4cb3be42612792aca93f6cab8c94d32f7fb6b5cd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomAttributeGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomAttributeScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("groovy") +public class XmlDomAttributeGroovyTest extends XmlDomAttributeScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..27af113bcaa3b242d9c6b6ce415d90b2803a6b39 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomCreateScriptTest; + +/** + * @author Daniel Meyer + * + */ +@ScriptEngine("groovy") +public class XmlDomCreateGroovyTest extends XmlDomCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomElementGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomElementGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..8261be2ef87839b03e3114b37e3a8e715cd3c8aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomElementGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomElementScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("groovy") +public class XmlDomElementGroovyTest extends XmlDomElementScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4279678861ba55d521417e9858af153eff7c4561 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapJavaToXmlScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("groovy") +public class XmlDomMapJavaToXmlGroovyTest extends XmlDomMapJavaToXmlScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e7736de05f83a9f06f6b88c2895f0d6cec01e42f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapXmlToJavaScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("groovy") +public class XmlDomMapXmlToJavaGroovyTest extends XmlDomMapXmlToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..726dd684bd981c6df0c2dd66419285c151ca67ef --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.groovy.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomXPathScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("groovy") +public class XmlDomXPathGroovyTest extends XmlDomXPathScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c1b7099067e8d56163e4e0fcbf15a5bd0b27e82c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java @@ -0,0 +1,237 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import org.camunda.spin.DataFormats; +import org.camunda.spin.SpinFactory; +import org.camunda.spin.spi.DataFormat; +import org.camunda.spin.xml.JdkUtil; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Test; + +/** + * Test xml transformation in DomXmlDataFormatWriter + */ +public class DomXmlDataFormatWriterTest { + + private final String newLine = System.getProperty("line.separator"); + private final String xml = "MilkCoffee "; + + private final String formattedXmlIbmJDK = "" + newLine + + " Milk" + newLine + + " Coffee" + newLine + + " " + newLine + + ""; + + private final String formattedXml = formattedXmlIbmJDK + newLine; + + private final String formattedXmlWithWhitespaceInProductIbmJDK = "" + newLine + + " Milk" + newLine + + " Coffee" + newLine + + " " + newLine + + ""; + + private final String formattedXmlWithWhitespaceInProduct = formattedXmlWithWhitespaceInProductIbmJDK + newLine; + + + // this is what execution.setVariable("test", spinXml); does + // see https://github.com/camunda/camunda-bpm-platform/blob/master/engine-plugins/spin-plugin/src/main/java/org/camunda/spin/plugin/impl/SpinValueSerializer.java + private byte[] serializeValue(SpinXmlElement spinXml) throws UnsupportedEncodingException { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + OutputStreamWriter outWriter = new OutputStreamWriter(out, "UTF-8"); + BufferedWriter bufferedWriter = new BufferedWriter(outWriter); + + spinXml.writeToWriter(bufferedWriter); + return out.toByteArray(); + } + + public SpinXmlElement deserializeValue(byte[] serialized, DataFormat dataFormat) + throws UnsupportedEncodingException { + ByteArrayInputStream bais = new ByteArrayInputStream(serialized); + InputStreamReader inReader = new InputStreamReader(bais, "UTF-8"); + BufferedReader bufferedReader = new BufferedReader(inReader); + + Object wrapper = dataFormat.getReader().readInput(bufferedReader); + return dataFormat.createWrapperInstance(wrapper); + } + + /** + * IBM JDK does not generate a new line character at the end + * of an XSLT-transformed XML document. See CAM-14806. + */ + private String getExpectedFormattedXML(boolean withWhitespaceInElement) { + if (JdkUtil.runsOnIbmJDK()) { + return withWhitespaceInElement ? formattedXmlWithWhitespaceInProductIbmJDK : formattedXmlIbmJDK; + } else { + return withWhitespaceInElement ? formattedXmlWithWhitespaceInProduct : formattedXml; + } + } + + private String getExpectedFormattedXML() { + return getExpectedFormattedXML(false); + } + + /** + * standard behaviour: an unformatted XML will be formatted stored into a SPIN variable and also returned formatted. + */ + @Test + public void testStandardFormatter() throws Exception { + // given + DataFormat dataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + + SpinXmlElement spinXml = SpinFactory.INSTANCE.createSpin(xml, dataFormat); + + // when + byte[] serializedValue = serializeValue(spinXml); + + // then + // assert that there are now new lines in the serialized value: + assertThat(new String(serializedValue, "UTF-8")).isEqualTo(getExpectedFormattedXML()); + + // when + // this is what execution.getVariable("test"); does + SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); + + // then + assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML()); + } + + /** + * behaviour fixed by CAM-13699: an already formatted XML will be formatted stored into a SPIN variable and also + * returned formatted but no additional blank lines are inserted into the XML. + */ + @Test + public void testAlreadyFormattedXml() throws Exception { + // given + DataFormat dataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + + SpinXmlElement spinXml = SpinFactory.INSTANCE.createSpin(formattedXml, dataFormat); + + // when + byte[] serializedValue = serializeValue(spinXml); + + // then + // assert that there are no new lines in the serialized value: + assertThat(new String(serializedValue, "UTF-8")).isEqualTo(getExpectedFormattedXML()); + + // when + // this is what execution.getVariable("test"); does + SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); + + // then + assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML()); + } + + /** + * new feature provided by CAM-13699 - pretty print feature disabled. The XML is stored and returned as is. + */ + @Test + public void testDisabledPrettyPrintUnformatted() throws Exception { + // given + DataFormat dataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + ((DomXmlDataFormat) dataFormat).setPrettyPrint(false); + + SpinXmlElement spinXml = SpinFactory.INSTANCE.createSpin(xml, dataFormat); + + // when + byte[] serializedValue = serializeValue(spinXml); + + // then + // assert that xml has not been formatted + assertThat(new String(serializedValue, "UTF-8")).isEqualTo(xml); + + // when + // this is what execution.getVariable("test"); does + SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); + + // then + assertThat(spinXmlElement.toString()).isEqualTo(xml); + } + + /** + * new feature provided by CAM-13699 - pretty print feature disabled. The XML is stored and returned as is. + */ + @Test + public void testDisabledPrettyPrintFormatted() throws Exception { + + // given + String expectedXml = "" + newLine + + " Milk" + newLine + + " Coffee" + newLine + + " " + newLine + + ""; + + DataFormat dataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + ((DomXmlDataFormat) dataFormat).setPrettyPrint(false); + + SpinXmlElement spinXml = SpinFactory.INSTANCE.createSpin(formattedXmlWithWhitespaceInProduct, dataFormat); + + // when + byte[] serializedValue = serializeValue(spinXml); + + // then + // assert that xml has not been formatted + assertThat(new String(serializedValue, "UTF-8")).isEqualTo(expectedXml); + + // when + // this is what execution.getVariable("test"); does + SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); + + // then + assertThat(spinXmlElement.toString()).isEqualTo(expectedXml); + } + + /** + * new feature provided by https://github.com/camunda/camunda-bpm-platform/issues/3633: custom formatting + * configuration to preserve-space. + */ + @Test + public void testCustomStripSpaceXSL() throws Exception { + final DataFormat dataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + + try (final InputStream inputStream = DomXmlDataFormatWriterTest.class.getClassLoader() + .getResourceAsStream("org/camunda/spin/strip-space-preserve-space.xsl")) { + ((DomXmlDataFormat) dataFormat).setFormattingConfiguration(inputStream); + } + + final SpinXmlElement spinXml = SpinFactory.INSTANCE.createSpin(this.xml, dataFormat); + + // when + final byte[] serializedValue = serializeValue(spinXml); + + // then + // assert that xml has not been formatted + assertThat(new String(serializedValue, "UTF-8")).isEqualTo(getExpectedFormattedXML(true)); + + // when + // this is what execution.getVariable("test"); does + final SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); + + // then + assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML(true)); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDeserializationValidationTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDeserializationValidationTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3189bddf5cbda763b1449f58c2a1558c4be6ecf4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/impl/xml/dom/format/DomXmlDeserializationValidationTest.java @@ -0,0 +1,157 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.impl.xml.dom.format; + +import org.camunda.spin.DeserializationTypeValidator; +import org.camunda.spin.SpinRuntimeException; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; + +public class DomXmlDeserializationValidationTest { + + protected DeserializationTypeValidator validator; + protected static DomXmlDataFormat format; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @BeforeClass + public static void setUpMocks() { + format = new DomXmlDataFormat("test"); + } + + @AfterClass + public static void tearDown() { + format = null; + } + + @Test + public void shouldValidateNothingForPrimitiveClass() { + // given + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(int.class, validator); + + // then + Mockito.verifyZeroInteractions(validator); + } + + @Test + public void shouldValidateBaseTypeOnlyForBaseClass() { + // given + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(String.class, validator); + + // then + Mockito.verify(validator).validate("java.lang.String"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateBaseTypeOnlyForComplexClass() { + // given + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(Complex.class, validator); + + // then + Mockito.verify(validator).validate("org.camunda.spin.impl.xml.dom.format.DomXmlDeserializationValidationTest$Complex"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldValidateContentTypeOnlyForArrayClass() { + // given + validator = createValidatorMock(true); + + // when + format.getMapper().validateType(Integer[].class, validator); + + // then + Mockito.verify(validator).validate("java.lang.Integer"); + Mockito.verifyNoMoreInteractions(validator); + } + + @Test + public void shouldFailForSimpleClass() { + // given + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("'java.lang.String'"); + + // when + format.getMapper().validateType(String.class, validator); + } + + @Test + public void shouldFailForComplexClass() { + // given + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("'org.camunda.spin.impl.xml.dom.format.DomXmlDeserializationValidationTest$Complex'"); + + // when + format.getMapper().validateType(Complex.class, validator); + } + + @Test + public void shouldFailForArrayClass() { + // given + validator = createValidatorMock(false); + + // then + thrown.expect(SpinRuntimeException.class); + thrown.expectMessage("'java.lang.Integer'"); + + // when + format.getMapper().validateType(Integer[].class, validator); + } + + public static class Complex { + private Nested nested; + + public Nested getNested() { + return nested; + } + } + + public static class Nested { + private int testInt; + + public int getTestInt() { + return testInt; + } + } + + protected DeserializationTypeValidator createValidatorMock(boolean result) { + DeserializationTypeValidator newValidator = Mockito.mock(DeserializationTypeValidator.class); + Mockito.when(newValidator.validate(Mockito.anyString())).thenReturn(result); + return newValidator; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..c573babf1b55f35dd6392ae7476762405743806b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeJavascriptTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomAttributeScriptTest; + +@ScriptEngine("nashorn") +public class XmlDomAttributeJavascriptTest extends XmlDomAttributeScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e926d506cd840658c791115d116b193955560059 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.java @@ -0,0 +1,25 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomCreateScriptTest; + +@ScriptEngine("nashorn") +public class XmlDomCreateJavascriptTest extends XmlDomCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..99aabe5709fc421cb3383856b96f43029a23e07b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementJavascriptTest.java @@ -0,0 +1,66 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.dom.XmlDomElementScriptTest; +import org.junit.Test; + +@ScriptEngine("nashorn") +public class XmlDomElementJavascriptTest extends XmlDomElementScriptTest { + + /** + * The Nashorn scripting engine cannot determine the method to call if the + * parameter is null. + */ + + @Test(expected = RuntimeException.class) + @Script( + name = "XmlDomElementScriptTest.appendChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true) + }, + execute = false + ) + public void cannotAppendNullChildElement() throws Throwable { + failingWithException(); + } + + /** + * The Nashorn scripting engine cannot determine the method to call if the + * parameter is null. + */ + @Test(expected = RuntimeException.class) + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void cannotRemoveANullChildElement() throws Throwable { + failingWithException(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..53c92a651220b88e5261ab942c5ed2a92c825d57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapJavaToXmlScriptTest; + +@ScriptEngine("nashorn") +public class XmlDomMapJavaToXmlJavascriptTest extends XmlDomMapJavaToXmlScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fe3fa628e2cc69b13f248cdc736cb74c867b9e14 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapXmlToJavaScriptTest; + +@ScriptEngine("nashorn") +public class XmlDomMapXmlToJavaJavascriptTest extends XmlDomMapXmlToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..73a260fb920bc00c88bfa8621613d2aa2831016f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.java @@ -0,0 +1,24 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.nashorn.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomXPathScriptTest; + +@ScriptEngine("nashorn") +public class XmlDomXPathJavascriptTest extends XmlDomXPathScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomAttributeJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomAttributeJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..fc381a3ef55314fbfae924e8638cbeb1bd03eb52 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomAttributeJavascriptTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomAttributeScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("graal.js") +public class XmlDomAttributeJavascriptTest extends XmlDomAttributeScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3d1336f71b74e85cdc3b1e2ae501bb283e9c821b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomCreateScriptTest; + +/** + * @author Daniel Meyer + * + */ +@ScriptEngine("graal.js") +public class XmlDomCreateJavascriptTest extends XmlDomCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomElementJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomElementJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..aa79372f7d918697ac8b96c776672af161077aa8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomElementJavascriptTest.java @@ -0,0 +1,69 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.dom.XmlDomElementScriptTest; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("graal.js") +public class XmlDomElementJavascriptTest extends XmlDomElementScriptTest { + + /** + * The Graal.js scripting engine cannot determine the method to call if the + * parameter is null. + */ + + @Test(expected = RuntimeException.class) + @Script( + name = "XmlDomElementScriptTest.appendChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true) + }, + execute = false + ) + public void cannotAppendNullChildElement() throws Throwable { + failingWithException(); + } + + /** + * The Graal.js scripting engine cannot determine the method to call if the + * parameter is null. + */ + @Test(expected = RuntimeException.class) + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void cannotRemoveANullChildElement() throws Throwable { + failingWithException(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..901b9d540c166e83835b206080871ad73286e2c2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapJavaToXmlScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("graal.js") +public class XmlDomMapJavaToXmlJavascriptTest extends XmlDomMapJavaToXmlScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6a78478d838951cdb0bd5fb64f77a62a4fb5be1e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapXmlToJavaScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("graal.js") +public class XmlDomMapXmlToJavaJavascriptTest extends XmlDomMapXmlToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..ab2d7279aa814f71c0ddde9fbb1a5268084f70fa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.javascript.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomXPathScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("graal.js") +public class XmlDomXPathJavascriptTest extends XmlDomXPathScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomAttributePythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomAttributePythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..af470aa953afae8cd7f59fb4cc4d378671b7259f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomAttributePythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomAttributeScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("python") +public class XmlDomAttributePythonTest extends XmlDomAttributeScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2dfc936a6ba002df7c154a5b094bd514a0717878 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomCreateScriptTest; + +/** + * @author Daniel Meyer + * + */ +@ScriptEngine("python") +public class XmlDomCreatePythonTest extends XmlDomCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomElementPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomElementPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..db583ce91f22341f78a941a8f8461370a2968ca1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomElementPythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomElementScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("python") +public class XmlDomElementPythonTest extends XmlDomElementScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7158df769d10250c0a3dfc9b469213056551a86a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapJavaToXmlScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("python") +public class XmlDomMapJavaToXmlPythonTest extends XmlDomMapJavaToXmlScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..6849b3a90cd827ec1509b6bd0eaa67a8f2f802fd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapXmlToJavaScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("python") +public class XmlDomMapXmlToJavaPythonTest extends XmlDomMapXmlToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.java new file mode 100644 index 0000000000000000000000000000000000000000..e60d0b350f6af74557c012d076e1b57d5e2d25ac --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.python.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomXPathScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("python") +public class XmlDomXPathPythonTest extends XmlDomXPathScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomAttributeRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomAttributeRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..41aa8607211ad5dea967ad8a4aa1921a20e9dcf8 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomAttributeRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomAttributeScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("ruby") +public class XmlDomAttributeRubyTest extends XmlDomAttributeScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b210badcaf7659337d499562d446a6617e11a1d0 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.java @@ -0,0 +1,29 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomCreateScriptTest; + +/** + * @author Daniel Meyer + * + */ +@ScriptEngine("ruby") +public class XmlDomCreateRubyTest extends XmlDomCreateScriptTest { + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomElementRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomElementRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..17430391ea34463bba64efca5383d22fa0aec89d --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomElementRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomElementScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("ruby") +public class XmlDomElementRubyTest extends XmlDomElementScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..97fd4b70fd77629a8f0a24e9f2da5e657f8a6353 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapJavaToXmlScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("ruby") +public class XmlDomMapJavaToXmlRubyTest extends XmlDomMapJavaToXmlScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d2db004c25a70d8a8e037ff9d77f583f5bb3e767 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomMapXmlToJavaScriptTest; + +/** + * @author Stefan Hentschel. + */ +@ScriptEngine("ruby") +public class XmlDomMapXmlToJavaRubyTest extends XmlDomMapXmlToJavaScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.java new file mode 100644 index 0000000000000000000000000000000000000000..90c02dfac8b8524062a1c108958e2a92aebf61d3 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.java @@ -0,0 +1,27 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.ruby.xml.dom; + +import org.camunda.spin.impl.test.ScriptEngine; +import org.camunda.spin.xml.dom.XmlDomXPathScriptTest; + +/** + * @author Sebastian Menski + */ +@ScriptEngine("ruby") +public class XmlDomXPathRubyTest extends XmlDomXPathScriptTest { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/JdkUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/JdkUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..2f7382050992dbd40b1fee75ec0da5bec8ef18fd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/JdkUtil.java @@ -0,0 +1,30 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +public class JdkUtil { + + public static boolean runsOnIbmJDK() { + String vendor = System.getProperty("java.vm.vendor"); + + if (vendor == null) { + return false; + } else { + return vendor.contains("IBM"); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestConstants.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..38ef8ba771c2766400f48abbe49e94b765635ed9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestConstants.java @@ -0,0 +1,163 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.tuple; + +import java.io.Reader; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; + +import javax.xml.XMLConstants; +import javax.xml.transform.Source; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; + +import org.camunda.spin.impl.util.SpinIoUtil; +import org.camunda.spin.xml.mapping.Customer; +import org.camunda.spin.xml.mapping.Order; +import org.camunda.spin.xml.mapping.OrderDetails; +import org.xml.sax.SAXException; + +/** + * @author Daniel Meyer + * + */ +public class XmlTestConstants { + + public static final String EXAMPLE_NAMESPACE = "http://camunda.org/example"; + + public static final String EXAMPLE_XML_FILE_NAME = "org/camunda/spin/xml/example.xml"; + + public static final String EXAMPLE_VALIDATION_XSD_FILE_NAME = "org/camunda/spin/xml/validation_schema.xsd"; + public static final String EXAMPLE_VALIDATION_EXTENSION_XSD_FILE_NAME = "org/camunda/spin/xml/validation_schema_extension.xsd"; + + public static final String EXAMPLE_VALIDATION_XML_FILE_NAME = "org/camunda/spin/xml/validation_example.xml"; + + public static final String EXAMPLE_XML = SpinIoUtil.fileAsString(EXAMPLE_XML_FILE_NAME); + + public static final String EXAMPLE_VALIDATION_XML = SpinIoUtil.fileAsString(EXAMPLE_VALIDATION_XML_FILE_NAME); + + public static final String EXAMPLE_INVALID_XML = " customers = order.getCustomer(); + assertThat(customers).isNotNull(); + assertThat(customers.size()).isEqualTo(3); + + assertThat(customers).extracting("name", "contractStartDate") + .contains( + tuple("Kermit", 1354539722), + tuple("Waldo", 1320325322), + tuple("Johnny", 1286110922)); + } + + public static Order createExampleOrder() { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat dateFormat2 = new SimpleDateFormat("yyyy-MM-dd"); + + Date detailsDate = new Date(); + Date dueUntilDate = new Date(); + + try { + detailsDate = dateFormat2.parse("2015-04-04"); + dueUntilDate = dateFormat.parse("20150112"); + } catch (ParseException e) { + // will fail if date is not set + } + + Order order = new Order(); + OrderDetails details = new OrderDetails(); + Customer customer1 = new Customer(); + Customer customer2 = new Customer(); + Customer customer3 = new Customer(); + + LinkedList customers = new LinkedList(); + customers.add(customer1); + customers.add(customer2); + customers.add(customer3); + + customer1.setId("customer1"); + customer1.setName("Kermit"); + customer1.setContractStartDate(1354539722); + + customer2.setId("customer2"); + customer2.setName("Waldo"); + customer2.setContractStartDate(1320325322); + + customer3.setId("customer3"); + customer3.setName("Johnny"); + customer3.setContractStartDate(1286110922); + + details.setDate(detailsDate); + details.setId(1234567890L); + details.setProduct("camunda BPM"); + + order.setOrder("order1"); + order.setDueUntil(dueUntilDate); + order.setOrderDetails(details); + order.setCustomer(customers); + + return order; + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestUtil.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..beee885fc05ed1428f6b2f20dee479922394a8b5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/XmlTestUtil.java @@ -0,0 +1,46 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml; + +public class XmlTestUtil { + /** + * Example input 2015-04-04T00:00:00+02:00 -> 2015-04-04 + * + * @param input a string containing timezone offset + * @return same as input string without the timezone offset + */ + public static String removeTimeZone(String input) { + if (input == null) { + return null; + } + + final String TIMEZONE = "T00:00:00"; + final String CLOSING_BRACKET = "<"; + + int indexOfTimezone = input.indexOf(TIMEZONE); + if (indexOfTimezone == -1) { + return input; + } + + int indexOfClosingBracket = input.indexOf(CLOSING_BRACKET, indexOfTimezone); + if (indexOfClosingBracket == -1) { + return input; + } + + return input.substring(0, indexOfTimezone) + input.substring(indexOfClosingBracket); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..34f69d59dfb86f10135b1db68d2d67ecb0f48ab4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeScriptTest.java @@ -0,0 +1,78 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.SpinXmlAttributeException; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public abstract class XmlDomAttributeScriptTest extends ScriptTest { + + @Test + @Script( + name = "XmlDomAttributeScriptTest.testAttribute", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "attributeName", value = "order"), + @ScriptVariable(name = "valueToSet", value = "order2") + } + ) + public void shouldGetInformationAndSetValue() { + assertThat((String) script.getVariable("name")).isEqualTo("order"); + assertThat((String) script.getVariable("value")).isEqualTo("order1"); + assertThat((String) script.getVariable("namespace")).isNull(); + assertThat(script.getVariable("hasNullNamespace")).isTrue(); + assertThat((String) script.getVariable("newValue")).isEqualTo("order2"); + } + + @Test(expected = SpinXmlAttributeException.class) + @Script( + name = "XmlDomAttributeScriptTest.testAttribute", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "attributeName", value = "order"), + @ScriptVariable(name = "valueToSet", isNull = true) + }, + execute = false + ) + public void setNullValue() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomAttributeScriptTest.removeAttribute", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "attributeName", value = "order") + } + ) + public void remove() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttr("order")).isFalse(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeTest.java new file mode 100644 index 0000000000000000000000000000000000000000..9cedbbc236cf3677f0169fbaad824585977a8461 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomAttributeTest.java @@ -0,0 +1,97 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.Spin.XML; + +import java.io.StringWriter; + +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlAttributeException; +import org.camunda.spin.xml.SpinXmlElement; +import org.camunda.spin.xml.XmlTestConstants; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public class XmlDomAttributeTest { + + private SpinXmlAttribute attribute; + + @Before + public void getAttribute() { + attribute = XML(XmlTestConstants.EXAMPLE_XML).attr("order"); + } + + @Test + public void getValue() { + assertThat(attribute.value()).isEqualTo("order1"); + } + + @Test + public void getName() { + assertThat(attribute.name()).isEqualTo("order"); + } + + @Test + public void getNamespace() { + assertThat(attribute.namespace()).isNull(); + } + + @Test + public void hasNamespace() { + assertThat(attribute.hasNamespace(null)).isTrue(); + } + + @Test + public void setValue() { + assertThat(attribute.value("order2").value()).isEqualTo("order2"); + } + + @Test(expected = SpinXmlAttributeException.class) + public void setNullValue() { + attribute.value(null); + } + + @Test + public void remove() { + String namespace = attribute.namespace(); + String name = attribute.name(); + + SpinXmlElement element = attribute.remove(); + assertThat(element.hasAttrNs(namespace, name)).isFalse(); + } + + // test io + + @Test + public void canWriteToString() { + assertThat(attribute.toString()).isEqualTo("order1"); + } + + @Test + public void canWriteToWriter() { + StringWriter writer = new StringWriter(); + attribute.writeToWriter(writer); + String value = writer.toString(); + assertThat(value).isEqualTo("order1"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..106d35223223fd6e0d9856cf712e9961e26b3da9 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateScriptTest.java @@ -0,0 +1,82 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML_FILE_NAME; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Test; + +/** + * @author Daniel Meyer + * + */ +public abstract class XmlDomCreateScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name="input", value = "") + public void shouldCreateForString() { + + SpinXmlElement xml1 = script.getVariable("xml1"); + assertThat(xml1).isNotNull(); + + SpinXmlElement xml2 = script.getVariable("xml2"); + assertThat(xml2).isNotNull(); + + SpinXmlElement xml3 = script.getVariable("xml3"); + assertThat(xml3).isNotNull(); + + } + + @Test + @Script( + variables = { + @ScriptVariable(name="input1", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name="input2", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name="input3", file = EXAMPLE_XML_FILE_NAME) + } + ) + public void shouldCreateForReader() { + + SpinXmlElement xml1 = script.getVariable("xml1"); + assertThat(xml1).isNotNull(); + + SpinXmlElement xml2 = script.getVariable("xml2"); + assertThat(xml2).isNotNull(); + + SpinXmlElement xml3 = script.getVariable("xml3"); + assertThat(xml3).isNotNull(); + + } + + @Test + @Script + @ScriptVariable(name="input", file = EXAMPLE_XML_FILE_NAME) + public void shouldBeIdempotent() { + + SpinXmlElement xml = script.getVariable("xml"); + assertThat(xml).isNotNull(); + + } + +} + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5037f5c455fe187ad63773bf8ac5ec7b340850dc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomCreateTest.java @@ -0,0 +1,245 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.DataFormats.xml; +import static org.camunda.spin.Spin.S; +import static org.camunda.spin.Spin.XML; +import static org.camunda.spin.impl.util.SpinIoUtil.stringAsReader; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_EMPTY_STRING; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_INVALID_XML; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML; + +import java.io.Reader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.spi.SpinDataFormatException; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Test; + +/** + * @author Daniel Meyer + * + */ +public class XmlDomCreateTest { + + @Test + public void shouldCreateForString() { + SpinXmlElement xml = XML(EXAMPLE_XML); + assertThat(xml).isNotNull(); + + xml = S(EXAMPLE_XML, xml()); + assertThat(xml).isNotNull(); + + xml = S(EXAMPLE_XML, DataFormats.XML_DATAFORMAT_NAME); + assertThat(xml).isNotNull(); + + xml = S(EXAMPLE_XML); + assertThat(xml).isNotNull(); + } + + @Test + public void shouldCreateForReader() { + SpinXmlElement xml = XML(stringAsReader(EXAMPLE_XML)); + assertThat(xml).isNotNull(); + + xml = S(stringAsReader(EXAMPLE_XML), xml()); + assertThat(xml).isNotNull(); + + xml = S(stringAsReader(EXAMPLE_XML), DataFormats.XML_DATAFORMAT_NAME); + assertThat(xml).isNotNull(); + + xml = S(stringAsReader(EXAMPLE_XML)); + assertThat(xml).isNotNull(); + } + + @Test + public void shouldBeIdempotent() { + SpinXmlElement xml = XML(EXAMPLE_XML); + assertThat(xml).isEqualTo(XML(xml)); + assertThat(xml).isEqualTo(S(xml, xml())); + assertThat(xml).isEqualTo(S(xml, DataFormats.XML_DATAFORMAT_NAME)); + assertThat(xml).isEqualTo(S(xml)); + } + + @Test + public void shouldFailForNull() { + SpinXmlElement xmlTreeElement = null; + + try { + XML(xmlTreeElement); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(xmlTreeElement, xml()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(xmlTreeElement); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + Reader reader = null; + + try { + XML(reader); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(reader, xml()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(reader); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + String inputString = null; + + try { + XML(inputString); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString, xml()); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString, DataFormats.XML_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + + try { + S(inputString); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected + } + } + + @Test + public void shouldFailForInvalidXml() { + try { + XML(EXAMPLE_INVALID_XML); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_XML, xml()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_XML, DataFormats.XML_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_INVALID_XML); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void shouldFailForEmptyString() { + try { + XML(EXAMPLE_EMPTY_STRING); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING, xml()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING, DataFormats.XML_DATAFORMAT_NAME); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(EXAMPLE_EMPTY_STRING); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } + + @Test + public void shouldFailForEmptyReader() { + try { + XML(stringAsReader(EXAMPLE_EMPTY_STRING)); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(stringAsReader(EXAMPLE_EMPTY_STRING), xml()); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + + try { + S(stringAsReader(EXAMPLE_EMPTY_STRING)); + fail("Expected IllegalArgumentException"); + } catch(SpinDataFormatException e) { + // expected + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomDataFormatReaderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomDataFormatReaderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..59b49718cb2071489b1cf0efb4913f9df19506be --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomDataFormatReaderTest.java @@ -0,0 +1,79 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML; + +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatReader; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class XmlDomDataFormatReaderTest { + + private DomXmlDataFormatReader reader; + private Reader inputReader; + + private static final int REWINDING_LIMIT = 256; + + @Before + public void setUp() { + DomXmlDataFormat domXmlDataFormat = new DomXmlDataFormat(DataFormats.XML_DATAFORMAT_NAME); + reader = domXmlDataFormat.getReader(); + } + + @Test + public void shouldMatchXmlInput() throws IOException { + inputReader = stringToReader(EXAMPLE_XML); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + inputReader.close(); + } + + @Test + public void shouldMatchXmlInputWithWhitespace() throws IOException { + inputReader = stringToReader(" " + EXAMPLE_XML); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + inputReader.close(); + + inputReader = stringToReader("\r\n\t " + EXAMPLE_XML); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isTrue(); + } + + @Test + public void shouldNotMatchInvalidXml() throws IOException { + inputReader = stringToReader("prefix " + EXAMPLE_XML); + assertThat(reader.canRead(inputReader, REWINDING_LIMIT)).isFalse(); + } + + public Reader stringToReader(String input) { + return new StringReader(input); + } + + @After + public void tearDown() throws IOException { + if (inputReader != null) { + inputReader.close(); + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..7696a6cca6399af06fa3158b250cc8b2d8f38f3c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementScriptTest.java @@ -0,0 +1,1302 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.S; +import static org.camunda.spin.Spin.XML; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_NAMESPACE; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML_FILE_NAME; +import static org.camunda.spin.xml.XmlTestConstants.NON_EXISTING; +import static org.camunda.spin.xml.XmlTestConstants.exampleXmlFileAsReader; + +import java.util.HashMap; +import java.util.List; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlAttributeException; +import org.camunda.spin.xml.SpinXmlElement; +import org.camunda.spin.xml.SpinXmlElementException; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public abstract class XmlDomElementScriptTest extends ScriptTest { + + // has attribute + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canCheckAttributeByName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isTrue(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING) + } + ) + public void canCheckAttributeByNonExistingName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.checkAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void canCheckAttributeByNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "dueUntil") + } + ) + public void canCheckAttributeByNamespaceAndName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isTrue(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canCheckAttributeByNonExistingNamespaceAndName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.checkAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void canCheckAttributeByNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = NON_EXISTING) + } + ) + public void canCheckAttributeByNamespaceAndNonExistingName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isFalse(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.checkAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canCheckAttributeByNullNamespaceAndName() { + Boolean hasAttribute = script.getVariable("hasAttribute"); + assertThat(hasAttribute).isTrue(); + } + + // read attribute + + @Test + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "order") + }, + execute = false + ) + public void canReadAttributeByName() throws Throwable { + script.setVariable("variables", new HashMap()); + script.execute(); + String value = script.getVariable("value"); + assertThat(value).isEqualTo("order1"); + } + + @Test(expected = SpinXmlAttributeException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotReadAttributeByNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotReadAttributeByNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "dueUntil") + } + ) + public void canReadAttributeByNamespaceAndName() { + String value = script.getVariable("value"); + assertThat(value).isEqualTo("20150112"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canReadAttributeByNullNamespaceAndName() { + String value = script.getVariable("value"); + assertThat(value).isEqualTo("order1"); + } + + @Test(expected = SpinXmlAttributeException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "order") + }, + execute = false + ) + public void cannotReadAttributeByNonExistingNamespaceAndName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlAttributeException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotReadAttributeByNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotReadAttributeByNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlAttributeException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotReadAttributeByNonExistingNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.readAttributeValueByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotReadAttributeByNullNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + // write attribute + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", value = "order2") + } + ) + public void canWriteAttributeByName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("order2"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING), + @ScriptVariable(name = "value", value = "newValue") + } + ) + public void canWriteAttributeByNonExistingName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("newValue"); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true), + @ScriptVariable(name = "value", value = "order2") + }, + execute = false + ) + public void canWriteAttributeByNullName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", isNull = true) + }, + execute = false + ) + public void cannotWriteAttributeByNameWithNullValue() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", value = "order2") + } + ) + public void canWriteAttributeByNamespaceAndName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("order2"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = NON_EXISTING), + @ScriptVariable(name = "value", value = "order2") + } + ) + public void canWriteAttributeByNamespaceAndNonExistingName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("order2"); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true), + @ScriptVariable(name = "value", value = "order2") + }, + execute = false + ) + public void canWriteAttributeByNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", isNull = true) + }, + execute = false + ) + public void canWriteAttributeByNamespaceAndNameWithNullValue() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", value = "order2") + } + ) + public void canWriteAttributeByNullNamespaceAndName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("order2"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeAttributeValueByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "order"), + @ScriptVariable(name = "value", value = "order2") + } + ) + public void canWriteAttributeByNonExistingNamespaceAndName() { + String newValue = script.getVariable("newValue"); + assertThat(newValue).isEqualTo("order2"); + } + + // remove attribute + + @Test + @Script( + name = "XmlDomElementScriptTest.removeAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canRemoveAttributeByName() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttr("order")).isFalse(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING) + } + ) + public void canRemoveAttributeByNonExistingName() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttr(NON_EXISTING)).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.removeAttributeByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotRemoveAttributeByNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canRemoveAttributeByNamespaceAndName() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttrNs(EXAMPLE_NAMESPACE, "order")).isFalse(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canRemoveAttributeByNullNamespaceAndName() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttrNs(null, "order")).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.removeAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void canRemoveAttributeByNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeAttributeByNamespaceAndName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "order") + } + ) + public void canRemoveAttributeByNonExistingNamespaceAndName() { + SpinXmlElement element = script.getVariable("element"); + assertThat(element.hasAttrNs(NON_EXISTING, "order")).isFalse(); + } + + // get attributes + + @Test + @Script("XmlDomElementScriptTest.getAllAttributesAndNames") + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME) + public void canGetAllAttributes() { + SpinList attributes = script.getVariable("attributes"); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil", "xmlns", "ex"); + } + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE) + } + ) + public void canGetAllAttributesByNamespace() { + SpinList attributes = script.getVariable("attributes"); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil"); + assertThat(attribute.value()).isIn("order1", "20150112"); + assertThat(attribute.namespace()).isEqualTo(EXAMPLE_NAMESPACE); + } + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true) + } + ) + public void canGetAllAttributesByNullNamespace() { + SpinList attributes = script.getVariable("attributes"); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil"); + assertThat(attribute.value()).isIn("order1", "20150112"); + assertThat(attribute.namespace()).isNull(); + } + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING) + } + ) + public void canGetAllAttributesByNonExistingNamespace() { + SpinList attributes = script.getVariable("attributes"); + assertThat(attributes).isEmpty(); + } + + @Test + @Script("XmlDomElementScriptTest.getAllAttributesAndNames") + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME) + public void canGetAllAttributeNames() { + List names = script.getVariable("names"); + assertThat(names).containsOnly("order", "dueUntil", "xmlns", "ex"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE) + } + ) + public void canGetAllAttributeNamesByNamespace() { + List names = script.getVariable("names"); + assertThat(names).containsOnly("dueUntil"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true) + } + ) + public void canGetAllAttributeNamesByNullNamespace() { + List names = script.getVariable("names"); + assertThat(names).containsOnly("order"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING) + } + ) + public void canGetAllAttributeNamesByNonExistingNamespace() { + List names = script.getVariable("names"); + assertThat(names).isEmpty(); + } + + // get child element + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementByName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "date") + } + ) + public void canGetSingleChildElementByName() { + SpinXmlElement childElement = script.getVariable("childElement"); + assertThat(childElement).isNotNull(); + assertThat(childElement.attr("name").value()).isEqualTo("20140512"); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetSingleChildElementByNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByName", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetSingleChildElementByNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "date") + } + ) + public void canGetSingleChildElementByNamespaceAndName() { + SpinXmlElement childElement = script.getVariable("childElement"); + assertThat(childElement).isNotNull(); + assertThat(childElement.attr("name").value()).isEqualTo("20140512"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "file") + } + ) + public void canGetSingleChildElementByNullNamespaceAndName() { + SpinXmlElement childElement = script.getVariable("childElement"); + assertThat(childElement).isNotNull(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetChildElementByNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetChildElementByNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "date") + }, + execute = false + ) + public void cannotGetChildElementByNonExistingNamespaceAndName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetChildElementByNonExistingNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetChildElementByNullNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + // append child element + + @Test + @Script( + name = "XmlDomElementScriptTest.appendChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", value = "") + } + ) + public void canAppendChildElement() { + SpinXmlElement element = script.getVariable("element"); + + SpinXmlElement child = element.childElement(null, "child"); + assertThat(child).isNotNull(); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.appendChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", value = "") + } + ) + public void canAppendChildElementWithNamespace() { + SpinXmlElement element = script.getVariable("element"); + + SpinXmlElement child = element.childElement(EXAMPLE_NAMESPACE, "child"); + assertThat(child).isNotNull(); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.appendChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true) + }, + execute = false + ) + public void cannotAppendNullChildElement() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.appendChildElementAtPosition", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", value = "") + } + ) + public void canAppendChildElementAtPosition() { + SpinXmlElement element = script.getVariable("element"); + + SpinList childs = element.childElements(); + + assertThat(childs.get(0).name()).isEqualTo("child"); + assertThat(childs.get(2).name()).isEqualTo("child"); + assertThat(childs.get(childs.size() - 1).name()).isEqualTo("child"); + } + + // remove child elements + + @Test + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", isNull = true), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void canRemoveAChildElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + SpinXmlElement child = XML(""); + element.append(child); + + element = script + .setVariable("element", element) + .setVariable("child", child) + .execute() + .getVariable("element"); + + try { + assertThat(element.childElement(null, "child")); + fail("Child element should be removed"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child", isNull = true), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void cannotRemoveANullChildElement() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void cannotRemoveANonChildElement() throws Throwable { + script.setVariable("child", S("")); + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", isNull = true) + }, + execute = false + ) + public void canRemoveMultipleChildElements() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + SpinXmlElement child1 = XML(""); + SpinXmlElement child2 = XML(""); + element.append(child1, child2); + + element = script + .setVariable("element", element) + .setVariable("child", child1) + .setVariable("child2", child2) + .execute() + .getVariable("element"); + + try { + assertThat(element.childElement(null, "child")); + fail("Child elements should be removed"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test + @Script( + name = "XmlDomElementScriptTest.removeChildElement", + variables = { + @ScriptVariable(name = "input", isNull = true), + @ScriptVariable(name = "child2", isNull = true) + }, + execute = false + ) + public void canRemoveChildElementCollection() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + element.append(XML(""), XML(""), XML("")); + + element = script + .setVariable("element", element) + .setVariable("child", element.childElements(null, "child")) + .execute() + .getVariable("element"); + + try { + assertThat(element.childElement(null, "child")); + fail("Child elements should be removed"); + } + catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + // get child elements + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementsByName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = "customer") + } + ) + public void canGetAllChildElementsByName() { + SpinList childElements = script.getVariable("childElements"); + assertThat(childElements).hasSize(3); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetAllChildElementsByNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetAllChildElementsByNullName() throws Throwable { + failingWithException(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = "customer") + } + ) + public void canGetAllChildElementsByNamespaceAndName() { + SpinList childElements = script.getVariable("childElements"); + assertThat(childElements).hasSize(3); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", value = "info") + } + ) + public void canGetAllChildElementsByNullNamespaceAndName() { + SpinList childElements = script.getVariable("childElements"); + assertThat(childElements).hasSize(2); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = "customer") + }, + execute = false + ) + public void cannotGetAllChildElementsByNonExistingNamespaceAndName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetAllChildElementsByNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = EXAMPLE_NAMESPACE), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetAllChildElementsByNamespaceAndNonNullName() throws Throwable { + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", value = NON_EXISTING), + @ScriptVariable(name = "name", value = NON_EXISTING) + }, + execute = false + ) + public void cannotGetAllChildElementsByNonExistingNamespaceAndNonExistingName() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.getChildElementsByNamespaceAndName", + variables = { + @ScriptVariable(name= "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "namespace", isNull = true), + @ScriptVariable(name = "name", isNull = true) + }, + execute = false + ) + public void cannotGetAllChildElementsByNullNamespaceAndNullName() throws Throwable { + failingWithException(); + } + + // replace child element + + @Test + @Script( + name = "XmlDomElementScriptTest.replaceChildElement", + variables = { + @ScriptVariable(name = "input", isNull = true), + @ScriptVariable(name = "newChild", value = "") + }, + execute = false + ) + public void canReplaceAChildElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + SpinXmlElement date = element.childElement("date"); + + element = script + .setVariable("element", element) + .setVariable("existingChild", date) + .execute() + .getVariable("element"); + + assertThat(element.childElement(null, "child")).isNotNull(); + try { + element.childElement("date"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.replaceChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "existingChild", isNull = true), + @ScriptVariable(name = "newChild", value = "") + }, + execute = false + ) + public void cannotReplaceANullChildElement() throws Throwable { + failingWithException(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.replaceChildElement", + variables = { + @ScriptVariable(name = "input", isNull = true), + @ScriptVariable(name = "newChild", isNull = true) + }, + execute = false + ) + public void cannotReplaceByANullChildElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + SpinXmlElement date = element.childElement("date"); + + script + .setVariable("element", element) + .setVariable("existingChild", date); + failingWithException(); + } + + @Test(expected = SpinXmlElementException.class) + @Script( + name = "XmlDomElementScriptTest.replaceChildElement", + variables = { + @ScriptVariable(name = "input", file = EXAMPLE_XML_FILE_NAME), + @ScriptVariable(name = "newChild", value = "") + }, + execute = false + ) + public void cannotReplaceANoneChildElement() throws Throwable { + script.setVariable("existingChild", XML("")); + failingWithException(); + } + + // replace element + + @Test + @Script( + name = "XmlDomElementScriptTest.replaceElement", + variables = { + @ScriptVariable(name = "newElement", value = "") + }, + execute = false + ) + public void canReplaceElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + script + .setVariable("oldElement", element.childElement("date")) + .execute(); + + assertThat(element.childElement(null, "child")).isNotNull(); + try { + element.childElement("date"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + + } + + @Test + @Script( + name = "XmlDomElementScriptTest.replaceElement", + variables = { + @ScriptVariable(name = "newElement", value = "") + }, + execute = false + ) + public void canReplaceRootElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + element = script + .setVariable("oldElement", element) + .execute() + .getVariable("element"); + + assertThat(element.name()).isEqualTo("root"); + assertThat(element.childElements()).isEmpty(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.replaceElement", + variables = { + @ScriptVariable(name = "newElement", isNull = true) + }, + execute = false + ) + public void cannotReplaceByNullElement() throws Throwable { + SpinXmlElement element = XML(exampleXmlFileAsReader()); + script + .setVariable("oldElement", element); + failingWithException(); + } + + @Test + @Script("XmlDomElementScriptTest.readTextContent") + @ScriptVariable(name = "input", value="Foo") + public void canReadTextContent() { + String textContent = script.getVariable("textContent"); + assertThat(textContent).isEqualTo("Foo"); + } + + @Test + @Script("XmlDomElementScriptTest.readTextContent") + @ScriptVariable(name = "input", value="") + public void canEmptyReadTextContent() { + String textContent = script.getVariable("textContent"); + assertThat(textContent).isEmpty(); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeTextContent", + variables = { + @ScriptVariable(name = "input", value=""), + @ScriptVariable(name = "text", value = "Foo") + } + ) + public void canWriteTextContent() { + String textContent = script.getVariable("textContent"); + assertThat(textContent).isEqualTo("Foo"); + } + + @Test + @Script( + name = "XmlDomElementScriptTest.writeTextContent", + variables = { + @ScriptVariable(name = "input", value=""), + @ScriptVariable(name = "text", value = "") + } + ) + public void canWriteEmptyTextContent() { + String textContent = script.getVariable("textContent"); + assertThat(textContent).isEmpty(); + } + + @Test(expected = IllegalArgumentException.class) + @Script( + name = "XmlDomElementScriptTest.writeTextContent", + variables = { + @ScriptVariable(name = "input", value=""), + @ScriptVariable(name = "text", isNull = true) + }, + execute = false + ) + public void cannotWriteNullTextContent() throws Throwable { + failingWithException(); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementTest.java new file mode 100644 index 0000000000000000000000000000000000000000..aa5def835112be17e9c4d28ff9c98e4907e14186 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomElementTest.java @@ -0,0 +1,745 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.S; +import static org.camunda.spin.Spin.XML; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_NAMESPACE; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_XML; +import static org.camunda.spin.xml.XmlTestConstants.NON_EXISTING; +import static org.camunda.spin.xml.XmlTestConstants.exampleXmlFileAsReader; + +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.camunda.spin.SpinList; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlAttributeException; +import org.camunda.spin.xml.SpinXmlElement; +import org.camunda.spin.xml.SpinXmlElementException; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public class XmlDomElementTest { + + protected SpinXmlElement element; + + @Before + public void parseXml() { + element = S(exampleXmlFileAsReader()); + } + + // has attribute + + @Test + public void canCheckAttributeByName() { + boolean hasAttribute = element.hasAttr("order"); + assertThat(hasAttribute).isTrue(); + } + + @Test + public void canCheckAttributeByNonExistingName() { + boolean hasAttribute = element.hasAttr(NON_EXISTING); + assertThat(hasAttribute).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotCheckAttributeByNullName() { + element.hasAttr(null); + } + + @Test + public void canCheckAttributeByNamespaceAndName() { + boolean hasAttribute = element.hasAttrNs(EXAMPLE_NAMESPACE, "order"); + assertThat(hasAttribute).isFalse(); + } + + @Test + public void canCheckAttributeByNamespaceAndNonExistingName() { + boolean hasAttribute = element.hasAttrNs(EXAMPLE_NAMESPACE, NON_EXISTING); + assertThat(hasAttribute).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + public void canCheckAttributeByNamespaceAndNullName() { + element.hasAttrNs(EXAMPLE_NAMESPACE, null); + } + + @Test + public void canCheckAttributeByNonExistingNamespaceAndName() { + boolean hasAttribute = element.hasAttrNs(NON_EXISTING, "order"); + assertThat(hasAttribute).isFalse(); + } + + @Test + public void canCheckAttributeByNullNamespaceAndName() { + boolean hasAttribute = element.hasAttrNs(null, "order"); + assertThat(hasAttribute).isTrue(); + } + + // read attribute + + @Test + public void canReadAttributeByName() { + SpinXmlAttribute attribute = element.attr("order"); + String value = attribute.value(); + assertThat(value).isEqualTo("order1"); + } + + @Test(expected = SpinXmlAttributeException.class) + public void cannotReadAttributeByNonExistingName() { + element.attr(NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReadAttributeByNullName() { + element.attr(null); + } + + @Test + public void canReadAttributeByNamespaceAndName() { + SpinXmlAttribute attribute = element.attrNs(EXAMPLE_NAMESPACE, "dueUntil"); + String value = attribute.value(); + assertThat(value).isEqualTo("20150112"); + } + + @Test + public void canReadAttributeByNullNamespaceAndName() { + SpinXmlAttribute attribute = element.attrNs(null, "order"); + String value = attribute.value(); + assertThat(value).isEqualTo("order1"); + } + + @Test(expected = SpinXmlAttributeException.class) + public void cannotReadAttributeByNonExistingNamespaceAndName() { + element.attrNs(NON_EXISTING, "order"); + } + + @Test(expected = SpinXmlAttributeException.class) + public void cannotReadAttributeByNamespaceAndNonExistingName() { + element.attrNs(EXAMPLE_NAMESPACE, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReadAttributeByNamespaceAndNullName() { + element.attrNs(EXAMPLE_NAMESPACE, null); + } + + @Test(expected = SpinXmlAttributeException.class) + public void cannotReadAttributeByNonExistingNamespaceAndNonExistingName() { + element.attrNs(NON_EXISTING, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReadAttributeByNullNamespaceAndNullName() { + element.attrNs(null, null); + } + + // write attribute + + @Test + public void canWriteAttributeByName() { + String newValue = element.attr("order", "order2").attr("order").value(); + assertThat(newValue).isEqualTo("order2"); + } + + @Test + public void canWriteAttributeByNonExistingName() { + String newValue = element.attr(NON_EXISTING, "newValue").attr(NON_EXISTING).value(); + assertThat(newValue).isEqualTo("newValue"); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotWriteAttributeByNullName() { + element.attr(null, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void canWriteAttributeByNameWithNullValue() { + element.attr("order", null); + } + + @Test + public void canWriteAttributeByNamespaceAndName() { + String newValue = element.attrNs(EXAMPLE_NAMESPACE, "order", "order2").attrNs(EXAMPLE_NAMESPACE, "order").value(); + assertThat(newValue).isEqualTo("order2"); + } + + @Test + public void canWriteAttributeByNamespaceAndNonExistingName() { + String newValue = element.attrNs(EXAMPLE_NAMESPACE, NON_EXISTING, "newValue").attrNs(EXAMPLE_NAMESPACE, NON_EXISTING).value(); + assertThat(newValue).isEqualTo("newValue"); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotWriteAttributeByNamespaceAndNullName() { + element.attrNs(EXAMPLE_NAMESPACE, null, "newValue"); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotWriteAttributeByNamespaceAndNameWithNullValue() { + element.attrNs(EXAMPLE_NAMESPACE, "order", null); + } + + @Test + public void canWriteAttributeByNonExistingNamespaceAndName() { + String newValue = element.attrNs(NON_EXISTING, "order", "newValue").attrNs(NON_EXISTING, "order").value(); + assertThat(newValue).isEqualTo("newValue"); + } + + @Test + public void canWriteAttributeByNullNamespaceAndName() { + String newValue = element.attrNs(null, "order", "order2").attrNs(null, "order").value(); + assertThat(newValue).isEqualTo("order2"); + } + + // remove attribute + + @Test + public void canRemoveAttributeByName() { + element.removeAttr("order"); + assertThat(element.hasAttr("order")).isFalse(); + } + + @Test + public void canRemoveAttributeByNonExistingName() { + element.removeAttr(NON_EXISTING); + assertThat(element.hasAttr(NON_EXISTING)).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotRemoveAttributeByNullName() { + element.removeAttr(null); + } + + @Test + public void canRemoveAttributeByNamespaceAndName() { + element.removeAttrNs(EXAMPLE_NAMESPACE, "order"); + assertThat(element.hasAttrNs(EXAMPLE_NAMESPACE, "order")).isFalse(); + } + + @Test + public void canRemoveAttributeByNullNamespaceAndName() { + element.removeAttrNs(null, "order"); + assertThat(element.hasAttrNs(null, "order")).isFalse(); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotRemoveAttributeByNamespaceAndNullName() { + element.removeAttrNs(EXAMPLE_NAMESPACE, null); + } + + @Test + public void canRemoveAttributeByNonExistingNamespaceAndName() { + element.removeAttrNs(NON_EXISTING, "order"); + assertThat(element.hasAttrNs(NON_EXISTING, "order")).isFalse(); + } + + // get attributes + + @Test + public void canGetAllAttributes() { + SpinList attributes = element.attrs(); + assertThat(attributes).hasSize(4); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil", "xmlns", "ex"); + } + } + + @Test + public void canGetAllAttributesByNamespace() { + SpinList attributes = element.attrs(EXAMPLE_NAMESPACE); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil"); + assertThat(attribute.value()).isIn("order1", "20150112"); + assertThat(attribute.namespace()).isEqualTo(EXAMPLE_NAMESPACE); + } + } + + @Test + public void canGetAllAttributesByNullNamespace() { + SpinList attributes = element.attrs(null); + for (SpinXmlAttribute attribute : attributes) { + assertThat(attribute.name()).isIn("order", "dueUntil"); + assertThat(attribute.value()).isIn("order1", "20150112"); + assertThat(attribute.namespace()).isNull(); + } + } + + @Test + public void canGetAllAttributesByNonExistingNamespace() { + SpinList attributes = element.attrs(NON_EXISTING); + assertThat(attributes).isEmpty(); + } + + // get attribute names + + @Test + public void canGetAllAttributeNames() { + List names = element.attrNames(); + assertThat(names).containsOnly("order", "dueUntil", "xmlns", "ex"); + } + + @Test + public void canGetAllAttributeNamesByNamespace() { + List names = element.attrNames(EXAMPLE_NAMESPACE); + assertThat(names).containsOnly("dueUntil"); + } + + @Test + public void canGetAllAttributeNamesByNullNamespace() { + List names = element.attrNames(null); + assertThat(names).containsOnly("order"); + } + + @Test + public void canGetAllAttributeNamesByNonExistingNamespace() { + List names = element.attrNames(NON_EXISTING); + assertThat(names).isEmpty(); + } + + // get child element + + @Test + public void canGetSingleChildElementByName() { + SpinXmlElement childElement = element.childElement("date"); + assertThat(childElement).isNotNull(); + assertThat(childElement.attr("name").value()).isEqualTo("20140512"); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetSingleChildElementByNonExistingName() { + element.childElement(NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetSingleChildElementByNullName() { + element.childElement(null); + } + + @Test + public void canGetSingleChildElementByNamespaceAndName() { + SpinXmlElement childElement = element.childElement(EXAMPLE_NAMESPACE, "date"); + assertThat(childElement).isNotNull(); + assertThat(childElement.attr("name").value()).isEqualTo("20140512"); + } + + @Test + public void canGetSingleChildElementByNullNamespaceAndName() { + SpinXmlElement childElement = element.childElement(null, "file"); + assertThat(childElement).isNotNull(); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetChildElementByNamespaceAndNonExistingName() { + element.childElement(EXAMPLE_NAMESPACE, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetChildElementByNamespaceAndNullName() { + element.childElement(EXAMPLE_NAMESPACE, null); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetChildElementByNonExistingNamespaceAndName() { + element.childElement(NON_EXISTING, "date"); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetChildElementByNonExistingNamespaceAndNonExistingName() { + element.childElement(NON_EXISTING, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetChildElementByNullNamespaceAndNullName() { + element.childElement(null, null); + } + + // append child element + + @Test + public void canAppendChildElement() { + SpinXmlElement child = XML(""); + element = element.append(child); + + child.attr("id", "child"); + child = element.childElement(null, "child"); + + assertThat(child).isNotNull(); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + public void canAppendChildElementWithNamespace() { + SpinXmlElement child = XML(""); + element = element.append(child); + + child.attr("id", "child"); + child = element.childElement(EXAMPLE_NAMESPACE, "child"); + + assertThat(child).isNotNull(); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + public void canAppendMultipleChildElements() { + SpinXmlElement child1 = XML(""); + SpinXmlElement child2 = XML(""); + SpinXmlElement child3 = XML(""); + + element = element.append(child1, child2, child3); + + child1.attr("id", "child"); + child2.attr("id", "child"); + child3.attr("id", "child"); + + SpinList childs = element.childElements(null, "child"); + assertThat(childs).hasSize(3); + + for (SpinXmlElement childElement : childs) { + assertThat(childElement).isNotNull(); + assertThat(childElement.attr("id").value()).isEqualTo("child"); + } + } + + @Test + public void canAppendChildElementCollection() { + Collection childElements = new ArrayList(); + childElements.add(XML("")); + childElements.add(XML("")); + childElements.add(XML("")); + + element = element.append(childElements); + + SpinList childs = element.childElements(null, "child"); + assertThat(childs).hasSize(3); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotAppendNullChildElements() { + element.append((SpinXmlElement[]) null); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotAppendNullChildElement() { + SpinXmlElement child = XML(""); + element.append(child, null); + } + + @Test + public void canAppendChildElementBeforeExistingElement() { + SpinXmlElement child = XML(""); + SpinXmlElement date = element.childElement("date"); + element.appendBefore(child, date); + SpinXmlElement insertedElement = element.childElements().get(0); + assertThat(insertedElement.name()).isEqualTo("child"); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotAppendChildElementBeforeNonChildElement() { + SpinXmlElement child = XML(""); + element.appendBefore(child, child); + } + + @Test + public void canAppendChildElementAfterExistingElement() { + SpinXmlElement child = XML(""); + SpinXmlElement date = element.childElement("date"); + element.appendAfter(child, date); + SpinXmlElement insertedElement = element.childElements().get(1); + assertThat(insertedElement.name()).isEqualTo("child"); + } + + @Test + public void canAppendChildElementAfterLastChildElement() { + SpinXmlElement child = XML(""); + int childCount = element.childElements().size(); + SpinXmlElement lastChildElement = element.childElements().get(childCount - 1); + element.appendAfter(child, lastChildElement); + SpinXmlElement insertedElement = element.childElements().get(childCount); + assertThat(insertedElement.name()).isEqualTo("child"); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotAppendChildElementAfterNonChildElement() { + SpinXmlElement child = XML(""); + element.appendAfter(child, child); + } + + // remove child elements + + @Test + public void canRemoveAChildElement() { + SpinXmlElement child = XML(""); + element.append(child); + + assertThat(element.childElement(null, "child")).isNotNull(); + + element.remove(child); + + try { + assertThat(element.childElement(null, "child")); + fail("Child element should be removed"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test(expected = IllegalArgumentException.class) + public void cannotRemoveANullChildElement() { + SpinXmlElement child = XML(""); + element.append(child); + + element.remove(child, null); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotRemoveNonChildElement() { + SpinXmlElement child1 = XML(""); + SpinXmlElement child2 = XML(""); + + element.append(child1); + + element.remove(child1, child2); + } + + @Test + public void canRemoveMultipleChildElements() { + SpinXmlElement child1 = XML(""); + SpinXmlElement child2 = XML(""); + SpinXmlElement child3 = XML(""); + element.append(child1, child2, child3); + + assertThat(element.childElements(null, "child")).hasSize(3); + + element.remove(child1, child2, child3); + + try { + assertThat(element.childElements(null, "child")); + fail("Child element should be removed"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test + public void canRemoveChildElementCollection() { + SpinXmlElement child1 = XML(""); + SpinXmlElement child2 = XML(""); + SpinXmlElement child3 = XML(""); + element.append(child1, child2, child3); + + assertThat(element.childElements(null, "child")).hasSize(3); + + element.remove(element.childElements(null, "child")); + + try { + assertThat(element.childElements(null, "child")); + fail("Child element should be removed"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + + } + + @Test(expected = IllegalArgumentException.class) + public void cannotRemoveNullChildElements() { + element.remove((SpinXmlElement[]) null); + } + + // get child elements + + @Test + public void canGetAllChildElements() { + SpinList childElements = element.childElements(); + assertThat(childElements).hasSize(7); + } + + @Test + public void canGetAllChildElementsByName() { + SpinList childElements = element.childElements("customer"); + assertThat(childElements).hasSize(3); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetAllChildElementsByNonExistingName() { + element.childElements(NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetAllChildElementsByNullName() { + element.childElements(null); + } + + @Test + public void canGetAllChildElementsByNamespaceAndName() { + SpinList childElements = element.childElements(EXAMPLE_NAMESPACE, "customer"); + assertThat(childElements).hasSize(3); + } + + @Test + public void canGetAllChildElementsByNullNamespaceAndName() { + SpinList childElements = element.childElements(null, "info"); + assertThat(childElements).hasSize(2); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetAllChildElementsByNonExistingNamespaceAndName() { + element.childElements(NON_EXISTING, "customer"); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetAllChildElementsByNamespaceAndNonExistingName() { + element.childElements(EXAMPLE_NAMESPACE, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetAllChildElementsByNamespaceAndNullName() { + element.childElements(EXAMPLE_NAMESPACE, null); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotGetAllChildElementsByNonExistingNamespaceAndNonExistingName() { + element.childElements(NON_EXISTING, NON_EXISTING); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotGetAllChildElementsByNullNamespaceAndNullName() { + element.childElements(null, null); + } + + // replace child element + + @Test + public void canReplaceAChildElement() { + SpinXmlElement child = XML(""); + SpinXmlElement date = element.childElement("date"); + assertThat(date).isNotNull(); + + element.replaceChild(date, child); + + assertThat(element.childElement(null, "child")).isNotNull(); + try { + element.childElement("date"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReplaceANullChildElement() { + SpinXmlElement child = XML(""); + element.replaceChild(null, child); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReplaceByANullChildElement() { + SpinXmlElement date = element.childElement("date"); + element.replaceChild(date, null); + } + + @Test(expected = SpinXmlElementException.class) + public void cannotReplaceANonChildElement() { + SpinXmlElement child = XML(""); + SpinXmlElement nonChild = XML(""); + element.replaceChild(nonChild, child); + } + + + // replace element + + @Test + public void canReplaceAElement() { + SpinXmlElement child = XML(""); + SpinXmlElement date = element.childElement("date"); + assertThat(date).isNotNull(); + + date.replace(child); + + assertThat(element.childElement(null, "child")).isNotNull(); + try { + element.childElement("date"); + } catch (Exception e) { + assertThat(e).isInstanceOf(SpinXmlElementException.class); + } + } + + @Test + public void canReplaceRootElement() { + SpinXmlElement root = XML(""); + assertThat(element.name()).isEqualTo("customers"); + assertThat(element.childElements()).isNotEmpty(); + element = element.replace(root); + assertThat(element.name()).isEqualTo("root"); + assertThat(element.childElements()).isEmpty(); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotReplaceByNullElement() { + element.replace(null); + } + + // test io + + @Test + public void canWriteToString() { + assertThat(element.toString()).isXmlEqualTo(EXAMPLE_XML); + } + + @Test + public void canWriteToWriter() { + StringWriter writer = new StringWriter(); + element.writeToWriter(writer); + String value = writer.toString(); + assertThat(value).isXmlEqualTo(EXAMPLE_XML); + } + + // text content + + @Test + public void canReadTextContent() { + assertThat(XML("Foo").textContent()).isEqualTo("Foo"); + } + + @Test + public void canReadEmptyTextContent() { + assertThat(XML("").textContent()).isEmpty(); + } + + @Test + public void canWriteTextContent() { + assertThat(XML("").textContent("Foo").textContent()).isEqualTo("Foo"); + } + + @Test + public void canWriteEmptyTextContent() { + assertThat(XML("Foo").textContent("").textContent()).isEmpty(); + } + + @Test(expected = IllegalArgumentException.class) + public void cannotWriteNullTextContent() { + XML("").textContent(null); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..b232461542c6e1cea525e2dfe52ebd846613eb71 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlScriptTest.java @@ -0,0 +1,52 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_VALIDATION_XML; +import static org.camunda.spin.xml.XmlTestConstants.createExampleOrder; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.xml.XmlTestUtil; +import org.camunda.spin.xml.mapping.Order; +import org.junit.Test; + +public abstract class XmlDomMapJavaToXmlScriptTest extends ScriptTest{ + + @Test + @Script(execute = false) + public void shouldMapJavaToXml() throws Throwable { + Order order = createExampleOrder(); + + script.setVariable("input", order); + script.execute(); + String xml = script.getVariable("xml"); + + //In EXAMPLE_VALIDATION_XML, expected date is hardcoded in CET timezone, ignoring it so that it passes when ran in + //different timezone + String exampleValidationXmlWoTimezone = XmlTestUtil.removeTimeZone(EXAMPLE_VALIDATION_XML); + xml = XmlTestUtil.removeTimeZone(xml); + assertThat(xml).isXmlEqualTo(exampleValidationXmlWoTimezone); + } + + @Test(expected = IllegalArgumentException.class) + @Script(execute = false) + public void shouldFailWithNull() throws Throwable { + failingWithException(); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlTest.java new file mode 100644 index 0000000000000000000000000000000000000000..09403c785e94b9b66859a74b897e8e6cd4286446 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapJavaToXmlTest.java @@ -0,0 +1,64 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Fail.fail; +import static org.camunda.spin.Spin.XML; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_VALIDATION_XML; +import static org.camunda.spin.xml.XmlTestConstants.createExampleOrder; + +import org.camunda.spin.xml.XmlTestUtil; +import org.camunda.spin.xml.mapping.NonXmlRootElementType; +import org.camunda.spin.xml.mapping.Order; +import org.junit.Test; + +public class XmlDomMapJavaToXmlTest { + + @Test + public void shouldMapJavaToXml() { + Order order = createExampleOrder(); + String orderAsString = XML(order).toString(); + //In EXAMPLE_VALIDATION_XML, expected date is hardcoded in CET timezone, ignoring it so that it passes when ran in + //different timezone + String exampleValidationXmlWoTimezone = XmlTestUtil.removeTimeZone(EXAMPLE_VALIDATION_XML); + orderAsString = XmlTestUtil.removeTimeZone(orderAsString); + assertThat(orderAsString).isXmlEqualTo(exampleValidationXmlWoTimezone); + } + + @Test + public void shouldMapNonXmlRootElementToXml() { + NonXmlRootElementType nonXmlRootElementType = new NonXmlRootElementType(); + nonXmlRootElementType.setProperty("propValue"); + + String xmlString = XML(nonXmlRootElementType).toString(); + + NonXmlRootElementType nonXmlRootElementType2 = XML(xmlString).mapTo(NonXmlRootElementType.class); + assertThat(nonXmlRootElementType).isEqualTo(nonXmlRootElementType2); + } + + @Test + @SuppressWarnings("unused") + public void shouldFailWithNull() { + try { + String s = XML(null).toString(); + fail("Expected IllegalArgumentException"); + } catch(IllegalArgumentException e) { + // expected! + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..d40975956122f1e3c98ba61441c43327f08e45ad --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaScriptTest.java @@ -0,0 +1,49 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_VALIDATION_XML_FILE_NAME; +import static org.camunda.spin.xml.XmlTestConstants.assertIsExampleOrder; + +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.SpinXmlDataFormatException; +import org.camunda.spin.xml.mapping.Order; +import org.junit.Test; + +/** + * @author Stefan Hentschel. + */ +public abstract class XmlDomMapXmlToJavaScriptTest extends ScriptTest { + + @Test + @Script + @ScriptVariable(name = "input", file = EXAMPLE_VALIDATION_XML_FILE_NAME) + public void shouldMapXmlToJava() { + Order order = script.getVariable("order"); + assertIsExampleOrder(order); + } + + @Test(expected = SpinXmlDataFormatException.class) + @Script(execute = false) + @ScriptVariable(name = "input", file = EXAMPLE_VALIDATION_XML_FILE_NAME) + public void shouldFailMappingMalformedTypeString() throws Throwable { + failingWithException(); + } + +} \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaTest.java new file mode 100644 index 0000000000000000000000000000000000000000..1733c7bf7391f7ebe1340333c444978a712c88fe --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomMapXmlToJavaTest.java @@ -0,0 +1,51 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.fail; +import static org.camunda.spin.Spin.XML; +import static org.camunda.spin.xml.XmlTestConstants.EXAMPLE_VALIDATION_XML; +import static org.camunda.spin.xml.XmlTestConstants.assertIsExampleOrder; + +import org.camunda.spin.xml.SpinXmlDataFormatException; +import org.camunda.spin.xml.mapping.Order; +import org.junit.Test; + +public class XmlDomMapXmlToJavaTest { + + @Test + public void shouldMapXmlObjectToJavaObject() { + Order order = XML(EXAMPLE_VALIDATION_XML).mapTo(Order.class); + assertIsExampleOrder(order); + } + + @Test + public void shouldMapByCanonicalString() { + Order order = XML(EXAMPLE_VALIDATION_XML).mapTo(Order.class.getCanonicalName()); + assertIsExampleOrder(order); + } + + @Test + public void shouldFailForMalformedTypeString() { + try { + XML(EXAMPLE_VALIDATION_XML).mapTo("rubbish"); + fail("Expected SpinXmlDataFormatException"); + } catch (SpinXmlDataFormatException e) { + // happy path + } + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathScriptTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathScriptTest.java new file mode 100644 index 0000000000000000000000000000000000000000..4fb2e0ed58fc42bc6e940e67a04881eb2a41ab57 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathScriptTest.java @@ -0,0 +1,441 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.camunda.spin.SpinList; +import org.camunda.spin.impl.test.Script; +import org.camunda.spin.impl.test.ScriptTest; +import org.camunda.spin.impl.test.ScriptVariable; +import org.camunda.spin.xml.SpinXPathException; +import org.camunda.spin.xml.SpinXPathQuery; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public abstract class XmlDomXPathScriptTest extends ScriptTest { + + private static final String xml = ""; + private static final String xmlWithNamespace = ""; + private static final String xmlWithDefaultNamespace = ""; + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsElement() { + SpinXPathQuery query = script.getVariable("query"); + query.element(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsElementList() { + SpinXPathQuery query = script.getVariable("query"); + query.elementList(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsAttribute() { + SpinXPathQuery query = script.getVariable("query"); + query.attribute(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsAttributeList() { + SpinXPathQuery query = script.getVariable("query"); + query.attributeList(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsString() { + SpinXPathQuery query = script.getVariable("query"); + query.string(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsNumber() { + SpinXPathQuery query = script.getVariable("query"); + query.number(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/") + } + ) + public void canNotQueryDocumentAsBoolean() { + SpinXPathQuery query = script.getVariable("query"); + query.bool(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child") + } + ) + public void canQueryElement() { + SpinXPathQuery query = script.getVariable("query"); + SpinXmlElement child = query.element(); + assertThat(child.name()).isEqualTo("child"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/nonExisting") + } + ) + public void canNotQueryElement() { + SpinXPathQuery query = script.getVariable("query"); + query.element(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child") + } + ) + public void canNotQueryElementAsAttribute() { + SpinXPathQuery query = script.getVariable("query"); + query.attribute(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/a") + } + ) + public void canQueryElementList() { + SpinXPathQuery query = script.getVariable("query"); + SpinList childs = query.elementList(); + assertThat(childs).hasSize(2); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/nonExisting") + } + ) + public void canNotQueryElementList() { + SpinXPathQuery query = script.getVariable("query"); + query.elementList(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/@id") + } + ) + public void canQueryAttribute() { + SpinXPathQuery query = script.getVariable("query"); + SpinXmlAttribute attribute = query.attribute(); + assertThat(attribute.value()).isEqualTo("child"); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/@nonExisting") + } + ) + public void canNotQueryAttribute() { + SpinXPathQuery query = script.getVariable("query"); + query.attribute(); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/@id") + } + ) + public void canNotQueryAttributeAsElement() { + SpinXPathQuery query = script.getVariable("query"); + query.element(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/a/@id") + } + ) + public void canQueryAttributeList() { + SpinXPathQuery query = script.getVariable("query"); + SpinList attributes = query.attributeList(); + assertThat(attributes).hasSize(2); + } + + @Test(expected = SpinXPathException.class) + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "/root/child/a/@nonExisting") + } + ) + public void canNotQueryAttributeList() { + SpinXPathQuery query = script.getVariable("query"); + query.attributeList(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "string(/root/child/@id)") + } + ) + public void canQueryString() { + SpinXPathQuery query = script.getVariable("query"); + String value = query.string(); + assertThat(value).isEqualTo("child"); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "string(/root/child/@nonExisting)") + } + ) + public void canQueryNonExistingString() { + SpinXPathQuery query = script.getVariable("query"); + String value = query.string(); + assertThat(value).isEqualTo(""); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "string(/)") + } + ) + public void canQueryStringAsDocument() { + SpinXPathQuery query = script.getVariable("query"); + String value = query.string(); + assertThat(value).isEqualTo(""); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "count(/root/child/a)") + } + ) + public void canQueryNumber() { + SpinXPathQuery query = script.getVariable("query"); + Double count = query.number(); + assertThat(count).isEqualTo(2); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "count(/root/child/nonExisting)") + } + ) + public void canQueryNonExistingNumber() { + SpinXPathQuery query = script.getVariable("query"); + Double count = query.number(); + assertThat(count).isEqualTo(0); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "count(/)") + } + ) + public void canQueryNumberAsDocument() { + SpinXPathQuery query = script.getVariable("query"); + Double count = query.number(); + assertThat(count).isEqualTo(1); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "boolean(/root/child)") + } + ) + public void canQueryBooleanTrue() { + SpinXPathQuery query = script.getVariable("query"); + Boolean exists = query.bool(); + assertThat(exists).isTrue(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "boolean(/root/nonExisting)") + } + ) + public void canQueryNonExistingBoolean() { + SpinXPathQuery query = script.getVariable("query"); + Boolean exists = query.bool(); + assertThat(exists).isFalse(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.xPath", + variables = { + @ScriptVariable(name = "input", value = xml), + @ScriptVariable(name = "expression", value = "boolean(/)") + } + ) + public void canQueryBooleanAsDocument() { + SpinXPathQuery query = script.getVariable("query"); + Boolean exists = query.bool(); + assertThat(exists).isTrue(); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.canQueryElementWithNamespace", + variables = { + @ScriptVariable(name = "input", value = xmlWithNamespace), + @ScriptVariable(name = "expression", value = "/root/a:child") + } + ) + public void canQueryElementWithNamespace() { + SpinXPathQuery query = script.getVariable("query"); + SpinXmlElement child = query.element(); + + assertThat(child.name()).isEqualTo("child"); + assertThat(child.namespace()).isEqualTo("http://camunda.com"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + @Script( + variables = { + @ScriptVariable(name = "input", value = xmlWithNamespace), + @ScriptVariable(name = "expression", value = "/root/a:child") + } + ) + public void canQueryElementWithNamespaceMap() { + SpinXPathQuery query = script.getVariable("query"); + SpinXmlElement child = query.element(); + + assertThat(child.name()).isEqualTo("child"); + assertThat(child.namespace()).isEqualTo("http://camunda.com"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + @Script( + name = "XmlDomXPathScriptTest.canQueryElementWithNamespace", + variables = { + @ScriptVariable(name = "input", value = xmlWithDefaultNamespace), + @ScriptVariable(name = "expression", value = "/:root/a:child") + } + ) + public void canQueryElementWithDefaultNamespace() { + SpinXPathQuery query = script.getVariable("query"); + SpinXmlElement child = query.element(); + + assertThat(child.name()).isEqualTo("child"); + assertThat(child.namespace()).isEqualTo("http://camunda.com"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathTest.java new file mode 100644 index 0000000000000000000000000000000000000000..5856dd8046a6bcec6fbfc44a5b0b38f86301365b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/XmlDomXPathTest.java @@ -0,0 +1,220 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.camunda.spin.Spin.S; + +import java.util.HashMap; +import java.util.Map; + +import org.camunda.spin.SpinList; +import org.camunda.spin.xml.SpinXPathException; +import org.camunda.spin.xml.SpinXmlAttribute; +import org.camunda.spin.xml.SpinXmlElement; +import org.junit.Before; +import org.junit.Test; + +/** + * @author Sebastian Menski + */ +public class XmlDomXPathTest { + + protected SpinXmlElement element; + protected SpinXmlElement elementWithNamespace; + protected SpinXmlElement elementWithDefaultNamespace; + + @Before + public void parseXml() { + element = S(""); + elementWithNamespace = S(""); + elementWithDefaultNamespace = S(""); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsElement() { + element.xPath("/").element(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsElementList() { + element.xPath("/").elementList(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsAttribute() { + element.xPath("/").attribute(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsAttributeList() { + element.xPath("/").attributeList(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsString() { + element.xPath("/").string(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsNumber() { + element.xPath("/").number(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryDocumentAsBoolean() { + element.xPath("/").bool(); + } + + @Test + public void canQueryElement() { + SpinXmlElement child = element.xPath("/root/child").element(); + assertThat(child.name()).isEqualTo("child"); + assertThat(child.attr("id").value()).isEqualTo("child"); + + SpinXmlElement b = child.xPath("b").element(); + assertThat(b.name()).isEqualTo("b"); + assertThat(b.attr("id").value()).isEqualTo("b"); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryElement() { + element.xPath("/root/nonExisting").element(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryElementAsAttribute() { + element.xPath("/root/child/").attribute(); + } + + @Test + public void canQueryElementList() { + SpinList childs = element.xPath("/root/child/a").elementList(); + assertThat(childs).hasSize(2); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryElementList() { + element.xPath("/root/child/nonExisting").elementList(); + } + + @Test + public void canQueryAttribute() { + SpinXmlAttribute attribute = element.xPath("/root/child/@id").attribute(); + assertThat(attribute.value()).isEqualTo("child"); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryAttribute() { + element.xPath("/root/child/@nonExisting").attribute(); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryAttributeAsElement() { + element.xPath("/root/child/@id").element(); + } + + @Test + public void canQueryAttributeList() { + SpinList attributes = element.xPath("/root/child/a/@id").attributeList(); + assertThat(attributes).hasSize(2); + } + + @Test(expected = SpinXPathException.class) + public void canNotQueryAttributeList() { + element.xPath("/root/child/a/@nonExisting").attributeList(); + } + + @Test + public void canQueryString() { + String value = element.xPath("string(/root/child/@id)").string(); + assertThat(value).isEqualTo("child"); + + // can query not existing string + value = element.xPath("string(/root/child/@nonExisting)").string(); + assertThat(value).isEqualTo(""); + + // can query string as document + value = element.xPath("string(/)").string(); + assertThat(value).isEqualTo(""); + } + + @Test + public void canQueryNumber() { + Double count = element.xPath("count(/root/child/a)").number(); + assertThat(count).isEqualTo(2); + + // can query not existing number + count = element.xPath("count(/root/child/nonExisting)").number(); + assertThat(count).isEqualTo(0); + + // can query number as document + count = element.xPath("count(/)").number(); + assertThat(count).isEqualTo(1); + } + + @Test + public void canQueryBoolean() { + Boolean exists = element.xPath("boolean(/root/child)").bool(); + assertThat(exists).isTrue(); + + // can query not existing boolean + exists = element.xPath("boolean(/root/nonExisting)").bool(); + assertThat(exists).isFalse(); + + // can query boolean as document + exists = element.xPath("boolean(/)").bool(); + assertThat(exists).isTrue(); + } + + @Test + public void canQueryElementWithNamespace() { + SpinXmlElement child = elementWithNamespace.xPath("/root/a:child") + .ns("a", "http://camunda.com") + .element(); + + assertThat(child.name()).isEqualTo("child"); + assertThat(child.namespace()).isEqualTo("http://camunda.com"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } + + @Test + public void canQueryElementWithNamespaceMap() { + Map namespaces = new HashMap(); + namespaces.put("a", "http://camunda.com"); + namespaces.put("b", "http://camunda.org"); + + SpinXmlElement child = elementWithNamespace.xPath("/root/a:child/b:a") + .ns(namespaces) + .element(); + + assertThat(child.name()).isEqualTo("a"); + assertThat(child.namespace()).isEqualTo("http://camunda.org"); + assertThat(child.attr("id").value()).isEqualTo("a"); + } + + @Test + public void canQueryElementWithDefaultNamespace() { + SpinXmlElement child = elementWithDefaultNamespace.xPath("/:root/a:child") + .ns("a", "http://camunda.com") + .element(); + + assertThat(child.name()).isEqualTo("child"); + assertThat(child.namespace()).isEqualTo("http://camunda.com"); + assertThat(child.attr("id").value()).isEqualTo("child"); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/DomXmlDataFormatProtectionTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/DomXmlDataFormatProtectionTest.java new file mode 100644 index 0000000000000000000000000000000000000000..2e18723ee4fbb0294b48817c277bbab4747f2228 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/DomXmlDataFormatProtectionTest.java @@ -0,0 +1,75 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom.format.spi; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +import java.io.InputStream; +import java.io.InputStreamReader; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.JdkUtil; +import org.camunda.spin.xml.SpinXmlDataFormatException; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; + +public class DomXmlDataFormatProtectionTest { + + protected static DomXmlDataFormat format; + + @BeforeClass + public static void setUpMocks() { + format = (DomXmlDataFormat) DataFormats.xml(); + } + + @Test + public void shouldThrowExceptionForTooManyAttributes() { + // IBM JDKs do not check on attribute number limits, skip the test there + Assume.assumeFalse(JdkUtil.runsOnIbmJDK()); + + // given + String testXml = "org/camunda/spin/xml/dom/format/spi/FeatureSecureProcessing.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + + // when + assertThatThrownBy(() -> { + format.getReader().readInput(new InputStreamReader(testXmlAsStream)); + }) + // then + .isInstanceOf(SpinXmlDataFormatException.class); + } + + @Test + public void shouldThrowExceptionForDoctype() { + // given + String testXml = "org/camunda/spin/xml/dom/format/spi/XxeProcessing.xml"; + InputStream testXmlAsStream = this.getClass().getClassLoader().getResourceAsStream(testXml); + + // when + assertThatThrownBy(() -> { + format.getReader().readInput(new InputStreamReader(testXmlAsStream)); + }) + // then + .isInstanceOf(SpinXmlDataFormatException.class) + .hasMessageContaining("SPIN/DOM-XML-01009 Unable to parse input into DOM document") + .hasStackTraceContaining("DOCTYPE") + .hasStackTraceContaining("http://apache.org/xml/features/disallow-doctype-decl"); + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/EmptyContextProvider.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/EmptyContextProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..b438f9427e2de2227c472eb21c5a077766f3a9d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/EmptyContextProvider.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom.format.spi; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.camunda.spin.impl.xml.dom.DomXmlLogger; +import org.camunda.spin.impl.xml.dom.format.spi.JaxBContextProvider; + +/** + * @author Thorben Lindhauer + * + */ +public class EmptyContextProvider implements JaxBContextProvider { + + private static final DomXmlLogger LOG = DomXmlLogger.XML_DOM_LOGGER; + + public JAXBContext getContext() { + try { + return JAXBContext.newInstance(); + } catch (JAXBException e) { + throw LOG.unableToCreateContext(e); + } + } + + @Override + public Marshaller createMarshaller(Class... types) { + try { + return getContext().createMarshaller(); + } catch (JAXBException e) { + throw LOG.unableToCreateMarshaller(e); + } + } + + @Override + public Unmarshaller createUnmarshaller(Class... types) { + try { + return getContext().createUnmarshaller(); + } catch (JAXBException e) { + throw LOG.unableToCreateUnmarshaller(e); + } + } + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/JaxBContextProviderTest.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/JaxBContextProviderTest.java new file mode 100644 index 0000000000000000000000000000000000000000..17e57762e859e332da932fffcb6a1b9ae4bfe9a6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/dom/format/spi/JaxBContextProviderTest.java @@ -0,0 +1,83 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.dom.format.spi; + +import static org.assertj.core.api.Fail.fail; + +import java.io.StringWriter; +import java.util.HashSet; +import java.util.Set; + +import javax.xml.bind.JAXBException; + +import org.camunda.spin.DataFormats; +import org.camunda.spin.Spin; +import org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat; +import org.camunda.spin.xml.SpinXmlDataFormatException; +import org.camunda.spin.xml.SpinXmlElement; +import org.camunda.spin.xml.mapping.Customer; +import org.junit.After; +import org.junit.Test; + +/** + * @author Thorben Lindhauer + * + */ +public class JaxBContextProviderTest { + + /** + * This test uses a dataformat with a JAXBContext that cannot resolve any classes. + * Thus, it is expected that mapping an object to XML using this context fails. + */ + @Test + public void testCustomJaxBProvider() { + + Object objectToConvert = new Customer(); + + // using the default jaxb context provider for conversion should work + SpinXmlElement spinWrapper = Spin.XML(objectToConvert); + spinWrapper.writeToWriter(new StringWriter()); + + // using the custom jaxb context provider should fail with a JAXBException + ((DomXmlDataFormat) DataFormats.xml()).setJaxBContextProvider(new EmptyContextProvider()); + try { + spinWrapper = Spin.XML(objectToConvert); + spinWrapper.writeToWriter(new StringWriter()); + } catch (SpinXmlDataFormatException e) { + + // assert that there is a jaxb exception somewhere in the exception hierarchy + Set processedExceptions = new HashSet(); + while (!processedExceptions.contains(e.getCause()) && e.getCause() != null) { + if (e.getCause() instanceof JAXBException) { + // happy path + return; + } + + processedExceptions.add(e.getCause()); + } + + fail("expected a JAXBException in the cause hierarchy of the spin exception"); + } + + } + + @After + public void tearDown() { + // reset jaxb context provider + ((DomXmlDataFormat) DataFormats.xml()).setJaxBContextProvider(DomXmlDataFormat.defaultJaxBContextProvider()); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Customer.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Customer.java new file mode 100644 index 0000000000000000000000000000000000000000..89783352635c184ef072a20b4a5396b7485471dc --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Customer.java @@ -0,0 +1,62 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * @author Stefan Hentschel. + */ +@XmlRootElement(namespace = "http://camunda.org/example") +public class Customer { + + private String id; + private String name; + private int contractStartDate; + + // customer id attribute + @XmlAttribute + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + // + @XmlElement(namespace = "http://camunda.org/example") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + // + @XmlElement(namespace = "http://camunda.org/example") + public int getContractStartDate() { + return contractStartDate; + } + + public void setContractStartDate(int contractStartDate) { + this.contractStartDate = contractStartDate; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/DateAdapter.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/DateAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..7d2c5cf993d7aa46bab4ed82a3c5816c8c31e0bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/DateAdapter.java @@ -0,0 +1,40 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import javax.xml.bind.annotation.adapters.XmlAdapter; + +/** + * @author Stefan Hentschel. + */ +public class DateAdapter extends XmlAdapter { + + private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + + @Override + public Date unmarshal(String v) throws Exception { + return dateFormat.parse(v); + } + + @Override + public String marshal(Date v) throws Exception { + return dateFormat.format(v); + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Info.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Info.java new file mode 100644 index 0000000000000000000000000000000000000000..5e4cbca5273153d125e6feb153a6d1222761be39 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Info.java @@ -0,0 +1,26 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +import javax.xml.bind.annotation.XmlRootElement; + +/** + * @author Stefan Hentschel. + */ +@XmlRootElement +public class Info { +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/NonXmlRootElementType.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/NonXmlRootElementType.java new file mode 100644 index 0000000000000000000000000000000000000000..254c29459689b0427b512a4ae8c5b8063b7e245e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/NonXmlRootElementType.java @@ -0,0 +1,61 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +/** + * @author Daniel Meyer + * + */ +public class NonXmlRootElementType { + + protected String property; + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((property == null) ? 0 : property.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + NonXmlRootElementType other = (NonXmlRootElementType) obj; + if (property == null) { + if (other.property != null) + return false; + } else if (!property.equals(other.property)) + return false; + return true; + } + + +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Order.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Order.java new file mode 100644 index 0000000000000000000000000000000000000000..a29d05486033df01420a2fb1f83c04498c397397 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/Order.java @@ -0,0 +1,81 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +import java.util.Date; +import java.util.LinkedList; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; + +/** + * @author Stefan Hentschel. + */ +@XmlRootElement(name = "customers", namespace = "http://camunda.org/example") +public class Order { + private String order; + private Date dueUntil; + private String date; + private LinkedList customer; + private OrderDetails orderDetails; + + // + @XmlElement(name = "order-details", namespace = "http://camunda.org/example") + public OrderDetails getOrderDetails() { + return orderDetails; + } + + public void setOrderDetails(OrderDetails orderDetails) { + this.orderDetails = orderDetails; + } + + + // Due until attribute + @XmlAttribute(name = "dueUntil") + @XmlJavaTypeAdapter(DateAdapter.class) + public Date getDueUntil() { + return dueUntil; + } + + public void setDueUntil(Date dueUntil) { + this.dueUntil = dueUntil; + } + + + // order attribute + @XmlAttribute(name = "order") + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } + + + // + @XmlElement(namespace = "http://camunda.org/example") + public LinkedList getCustomer() { + return customer; + } + + public void setCustomer(LinkedList customer) { + this.customer = customer; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/OrderDetails.java b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/OrderDetails.java new file mode 100644 index 0000000000000000000000000000000000000000..01188061454c8ca8be0a7322a9918fb8fb49a97a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/java/org/camunda/spin/xml/mapping/OrderDetails.java @@ -0,0 +1,60 @@ +/* + * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH + * under one or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information regarding copyright + * ownership. Camunda licenses this file to you under the Apache License, + * Version 2.0; you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.camunda.spin.xml.mapping; + +import java.util.Date; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + * @author Stefan Hentschel. + */ +@XmlRootElement(name = "order-details", namespace = "http://camunda.org/test-example") +public class OrderDetails { + + private long id; + private Date date; + private String product; + + @XmlElement(namespace = "http://camunda.org/test-example") + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + @XmlElement(namespace = "http://camunda.org/test-example") + public Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + @XmlElement(namespace = "http://camunda.org/test-example") + public String getProduct() { + return product; + } + + public void setProduct(String product) { + this.product = product; + } +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.removeAttribute.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.removeAttribute.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e0272e046947fc51b612971111f80ff01aac447e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.removeAttribute.groovy @@ -0,0 +1 @@ +element = S(input).attr(attributeName).remove() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.testAttribute.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.testAttribute.groovy new file mode 100644 index 0000000000000000000000000000000000000000..b492f5a2b0ac0dbca11b252b3ca4d8c5d0d62318 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomAttributeScriptTest.testAttribute.groovy @@ -0,0 +1,6 @@ +attribute = S(input).attr(attributeName) +name = attribute.name() +value = attribute.value() +namespace = attribute.namespace() +hasNullNamespace = attribute.hasNamespace(null) +newValue = attribute.value(valueToSet).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldBeIdempotent.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldBeIdempotent.groovy new file mode 100644 index 0000000000000000000000000000000000000000..486a807b4b9cbcfbbe65aadc2d8cd70bb4946626 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldBeIdempotent.groovy @@ -0,0 +1,3 @@ +wrappedXml = S(input, "application/xml") + +xml = S(wrappedXml); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForReader.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForReader.groovy new file mode 100644 index 0000000000000000000000000000000000000000..145cb00d445fd356bffc04ca84e8b233d2329b5f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForReader.groovy @@ -0,0 +1,5 @@ +xml1 = S(input1, org.camunda.spin.DataFormats.xml()) + +xml2 = S(input2, "application/xml") + +xml3 = S(input3) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForString.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForString.groovy new file mode 100644 index 0000000000000000000000000000000000000000..1c0b803ccecf30cd31099e7021c478bad0bd0cdf --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomCreateGroovyTest.shouldCreateForString.groovy @@ -0,0 +1,5 @@ +xml1 = S(input, org.camunda.spin.DataFormats.xml()) + +xml2 = S(input, "application/xml") + +xml3 = S(input) \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElement.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElement.groovy new file mode 100644 index 0000000000000000000000000000000000000000..3661332dd8e4f9f7080e2477a962f9815982c818 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElement.groovy @@ -0,0 +1,6 @@ +if (child != null) { + child = S(child) +} + +element = S(input).append(child) +child.attr('id', 'child') diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.groovy new file mode 100644 index 0000000000000000000000000000000000000000..791ec4351d5873ad13665dd7c9ecf4c8202c505a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.groovy @@ -0,0 +1,14 @@ +package org.camunda.spin.groovy.xml.dom + +child1 = S(child) +child2 = S(child) +child3 = S(child) + +element = S(input) +childs = element.childElements() +firstChild = childs.get(0) +lastChild = childs.get(childs.size() - 1) + +element.appendBefore(child1, firstChild) +element.appendAfter(child2, firstChild) +element.appendAfter(child3, lastChild) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..a182eff382a64ba9e6e12019dd71430140e24332 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByName.groovy @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..52ef8664e313e86725e54b62c21222b53e669ffb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.groovy @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.groovy new file mode 100644 index 0000000000000000000000000000000000000000..94a82586b6e3ef1d1a94fed53508da8637378c2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.groovy @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs() +names = xml.attrNames() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.groovy new file mode 100644 index 0000000000000000000000000000000000000000..dfbd4e3c2b33297a075ea01d3b774e4581c8b674 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.groovy @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs(namespace) +names = xml.attrNames(namespace) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..25afc80db6350338cc5ef73965ed44fbdea11141 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByName.groovy @@ -0,0 +1 @@ +childElement = S(input).childElement(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..980ba07458aa05db89fbf2de1fe5d1d2e142a67e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.groovy @@ -0,0 +1 @@ +childElement = S(input).childElement(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c50e69cfe85688faaba8474eca6ff5f62f676f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByName.groovy @@ -0,0 +1 @@ +childElements = S(input).childElements(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..206788d70cb0c8ea2736e7f038142486fb349aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.groovy @@ -0,0 +1 @@ +childElements = S(input).childElements(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..d88d6a175153a42064be4f6c5a5f19b468a17e73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.groovy @@ -0,0 +1 @@ +value = S(input).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..5278f28b2564c180fdef69e3a6e081562fd268bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.groovy @@ -0,0 +1,2 @@ +value = S(input).attrNs(namespace, name).value() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readTextContent.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readTextContent.groovy new file mode 100644 index 0000000000000000000000000000000000000000..e3fac5af0155fb8e42be8ef22a524c8214a37c24 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.readTextContent.groovy @@ -0,0 +1 @@ +textContent = S(input).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c33d0d98c03c7adb629eabf951bc3a807b845648 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByName.groovy @@ -0,0 +1 @@ +element = S(input).removeAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..ae33e065b4d64252ed69cf316666ec25b6f62299 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.groovy @@ -0,0 +1 @@ +element = S(input).removeAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeChildElement.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeChildElement.groovy new file mode 100644 index 0000000000000000000000000000000000000000..0a3f7a0377e5324a0ef095688c02b5c46de6fc13 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.removeChildElement.groovy @@ -0,0 +1,10 @@ +if (input != null) { + element = S(input) +} + +if (child2 == null) { + element.remove(child) +} +else { + element.remove(child, child2) +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceChildElement.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceChildElement.groovy new file mode 100644 index 0000000000000000000000000000000000000000..603f10c0d3649dd96cae213be9f9872c4e8c2b84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceChildElement.groovy @@ -0,0 +1,9 @@ +if (input != null) { + element = S(input) +} + +if (newChild != null) { + newChild = S(newChild) +} + +element.replaceChild(existingChild, newChild) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceElement.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceElement.groovy new file mode 100644 index 0000000000000000000000000000000000000000..f69375c7707521cf4e694edfba1b8e92e663af84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.replaceElement.groovy @@ -0,0 +1,5 @@ +if (newElement != null) { + newElement = S(newElement) +} + +element = oldElement.replace(newElement) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..9ff3960be0e47984f1cee498221f206f117dbb66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.groovy @@ -0,0 +1 @@ +newValue = S(input).attr(name, value).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.groovy new file mode 100644 index 0000000000000000000000000000000000000000..2a6140a6e32b6995f47bb21668eaa059f4864f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.groovy @@ -0,0 +1 @@ +newValue = S(input).attrNs(namespace, name, value).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeTextContent.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeTextContent.groovy new file mode 100644 index 0000000000000000000000000000000000000000..122f6fff476dcf5c96742ed5b430e07c9caa6ce6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomElementScriptTest.writeTextContent.groovy @@ -0,0 +1 @@ +textContent = S(input).textContent(text).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldFailWithNull.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldFailWithNull.groovy new file mode 100644 index 0000000000000000000000000000000000000000..93d1211b3ef48d2175bc76fdd865bdc541e4aef7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldFailWithNull.groovy @@ -0,0 +1,3 @@ +package org.camunda.spin.groovy.xml.dom + +xml = S(null, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldMapJavaToXml.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldMapJavaToXml.groovy new file mode 100644 index 0000000000000000000000000000000000000000..64857d2acc51ec9f69d9e8a929eec021788aeb6e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapJavaToXmlGroovyTest.shouldMapJavaToXml.groovy @@ -0,0 +1,3 @@ +package org.camunda.spin.groovy.xml.dom + +xml = S(input, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldFailMappingMalformedTypeString.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldFailMappingMalformedTypeString.groovy new file mode 100644 index 0000000000000000000000000000000000000000..c42b2a694b73777e00042a371cce72fe597bd099 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldFailMappingMalformedTypeString.groovy @@ -0,0 +1,3 @@ +package org.camunda.spin.groovy.xml.dom + +order = S(input, "application/xml").mapTo("rubbish"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldMapXmlToJava.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldMapXmlToJava.groovy new file mode 100644 index 0000000000000000000000000000000000000000..31b6621bee05b2a7fa7b9b2fe07ffe7483bae2e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomMapXmlToJavaGroovyTest.shouldMapXmlToJava.groovy @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("org.camunda.spin.xml.mapping.Order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.canQueryElementWithNamespaceMap.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.canQueryElementWithNamespaceMap.groovy new file mode 100644 index 0000000000000000000000000000000000000000..65d767d5923b5171860607f9433db739c32bd564 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathGroovyTest.canQueryElementWithNamespaceMap.groovy @@ -0,0 +1,6 @@ +package org.camunda.spin.groovy.xml.dom +def map = [ + a:"http://camunda.com" +] + +query = S(input).xPath(expression).ns(map) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.groovy new file mode 100644 index 0000000000000000000000000000000000000000..92e4a233a5e0cdd5af59c829dda87ba1981c281f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.groovy @@ -0,0 +1,3 @@ +package org.camunda.spin.groovy.xml.dom + +query = S(input).xPath(expression).ns("a", "http://camunda.com") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.xPath.groovy b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.xPath.groovy new file mode 100644 index 0000000000000000000000000000000000000000..b227c7372d2763405b0c710359cea66a5c1fb575 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/groovy/xml/dom/XmlDomXPathScriptTest.xPath.groovy @@ -0,0 +1 @@ +query = S(input).xPath(expression) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js new file mode 100644 index 0000000000000000000000000000000000000000..458742a6e4933c221c5d685c19f17a1f2053a941 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js @@ -0,0 +1 @@ +element = S(input).attr(attributeName).remove(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.testAttribute.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.testAttribute.js new file mode 100644 index 0000000000000000000000000000000000000000..06f2e057cdf12f563bd65063b2ae792c32cdfd84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomAttributeScriptTest.testAttribute.js @@ -0,0 +1,6 @@ +attribute = S(input).attr(attributeName); +name = attribute.name(); +value = attribute.value(); +namespace = attribute.namespace(); +hasNullNamespace = attribute.hasNamespace(null); +newValue = attribute.value(valueToSet).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js new file mode 100644 index 0000000000000000000000000000000000000000..04a91df62c41d0e537909eae9aeddf407f04fd73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js @@ -0,0 +1,5 @@ +var wrappedXml = S(input, "application/xml"); + +xml = S(wrappedXml, "application/xml"); + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js new file mode 100644 index 0000000000000000000000000000000000000000..fabc107fbddcab0bdb63bf4a45586199c64bac63 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js @@ -0,0 +1,5 @@ +xml1 = S(input1, org.camunda.spin.DataFormats.xml()); + +xml2 = S(input2, "application/xml"); + +xml3 = S(input3); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js new file mode 100644 index 0000000000000000000000000000000000000000..0bc15b6a3aac6bb90ed41c47c26506af6cd11b4a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js @@ -0,0 +1,5 @@ +xml1 = S(input, org.camunda.spin.DataFormats.xml()); + +xml2 = S(input, "application/xml"); + +xml3 = S(input); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..11ce44fa997e31dd633b90e6a60c84ed29317e9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElement.js @@ -0,0 +1,6 @@ +if (child !== null) { + child = S(child); +} + +element = S(input).append(child); +child.attr('id', 'child'); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js new file mode 100644 index 0000000000000000000000000000000000000000..9712c561a04bdac70fd9bb4947522a0863a9fe43 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js @@ -0,0 +1,12 @@ +child1 = S(child); +child2 = S(child); +child3 = S(child); + +element = S(input); +childs = element.childElements(); +firstChild = childs.get(0); +lastChild = childs.get(childs.size() - 1); + +element.appendBefore(child1, firstChild); +element.appendAfter(child2, firstChild); +element.appendAfter(child3, lastChild); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js new file mode 100644 index 0000000000000000000000000000000000000000..a182eff382a64ba9e6e12019dd71430140e24332 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..52ef8664e313e86725e54b62c21222b53e669ffb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js new file mode 100644 index 0000000000000000000000000000000000000000..94a82586b6e3ef1d1a94fed53508da8637378c2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs() +names = xml.attrNames() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js new file mode 100644 index 0000000000000000000000000000000000000000..dfbd4e3c2b33297a075ea01d3b774e4581c8b674 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs(namespace) +names = xml.attrNames(namespace) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByName.js new file mode 100644 index 0000000000000000000000000000000000000000..25afc80db6350338cc5ef73965ed44fbdea11141 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByName.js @@ -0,0 +1 @@ +childElement = S(input).childElement(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..980ba07458aa05db89fbf2de1fe5d1d2e142a67e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js @@ -0,0 +1 @@ +childElement = S(input).childElement(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js new file mode 100644 index 0000000000000000000000000000000000000000..c50e69cfe85688faaba8474eca6ff5f62f676f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js @@ -0,0 +1 @@ +childElements = S(input).childElements(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..206788d70cb0c8ea2736e7f038142486fb349aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js @@ -0,0 +1 @@ +childElements = S(input).childElements(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js new file mode 100644 index 0000000000000000000000000000000000000000..07016a26b599c4798aedac53ddb4d672d8480536 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js @@ -0,0 +1,4 @@ +xml = S(input) + +value = xml.attr(name).value(); +var value2 = xml.attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..5278f28b2564c180fdef69e3a6e081562fd268bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js @@ -0,0 +1,2 @@ +value = S(input).attrNs(namespace, name).value() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readTextContent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readTextContent.js new file mode 100644 index 0000000000000000000000000000000000000000..a6947c9db7faeb609688dca66bfbfb2f24040090 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.readTextContent.js @@ -0,0 +1 @@ +textContent = S(input).textContent(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js new file mode 100644 index 0000000000000000000000000000000000000000..c33d0d98c03c7adb629eabf951bc3a807b845648 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js @@ -0,0 +1 @@ +element = S(input).removeAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..ae33e065b4d64252ed69cf316666ec25b6f62299 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js @@ -0,0 +1 @@ +element = S(input).removeAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..5970c6d0662295f36f48481ea16d1180586dd768 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.removeChildElement.js @@ -0,0 +1,10 @@ +if (input) { + element = S(input); +} + +if (!child2) { + element.remove(child); +} +else { + element.remove(child, child2); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..589dffbd983c871d4c7155c3789ba5eb4c974aab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceChildElement.js @@ -0,0 +1,10 @@ +if (input) { + element = S(input); +} + +if (newChild) { + newChild = S(newChild); +} + +element.replaceChild(existingChild, newChild); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceElement.js new file mode 100644 index 0000000000000000000000000000000000000000..2f8867a051d3b891c6fc6fc82f46e1897e7cc847 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.replaceElement.js @@ -0,0 +1,5 @@ +if (newElement) { + newElement = S(newElement); +} + +element = oldElement.replace(newElement); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js new file mode 100644 index 0000000000000000000000000000000000000000..28ae0f61f5b862d4b2c4191fdd278ac6a7686252 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js @@ -0,0 +1 @@ +newValue = S(input).attr(name, value).attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..8c3251ceb4de98a726536fbe3a3bacd58807fdb5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js @@ -0,0 +1 @@ +newValue = S(input).attrNs(namespace, name, value).attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeTextContent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeTextContent.js new file mode 100644 index 0000000000000000000000000000000000000000..2921b622618668237ad1f921789a212f76959d12 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomElementScriptTest.writeTextContent.js @@ -0,0 +1 @@ +textContent = S(input).textContent(text).textContent(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js new file mode 100644 index 0000000000000000000000000000000000000000..a9733f2ad5e26d96d8c6bcd1b7021615e1f5f517 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js @@ -0,0 +1 @@ +xml = S(null, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js new file mode 100644 index 0000000000000000000000000000000000000000..3b3f45c15ca74f85e509e160b6d36fd5093bd1d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js @@ -0,0 +1 @@ +xml = S(input, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js new file mode 100644 index 0000000000000000000000000000000000000000..242efa459225a55f9d0d290efdf11488a68c6762 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("rubbish"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js new file mode 100644 index 0000000000000000000000000000000000000000..31b6621bee05b2a7fa7b9b2fe07ffe7483bae2e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("org.camunda.spin.xml.mapping.Order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js new file mode 100644 index 0000000000000000000000000000000000000000..9866e39c3ae0c1e2de9b2a7b4fe77359bc72ee8b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js @@ -0,0 +1,5 @@ +var map = { + "a" : "http://camunda.com" +}; + +query = S(input).xPath(expression).ns(map); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js new file mode 100644 index 0000000000000000000000000000000000000000..1fce2e72c1fd568838de716896da68f41ebab90f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js @@ -0,0 +1 @@ +query = S(input).xPath(expression).ns("a", "http://camunda.com"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.xPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.xPath.js new file mode 100644 index 0000000000000000000000000000000000000000..159a5054161cd16215c3fbb3fb4c4b86f0dbb339 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/nashorn/xml/dom/XmlDomXPathScriptTest.xPath.js @@ -0,0 +1 @@ +var query = S(input).xPath(expression); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js new file mode 100644 index 0000000000000000000000000000000000000000..458742a6e4933c221c5d685c19f17a1f2053a941 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.removeAttribute.js @@ -0,0 +1 @@ +element = S(input).attr(attributeName).remove(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.testAttribute.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.testAttribute.js new file mode 100644 index 0000000000000000000000000000000000000000..06f2e057cdf12f563bd65063b2ae792c32cdfd84 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomAttributeScriptTest.testAttribute.js @@ -0,0 +1,6 @@ +attribute = S(input).attr(attributeName); +name = attribute.name(); +value = attribute.value(); +namespace = attribute.namespace(); +hasNullNamespace = attribute.hasNamespace(null); +newValue = attribute.value(valueToSet).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js new file mode 100644 index 0000000000000000000000000000000000000000..04a91df62c41d0e537909eae9aeddf407f04fd73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldBeIdempotent.js @@ -0,0 +1,5 @@ +var wrappedXml = S(input, "application/xml"); + +xml = S(wrappedXml, "application/xml"); + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js new file mode 100644 index 0000000000000000000000000000000000000000..fabc107fbddcab0bdb63bf4a45586199c64bac63 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForReader.js @@ -0,0 +1,5 @@ +xml1 = S(input1, org.camunda.spin.DataFormats.xml()); + +xml2 = S(input2, "application/xml"); + +xml3 = S(input3); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js new file mode 100644 index 0000000000000000000000000000000000000000..0bc15b6a3aac6bb90ed41c47c26506af6cd11b4a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomCreateJavascriptTest.shouldCreateForString.js @@ -0,0 +1,5 @@ +xml1 = S(input, org.camunda.spin.DataFormats.xml()); + +xml2 = S(input, "application/xml"); + +xml3 = S(input); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..11ce44fa997e31dd633b90e6a60c84ed29317e9a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElement.js @@ -0,0 +1,6 @@ +if (child !== null) { + child = S(child); +} + +element = S(input).append(child); +child.attr('id', 'child'); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js new file mode 100644 index 0000000000000000000000000000000000000000..9712c561a04bdac70fd9bb4947522a0863a9fe43 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.js @@ -0,0 +1,12 @@ +child1 = S(child); +child2 = S(child); +child3 = S(child); + +element = S(input); +childs = element.childElements(); +firstChild = childs.get(0); +lastChild = childs.get(childs.size() - 1); + +element.appendBefore(child1, firstChild); +element.appendAfter(child2, firstChild); +element.appendAfter(child3, lastChild); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js new file mode 100644 index 0000000000000000000000000000000000000000..a182eff382a64ba9e6e12019dd71430140e24332 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByName.js @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..52ef8664e313e86725e54b62c21222b53e669ffb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.js @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js new file mode 100644 index 0000000000000000000000000000000000000000..94a82586b6e3ef1d1a94fed53508da8637378c2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.js @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs() +names = xml.attrNames() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js new file mode 100644 index 0000000000000000000000000000000000000000..dfbd4e3c2b33297a075ea01d3b774e4581c8b674 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.js @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs(namespace) +names = xml.attrNames(namespace) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByName.js new file mode 100644 index 0000000000000000000000000000000000000000..25afc80db6350338cc5ef73965ed44fbdea11141 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByName.js @@ -0,0 +1 @@ +childElement = S(input).childElement(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..980ba07458aa05db89fbf2de1fe5d1d2e142a67e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.js @@ -0,0 +1 @@ +childElement = S(input).childElement(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js new file mode 100644 index 0000000000000000000000000000000000000000..c50e69cfe85688faaba8474eca6ff5f62f676f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByName.js @@ -0,0 +1 @@ +childElements = S(input).childElements(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..206788d70cb0c8ea2736e7f038142486fb349aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.js @@ -0,0 +1 @@ +childElements = S(input).childElements(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js new file mode 100644 index 0000000000000000000000000000000000000000..07016a26b599c4798aedac53ddb4d672d8480536 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.js @@ -0,0 +1,4 @@ +xml = S(input) + +value = xml.attr(name).value(); +var value2 = xml.attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..5278f28b2564c180fdef69e3a6e081562fd268bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.js @@ -0,0 +1,2 @@ +value = S(input).attrNs(namespace, name).value() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readTextContent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readTextContent.js new file mode 100644 index 0000000000000000000000000000000000000000..a6947c9db7faeb609688dca66bfbfb2f24040090 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.readTextContent.js @@ -0,0 +1 @@ +textContent = S(input).textContent(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js new file mode 100644 index 0000000000000000000000000000000000000000..c33d0d98c03c7adb629eabf951bc3a807b845648 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByName.js @@ -0,0 +1 @@ +element = S(input).removeAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..ae33e065b4d64252ed69cf316666ec25b6f62299 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.js @@ -0,0 +1 @@ +element = S(input).removeAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..5970c6d0662295f36f48481ea16d1180586dd768 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.removeChildElement.js @@ -0,0 +1,10 @@ +if (input) { + element = S(input); +} + +if (!child2) { + element.remove(child); +} +else { + element.remove(child, child2); +} diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceChildElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceChildElement.js new file mode 100644 index 0000000000000000000000000000000000000000..589dffbd983c871d4c7155c3789ba5eb4c974aab --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceChildElement.js @@ -0,0 +1,10 @@ +if (input) { + element = S(input); +} + +if (newChild) { + newChild = S(newChild); +} + +element.replaceChild(existingChild, newChild); + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceElement.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceElement.js new file mode 100644 index 0000000000000000000000000000000000000000..2f8867a051d3b891c6fc6fc82f46e1897e7cc847 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.replaceElement.js @@ -0,0 +1,5 @@ +if (newElement) { + newElement = S(newElement); +} + +element = oldElement.replace(newElement); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js new file mode 100644 index 0000000000000000000000000000000000000000..28ae0f61f5b862d4b2c4191fdd278ac6a7686252 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.js @@ -0,0 +1 @@ +newValue = S(input).attr(name, value).attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js new file mode 100644 index 0000000000000000000000000000000000000000..8c3251ceb4de98a726536fbe3a3bacd58807fdb5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.js @@ -0,0 +1 @@ +newValue = S(input).attrNs(namespace, name, value).attr(name).value(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeTextContent.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeTextContent.js new file mode 100644 index 0000000000000000000000000000000000000000..2921b622618668237ad1f921789a212f76959d12 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomElementScriptTest.writeTextContent.js @@ -0,0 +1 @@ +textContent = S(input).textContent(text).textContent(); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js new file mode 100644 index 0000000000000000000000000000000000000000..a9733f2ad5e26d96d8c6bcd1b7021615e1f5f517 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldFailWithNull.js @@ -0,0 +1 @@ +xml = S(null, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js new file mode 100644 index 0000000000000000000000000000000000000000..3b3f45c15ca74f85e509e160b6d36fd5093bd1d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapJavaToXmlJavascriptTest.shouldMapJavaToXml.js @@ -0,0 +1 @@ +xml = S(input, "application/xml").toString(); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js new file mode 100644 index 0000000000000000000000000000000000000000..242efa459225a55f9d0d290efdf11488a68c6762 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldFailMappingMalformedTypeString.js @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("rubbish"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js new file mode 100644 index 0000000000000000000000000000000000000000..31b6621bee05b2a7fa7b9b2fe07ffe7483bae2e5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomMapXmlToJavaJavascriptTest.shouldMapXmlToJava.js @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("org.camunda.spin.xml.mapping.Order"); \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js new file mode 100644 index 0000000000000000000000000000000000000000..9866e39c3ae0c1e2de9b2a7b4fe77359bc72ee8b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathJavascriptTest.canQueryElementWithNamespaceMap.js @@ -0,0 +1,5 @@ +var map = { + "a" : "http://camunda.com" +}; + +query = S(input).xPath(expression).ns(map); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js new file mode 100644 index 0000000000000000000000000000000000000000..1fce2e72c1fd568838de716896da68f41ebab90f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.js @@ -0,0 +1 @@ +query = S(input).xPath(expression).ns("a", "http://camunda.com"); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.xPath.js b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.xPath.js new file mode 100644 index 0000000000000000000000000000000000000000..159a5054161cd16215c3fbb3fb4c4b86f0dbb339 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/javascript/xml/dom/XmlDomXPathScriptTest.xPath.js @@ -0,0 +1 @@ +var query = S(input).xPath(expression); diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.removeAttribute.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.removeAttribute.py new file mode 100644 index 0000000000000000000000000000000000000000..e0272e046947fc51b612971111f80ff01aac447e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.removeAttribute.py @@ -0,0 +1 @@ +element = S(input).attr(attributeName).remove() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.testAttribute.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.testAttribute.py new file mode 100644 index 0000000000000000000000000000000000000000..d35cc67210fc10b71fd20f45dc4f6105d598cb66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomAttributeScriptTest.testAttribute.py @@ -0,0 +1,6 @@ +attribute = S(input).attr(attributeName) +name = attribute.name() +value = attribute.value() +namespace = attribute.namespace() +hasNullNamespace = attribute.hasNamespace(None) +newValue = attribute.value(valueToSet).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldBeIdempotent.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldBeIdempotent.py new file mode 100644 index 0000000000000000000000000000000000000000..e3f01452d193f269121197576ae282bd7883ff72 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldBeIdempotent.py @@ -0,0 +1,4 @@ +wrappedXml = S(input, "application/xml") + +xml = S(wrappedXml, "application/xml") + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForReader.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForReader.py new file mode 100644 index 0000000000000000000000000000000000000000..8f21c87fee878648a918a0b62f92e41236f7344c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForReader.py @@ -0,0 +1,7 @@ +import org.camunda.spin.DataFormats.xml as xml; + +xml1 = S(input1, xml()) + +xml2 = S(input2, "application/xml") + +xml3 = S(input3) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForString.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForString.py new file mode 100644 index 0000000000000000000000000000000000000000..70c9b0aac178969364a7d5172ae18e34647604aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomCreatePythonTest.shouldCreateForString.py @@ -0,0 +1,7 @@ +import org.camunda.spin.DataFormats.xml as xml; + +xml1 = S(input, xml()) + +xml2 = S(input, "application/xml") + +xml3 = S(input) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElement.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElement.py new file mode 100644 index 0000000000000000000000000000000000000000..27291aa0099c7d0ed20193a54b7c0bdf0182e649 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElement.py @@ -0,0 +1,5 @@ +if child is not None: + child = S(child) + +element = S(input).append(child) +child.attr('id', 'child') diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.py new file mode 100644 index 0000000000000000000000000000000000000000..26297b06323f7c2fd5f071da1162a5af6691cdfa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.py @@ -0,0 +1,12 @@ +child1 = S(child) +child2 = S(child) +child3 = S(child) + +element = S(input) +childs = element.childElements() +firstChild = childs.get(0) +lastChild = childs.get(childs.size() - 1) + +element.appendBefore(child1, firstChild) +element.appendAfter(child2, firstChild) +element.appendAfter(child3, lastChild) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByName.py new file mode 100644 index 0000000000000000000000000000000000000000..a182eff382a64ba9e6e12019dd71430140e24332 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByName.py @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..52ef8664e313e86725e54b62c21222b53e669ffb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.py @@ -0,0 +1 @@ +hasAttribute = S(input).hasAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.py new file mode 100644 index 0000000000000000000000000000000000000000..94a82586b6e3ef1d1a94fed53508da8637378c2e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.py @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs() +names = xml.attrNames() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.py new file mode 100644 index 0000000000000000000000000000000000000000..dfbd4e3c2b33297a075ea01d3b774e4581c8b674 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.py @@ -0,0 +1,3 @@ +xml = S(input) +attributes = xml.attrs(namespace) +names = xml.attrNames(namespace) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByName.py new file mode 100644 index 0000000000000000000000000000000000000000..25afc80db6350338cc5ef73965ed44fbdea11141 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByName.py @@ -0,0 +1 @@ +childElement = S(input).childElement(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..980ba07458aa05db89fbf2de1fe5d1d2e142a67e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.py @@ -0,0 +1 @@ +childElement = S(input).childElement(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByName.py new file mode 100644 index 0000000000000000000000000000000000000000..c50e69cfe85688faaba8474eca6ff5f62f676f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByName.py @@ -0,0 +1 @@ +childElements = S(input).childElements(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..206788d70cb0c8ea2736e7f038142486fb349aed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.py @@ -0,0 +1 @@ +childElements = S(input).childElements(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.py new file mode 100644 index 0000000000000000000000000000000000000000..d88d6a175153a42064be4f6c5a5f19b468a17e73 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.py @@ -0,0 +1 @@ +value = S(input).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..5278f28b2564c180fdef69e3a6e081562fd268bd --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.py @@ -0,0 +1,2 @@ +value = S(input).attrNs(namespace, name).value() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readTextContent.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readTextContent.py new file mode 100644 index 0000000000000000000000000000000000000000..e3fac5af0155fb8e42be8ef22a524c8214a37c24 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.readTextContent.py @@ -0,0 +1 @@ +textContent = S(input).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByName.py new file mode 100644 index 0000000000000000000000000000000000000000..c33d0d98c03c7adb629eabf951bc3a807b845648 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByName.py @@ -0,0 +1 @@ +element = S(input).removeAttr(name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..ae33e065b4d64252ed69cf316666ec25b6f62299 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.py @@ -0,0 +1 @@ +element = S(input).removeAttrNs(namespace, name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeChildElement.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeChildElement.py new file mode 100644 index 0000000000000000000000000000000000000000..46978c6a10f8d330be05cde4d4803fa8d61af642 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.removeChildElement.py @@ -0,0 +1,7 @@ +if input is not None: + element = S(input) + +if child2 is None: + element.remove(child) +else: + element.remove(child, child2) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceChildElement.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceChildElement.py new file mode 100644 index 0000000000000000000000000000000000000000..b2d08d42aa7468fe8d9595e34332f9b90599bbe4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceChildElement.py @@ -0,0 +1,8 @@ +if input is not None: + element = S(input) + +if newChild is not None: + newChild = S(newChild) + +element.replaceChild(existingChild, newChild) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceElement.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceElement.py new file mode 100644 index 0000000000000000000000000000000000000000..800911ac3c0d8da100b9327503e06747c7253517 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.replaceElement.py @@ -0,0 +1,5 @@ +if newElement is not None: + newElement = S(newElement) + +element = oldElement.replace(newElement) + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.py new file mode 100644 index 0000000000000000000000000000000000000000..9ff3960be0e47984f1cee498221f206f117dbb66 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.py @@ -0,0 +1 @@ +newValue = S(input).attr(name, value).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.py new file mode 100644 index 0000000000000000000000000000000000000000..2a6140a6e32b6995f47bb21668eaa059f4864f48 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.py @@ -0,0 +1 @@ +newValue = S(input).attrNs(namespace, name, value).attr(name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeTextContent.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeTextContent.py new file mode 100644 index 0000000000000000000000000000000000000000..122f6fff476dcf5c96742ed5b430e07c9caa6ce6 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomElementScriptTest.writeTextContent.py @@ -0,0 +1 @@ +textContent = S(input).textContent(text).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldFailWithNull.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldFailWithNull.py new file mode 100644 index 0000000000000000000000000000000000000000..263d57c0c87df677a9dfe6d1bdc9cba85b499964 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldFailWithNull.py @@ -0,0 +1 @@ +xml = S(None, "application/xml").toString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldMapJavaToXml.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldMapJavaToXml.py new file mode 100644 index 0000000000000000000000000000000000000000..0d5b6d6d70d9583645385584e174ceb2c218406e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapJavaToXmlPythonTest.shouldMapJavaToXml.py @@ -0,0 +1 @@ +xml = S(input, "application/xml").toString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldFailMappingMalformedTypeString.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldFailMappingMalformedTypeString.py new file mode 100644 index 0000000000000000000000000000000000000000..a81c835cbb3e3d8be4838de9930058b6d7a8c46e --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldFailMappingMalformedTypeString.py @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("rubbish") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldMapXmlToJava.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldMapXmlToJava.py new file mode 100644 index 0000000000000000000000000000000000000000..8449134d845eed10f138baee163561c065e2777f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomMapXmlToJavaPythonTest.shouldMapXmlToJava.py @@ -0,0 +1 @@ +order = S(input, "application/xml").mapTo("org.camunda.spin.xml.mapping.Order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.canQueryElementWithNamespaceMap.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.canQueryElementWithNamespaceMap.py new file mode 100644 index 0000000000000000000000000000000000000000..ff5d0f9a763ab485c407554a366520ae79023b6f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathPythonTest.canQueryElementWithNamespaceMap.py @@ -0,0 +1,5 @@ +map = { + "a" : "http://camunda.com" +} + +query = S(input).xPath(expression).ns(map) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.py new file mode 100644 index 0000000000000000000000000000000000000000..ea88c88697b45434577a4d9ec2505f061855d2a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.py @@ -0,0 +1 @@ +query = S(input).xPath(expression).ns("a", "http://camunda.com") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.xPath.py b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.xPath.py new file mode 100644 index 0000000000000000000000000000000000000000..b227c7372d2763405b0c710359cea66a5c1fb575 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/python/xml/dom/XmlDomXPathScriptTest.xPath.py @@ -0,0 +1 @@ +query = S(input).xPath(expression) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.removeAttribute.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.removeAttribute.rb new file mode 100644 index 0000000000000000000000000000000000000000..cdd9c54bad1ff64ac839eb6453fa32506c0c7197 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.removeAttribute.rb @@ -0,0 +1 @@ +$element = S($input).attr($attributeName).remove() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.testAttribute.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.testAttribute.rb new file mode 100644 index 0000000000000000000000000000000000000000..5f0cea2f831b6c6d18d9092b81e416e9ee3af650 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomAttributeScriptTest.testAttribute.rb @@ -0,0 +1,6 @@ +attribute = S($input).attr($attributeName) +$name = attribute.name() +$value = attribute.value() +$namespace = attribute.namespace() +$hasNullNamespace = attribute.hasNamespace(nil) +$newValue = attribute.value($valueToSet).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldBeIdempotent.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldBeIdempotent.rb new file mode 100644 index 0000000000000000000000000000000000000000..276ade74584c6fb635ba85e1211a47d3329a34d7 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldBeIdempotent.rb @@ -0,0 +1,4 @@ +$wrappedXml = S($input, "application/xml") + +$xml = S($wrappedXml, "application/xml") + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForReader.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForReader.rb new file mode 100644 index 0000000000000000000000000000000000000000..4c2d25850551e4f54dc7af4d33b9010cf5a02ce1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForReader.rb @@ -0,0 +1,5 @@ +$xml1 = S($input1, org.camunda.spin.DataFormats.xml()) + +$xml2 = S($input2, "application/xml") + +$xml3 = S($input3) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForString.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForString.rb new file mode 100644 index 0000000000000000000000000000000000000000..2e4cda8c2664eea8d44047484cde321df7ba5582 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomCreateRubyTest.shouldCreateForString.rb @@ -0,0 +1,5 @@ +$xml1 = S($input, org.camunda.spin.DataFormats.xml()) + +$xml2 = S($input, "application/xml") + +$xml3 = S($input) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElement.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElement.rb new file mode 100644 index 0000000000000000000000000000000000000000..f82deb5e91b2e232b23c129f58a6d0563043917a --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElement.rb @@ -0,0 +1,6 @@ +unless $child.nil? + childElement = S($child) +end + +$element = S($input).append(childElement) +childElement.attr('id', 'child') diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.rb new file mode 100644 index 0000000000000000000000000000000000000000..52bbeff19676e4a640729479cdf09468f1426586 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.appendChildElementAtPosition.rb @@ -0,0 +1,12 @@ +child1 = S($child) +child2 = S($child) +child3 = S($child) + +$element = S($input) +childs = $element.childElements() +firstChild = childs.get(0) +lastChild = childs.get(childs.size() - 1) + +$element.appendBefore(child1, firstChild) +$element.appendAfter(child2, firstChild) +$element.appendAfter(child3, lastChild) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..e560b5dbaaf5950442973ae2ef50980ac77826d4 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByName.rb @@ -0,0 +1 @@ +$hasAttribute = S($input).hasAttr($name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..b911b10ae74de918e66db55f354f2f6c9570f52f --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.checkAttributeByNamespaceAndName.rb @@ -0,0 +1 @@ +$hasAttribute = S($input).hasAttrNs($namespace, $name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.rb new file mode 100644 index 0000000000000000000000000000000000000000..848e6cca63976d10d38df908997a95746ac98b19 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNames.rb @@ -0,0 +1,3 @@ +xml = S($input) +$attributes = xml.attrs() +$names = xml.attrNames() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.rb new file mode 100644 index 0000000000000000000000000000000000000000..c99d000b7d67bf790ecd942a40977b85ef2619aa --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getAllAttributesAndNamesByNamespace.rb @@ -0,0 +1,3 @@ +xml = S($input) +$attributes = xml.attrs($namespace) +$names = xml.attrNames($namespace) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..40e0876f8c12e71cc4f1355a34d1ed7d604ca537 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByName.rb @@ -0,0 +1 @@ +$childElement = S($input).childElement($name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..22011e599d3a39f9a8c4a7075277ff4f292674ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementByNamespaceAndName.rb @@ -0,0 +1 @@ +$childElement = S($input).childElement($namespace, $name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..09ae4906d43af450e579c9ae5dac86740117b601 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByName.rb @@ -0,0 +1 @@ +$childElements = S($input).childElements($name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..c1738341655b6b81830165c70fa11d3b416992ec --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.getChildElementsByNamespaceAndName.rb @@ -0,0 +1 @@ +$childElements = S($input).childElements($namespace, $name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..95c668b0806add928c9613fa9817847b6f295003 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByName.rb @@ -0,0 +1 @@ +$value = S($input).attr($name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..ad2124af32be1491100b7014be28db23915f6d6b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readAttributeValueByNamespaceAndName.rb @@ -0,0 +1,2 @@ +$value = S($input).attrNs($namespace, $name).value() + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readTextContent.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readTextContent.rb new file mode 100644 index 0000000000000000000000000000000000000000..9e685741c9ed91562d7d168253a2c0e4f755f611 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.readTextContent.rb @@ -0,0 +1 @@ +$textContent = S($input).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..42d2b9ac2e7e466045866336e429a100f4d79991 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByName.rb @@ -0,0 +1 @@ +$element = S($input).removeAttr($name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..6a6ddc613bb026e104a80d6314b6faa91b7e0b31 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeAttributeByNamespaceAndName.rb @@ -0,0 +1 @@ +$element = S($input).removeAttrNs($namespace, $name) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeChildElement.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeChildElement.rb new file mode 100644 index 0000000000000000000000000000000000000000..fc7df0a1046a384e51f6f622644e8ca86820d07b --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.removeChildElement.rb @@ -0,0 +1,8 @@ +$element = S($input) unless $input.nil? + +if $child2.nil? + $element.remove($child) +else + $element.remove($child, $child2) +end + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceChildElement.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceChildElement.rb new file mode 100644 index 0000000000000000000000000000000000000000..72d30b732a6d4abd837a1575aafcece766cdb4a5 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceChildElement.rb @@ -0,0 +1,9 @@ +$element = S($input) unless $input.nil? + +if $newChild.nil? + newChild = $newChild +else + newChild = S($newChild) +end + +$element.replaceChild($existingChild, newChild) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceElement.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceElement.rb new file mode 100644 index 0000000000000000000000000000000000000000..a6c2b503b81afc5a57ccabbd87d27f7f2c143305 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.replaceElement.rb @@ -0,0 +1,7 @@ +if $newElement.nil? + newElement = $newElement +else + newElement = S($newElement) +end + +$element = $oldElement.replace(newElement) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.rb new file mode 100644 index 0000000000000000000000000000000000000000..3face46b987853085f3fc8e0a6f5a64f2653fe30 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByName.rb @@ -0,0 +1 @@ +$newValue = S($input).attr($name, $value).attr($name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.rb new file mode 100644 index 0000000000000000000000000000000000000000..7ed21a43f5ad69671be842f5b8efa9945f2fc199 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeAttributeValueByNamespaceAndName.rb @@ -0,0 +1 @@ +$newValue = S($input).attrNs($namespace, $name, $value).attr($name).value() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeTextContent.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeTextContent.rb new file mode 100644 index 0000000000000000000000000000000000000000..131a0288dd732ea97473e4fca124e237c1fc0fae --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomElementScriptTest.writeTextContent.rb @@ -0,0 +1 @@ +$textContent = S($input).textContent($text).textContent() diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldFailWithNull.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldFailWithNull.rb new file mode 100644 index 0000000000000000000000000000000000000000..0c02a5caf53e3e9b7c5d6815cb940f5e9f216cdb --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldFailWithNull.rb @@ -0,0 +1 @@ +$xml = S(nil, "application/xml").toString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldMapJavaToXml.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldMapJavaToXml.rb new file mode 100644 index 0000000000000000000000000000000000000000..64bdc7dd84879496ed297b4dfe3abb0dfa057a62 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapJavaToXmlRubyTest.shouldMapJavaToXml.rb @@ -0,0 +1 @@ +$xml = S($input, "application/xml").toString() \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldFailMappingMalformedTypeString.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldFailMappingMalformedTypeString.rb new file mode 100644 index 0000000000000000000000000000000000000000..0adb153aae3763eb7e199f4c3256e1e23a52a332 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldFailMappingMalformedTypeString.rb @@ -0,0 +1 @@ +$order = S($input, "application/xml").mapTo("rubbish") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldMapXmlToJava.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldMapXmlToJava.rb new file mode 100644 index 0000000000000000000000000000000000000000..79456ebfb4db8ce33c36c039d57bd2497df9ec53 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomMapXmlToJavaRubyTest.shouldMapXmlToJava.rb @@ -0,0 +1 @@ +$order = S($input, "application/xml").mapTo("org.camunda.spin.xml.mapping.Order") \ No newline at end of file diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.canQueryElementWithNamespaceMap.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.canQueryElementWithNamespaceMap.rb new file mode 100644 index 0000000000000000000000000000000000000000..1449f1eed244b172c4dce9ba39617c232e7010ed --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathRubyTest.canQueryElementWithNamespaceMap.rb @@ -0,0 +1,5 @@ +map = { + "a" => "http://camunda.com" +} + +$query = S($input).xPath($expression).ns(map) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.rb new file mode 100644 index 0000000000000000000000000000000000000000..b1a70142639d2dbf054f362d52be30128f6c8e25 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.canQueryElementWithNamespace.rb @@ -0,0 +1 @@ +$query = S($input).xPath($expression).ns("a", "http://camunda.com") diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.xPath.rb b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.xPath.rb new file mode 100644 index 0000000000000000000000000000000000000000..ca5193d6b2fb74ae73c929b02a793e4f0b98d00c --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/ruby/xml/dom/XmlDomXPathScriptTest.xPath.rb @@ -0,0 +1 @@ +$query = S($input).xPath($expression) diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/strip-space-preserve-space.xsl b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/strip-space-preserve-space.xsl new file mode 100644 index 0000000000000000000000000000000000000000..e6f3f31c8d247413be4f42c0b44fa5ad7884b3d1 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/strip-space-preserve-space.xsl @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/xml/dom/format/spi/ExternalSchemaAccess.xml b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/xml/dom/format/spi/ExternalSchemaAccess.xml new file mode 100644 index 0000000000000000000000000000000000000000..f6fd7546ca63779826f115db83d94d1b9f44a9c2 --- /dev/null +++ b/source_data/pinned/camunda-dmn-examples/commit-ee4826e5e76c/spin/dataformat-xml-dom/src/test/resources/org/camunda/spin/xml/dom/format/spi/ExternalSchemaAccess.xml @@ -0,0 +1,9 @@ + + + + +