本文整理了Java中org.kie.server.api.marshalling.Marshaller.unmarshall()
方法的一些代码示例,展示了Marshaller.unmarshall()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Marshaller.unmarshall()
方法的具体详情如下:
包路径:org.kie.server.api.marshalling.Marshaller
类名称:Marshaller
方法名:unmarshall
暂无
代码示例来源:origin: org.kie.server/kie-server-services-common
private <T> T deserialize(String content, Class<T> type) {
if (type == null) {
return null;
}
try {
return MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()).unmarshall(content, type);
} catch ( MarshallingException e ) {
throw new IllegalStateException( "Error while deserializing data received from server!", e );
}
}
代码示例来源:origin: org.kie.server/kie-server-client
protected <T> T deserialize(String content, Class<T> type) {
logger.debug("About to deserialize content: \n '{}' \n into type: '{}'", content, type);
if (content == null || content.isEmpty()) {
return null;
}
try {
return marshaller.unmarshall(content, type);
} catch ( MarshallingException e ) {
throw new KieServicesException( "Error while deserializing data received from server!", e );
}
}
代码示例来源:origin: org.kie/kie-server-client
private <T> T deserialize(String content, Class<T> type) {
try {
return marshaller.unmarshall( content, type );
} catch ( MarshallingException e ) {
throw new KieServicesException( "Error while deserializing data received from server!", e );
}
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
private void verifyMarshallingRoundTrip( Marshaller marshaller, Object inputObject ) {
String rawContent = marshaller.marshall( inputObject );
logger.info(rawContent);
Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall( rawContent, inputObject.getClass() );
Assertions.assertThat( testObjectAfterMarshallingTurnAround ).isEqualTo( inputObject );
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
private void verifyMarshallingRoundTrip( Marshaller marshaller, Object inputObject ) {
String rawContent = marshaller.marshall( inputObject );
Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall( rawContent, inputObject.getClass() );
Assertions.assertThat( testObjectAfterMarshallingTurnAround ).isEqualTo( inputObject );
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
private void verifyMarshallingRoundTrip(Marshaller marshaller, Object inputObject) {
String rawContent = marshaller.marshall(inputObject);
Object testObjectAfterMarshallingTurnAround = marshaller.unmarshall(rawContent, inputObject.getClass());
Assertions.assertThat(inputObject).isEqualTo(testObjectAfterMarshallingTurnAround);
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Test
public void testUnmarshallListContainersCommandWithNoFilter() {
String commandString = "<list-containers/>";
Marshaller marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.XSTREAM, getClass().getClassLoader());
ListContainersCommand command = marshaller.unmarshall(commandString, ListContainersCommand.class);
// the default ACCEPT_ALL filter should be set
Assertions.assertThat(command.getKieContainerResourceFilter()).isEqualTo(KieContainerResourceFilter.ACCEPT_ALL);
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Test
public void testXStreamUnmarshalling() {
final DMNContextKS result = xStreamMarshaller.unmarshall( XSTREAM, DMNContextKS.class );
checkBean(result);
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Test
public void testJsonUnmarshalling() {
final DMNContextKS result = jsonMarshaller.unmarshall( JSON, DMNContextKS.class );
checkBean(result);
}
代码示例来源:origin: org.kie.server/kie-server-rest-common
private void assertForbiddenResponse(Response response) {
assertNotNull(response);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatus());
ServiceResponse<?> serviceResponse = marshaller.unmarshall((String) response.getEntity(), ServiceResponse.class);
assertNotNull(serviceResponse);
assertEquals(ResponseType.FAILURE, serviceResponse.getType());
assertEquals("KIE Server management api is disabled", serviceResponse.getMsg());
}
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallInsertObjectCommand() {
String xmlCommand = "<insert>\n" +
" <string>String value</string>\n" +
"</insert>";
InsertObjectCommand command = marshaller.unmarshall( xmlCommand, InsertObjectCommand.class );
assertEquals( "String value", command.getObject().toString() );
assertEquals( xmlCommand, marshaller.marshall( command ) );
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallModifyCommand() {
String xmlCommand = "<modify fact-handle=\"0:234:345:456:567:789\">\n" +
" <set accessor=\"age\" value=\"30\"/>\n" +
"</modify>";
ModifyCommand command = marshaller.unmarshall(xmlCommand, ModifyCommand.class);
assertEquals(1, command.getSetters().size());
assertEquals("<modify fact-handle=\"0:234:345:456:567:789:NON_TRAIT\">\n" +
" <set accessor=\"age\" value=\"30\"/>\n" +
"</modify>", marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallInsertElementsCommand() {
String xmlCommand = "<insert-elements>\n" +
" <string>test1</string>\n" +
" <string>test2</string>\n" +
"</insert-elements>";
InsertElementsCommand command = marshaller.unmarshall(xmlCommand, InsertElementsCommand.class);
assertEquals(2, command.getObjects().size());
assertEquals(xmlCommand, marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallFireAllRulesCommand() {
String xmlCommand = "<fire-all-rules max=\"10\" out-identifier=\"result\"/>";
FireAllRulesCommand command = marshaller.unmarshall(xmlCommand, FireAllRulesCommand.class);
assertEquals(10, command.getMax());
assertEquals(xmlCommand, marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallGetObjectCommand() {
String xmlCommand = "<get-object fact-handle=\"0:234:345:456:567:789\" out-identifier=\"test\"/>";
GetObjectCommand command = marshaller.unmarshall(xmlCommand, GetObjectCommand.class);
assertEquals("test", command.getOutIdentifier());
assertEquals("<get-object fact-handle=\"0:234:345:456:567:789:NON_TRAIT\" out-identifier=\"test\"/>", marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallStartProcessCommand() {
String xmlCommand = "<start-process processId=\"org.drools.task.processOne\" out-identifier=\"id\"/>";
StartProcessCommand command = marshaller.unmarshall(xmlCommand, StartProcessCommand.class);
assertEquals("org.drools.task.processOne", command.getProcessId());
assertEquals(xmlCommand, marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallGetObjectsCommand() {
String xmlCommand = "<get-objects out-identifier=\"objects\"/>";
GetObjectsCommand command = marshaller.unmarshall(xmlCommand, GetObjectsCommand.class);
assertEquals("objects", command.getOutIdentifier());
assertEquals(xmlCommand, marshaller.marshall(command));
}
代码示例来源:origin: org.kie/kie-server-services
@Test
@Ignore("Set focus command not yet supported")
public void testMarshallAgendaGroupSetFocusCommand() {
String xmlCommand = "<agenda-group-set-focus name=\"my-agenda-group\"/>";
AgendaGroupSetFocusCommand command = marshaller.unmarshall(xmlCommand, AgendaGroupSetFocusCommand.class);
assertEquals("my-agenda-group", command.getName());
assertEquals(xmlCommand, marshaller.marshall(command));
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@SuppressWarnings("unchecked")
private <S extends Score<?>> S marshallUnmarshallScore(S toBeMarshalled) {
ScoreWrapper wrapper = new ScoreWrapper(toBeMarshalled);
SolverInstance instance = new SolverInstance();
instance.setScoreWrapper(wrapper);
String marshalledSolver = marshaller.marshall(instance);
SolverInstance result = marshaller.unmarshall(marshalledSolver, SolverInstance.class);
return (S) result.getScoreWrapper().toScore();
}
}
代码示例来源:origin: org.kie/kie-server-services
@Test
public void testMarshallRetractCommand() {
String xmlCommand = "<retract fact-handle=\"0:234:345:456:567:789\"/>";
DeleteCommand command = marshaller.unmarshall( xmlCommand, DeleteCommand.class );
assertEquals( "0:234:345:456:567:789:NON_TRAIT", command.getFactHandle().toExternalForm() );
assertEquals( "<retract fact-handle=\"0:234:345:456:567:789:NON_TRAIT\"/>", marshaller.marshall( command ) );
}
内容来源于网络,如有侵权,请联系作者删除!