The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 0a0584d8 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck
Browse files

test

parent 37fde165
package org.vadere.state.attributes; package org.vadere.state.attributes;
import com.fasterxml.jackson.annotation.JsonFilter;
/** /**
* Provides attributes for the simulation, like visualizationEnabled and * Provides attributes for the simulation, like visualizationEnabled and
* writeSimulationData. * writeSimulationData.
* *
*/ */
@JsonFilter("testFilter")
public class AttributesSimulation extends Attributes { public class AttributesSimulation extends Attributes {
private double finishTime = 500; private double finishTime = 500;
......
package org.vadere.state.util;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
import com.fasterxml.jackson.databind.ser.FilterProvider;
import com.fasterxml.jackson.databind.ser.PropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
import org.junit.Test;
import org.vadere.state.attributes.AttributesSimulation;
import static org.junit.Assert.*;
public class StateJsonConverterTest {
@Test
public void testMapper(){
AttributesSimulation a = new AttributesSimulation();
PropertyFilter empty = SimpleBeanPropertyFilter.serializeAll();
PropertyFilter ignoreSeed = SimpleBeanPropertyFilter.serializeAllExcept("randomSeed");
SimpleFilterProvider fp = new SimpleFilterProvider().addFilter("testFilter", empty);
ObjectMapper mapper = StateJsonConverter.getMapper().setFilterProvider(fp);
ObjectWriter writer = mapper.writerWithDefaultPrettyPrinter();
try {
JsonNode json = mapper.convertValue(a, JsonNode.class);
String str = writer.writeValueAsString(json);
System.out.println(str);
} catch (JsonProcessingException | IllegalArgumentException e) {
throw new RuntimeException(e);
}
fp.removeFilter("testFilter");
fp.addFilter("testFilter", ignoreSeed);
try {
JsonNode json = mapper.convertValue(a, JsonNode.class);
String str = writer.writeValueAsString(json);
System.out.println(str);
} catch (JsonProcessingException | IllegalArgumentException e) {
throw new RuntimeException(e);
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment