JsonSecurityAnalysisParameters { public static SecurityAnalysisParameters update(SecurityAnalysisParameters parameters, Path jsonFile) { Objects.requireNonNull(jsonFile); try (InputStream is = Files.newInputStream(jsonFile)) { return update(parameters, is); } catch (IOException e) { throw new UncheckedIOException(e); } } private  JsonSecurityAnalysisParameters(); static ExtensionProviders<ExtensionSerializer> getExtensionSerializers(); static SecurityAnalysisParameters read(Path jsonFile); static SecurityAnalysisParameters read(InputStream jsonStream); static SecurityAnalysisParameters update(SecurityAnalysisParameters parameters, Path jsonFile); static SecurityAnalysisParameters update(SecurityAnalysisParameters parameters, InputStream jsonStream); static void write(SecurityAnalysisParameters parameters, Path jsonFile); static void write(SecurityAnalysisParameters parameters, OutputStream outputStream); static SecurityAnalysisParameters deserialize(JsonParser parser, DeserializationContext context, SecurityAnalysisParameters parameters); static SecurityAnalysisParameters deserialize(JsonParser parser, DeserializationContext context); static void serialize(SecurityAnalysisParameters parameters, JsonGenerator jsonGenerator, SerializerProvider serializerProvider);  }
@Test public void updateLoadFlowParameters() { SecurityAnalysisParameters parameters = new SecurityAnalysisParameters(); parameters.getLoadFlowParameters().setTwtSplitShuntAdmittance(true); JsonSecurityAnalysisParameters.update(parameters, getClass().getResourceAsStream("/SecurityAnalysisParametersIncomplete.json")); assertTrue(parameters.getLoadFlowParameters().isTwtSplitShuntAdmittance()); }
@Test public void updateExtensions() { SecurityAnalysisParameters parameters = new SecurityAnalysisParameters(); DummyExtension extension = new DummyExtension(); extension.setParameterBoolean(false); extension.setParameterString("test"); extension.setParameterDouble(2.8); DummyExtension oldExtension = new DummyExtension(extension); parameters.addExtension(DummyExtension.class, extension); JsonSecurityAnalysisParameters.update(parameters, getClass().getResourceAsStream("/SecurityAnalysisParametersExtensionUpdate.json")); DummyExtension updatedExtension = parameters.getExtension(DummyExtension.class); assertEquals(oldExtension.isParameterBoolean(), updatedExtension.isParameterBoolean()); assertEquals(oldExtension.getParameterDouble(), updatedExtension.getParameterDouble(), 0.01); assertNotEquals(oldExtension.getParameterString(), updatedExtension.getParameterString()); }