@Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); if (_elementType != null) { sb.append('<'); sb.append(_elementType.toCanonical()); sb.append('>'); } return sb.toString(); }
@Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); if (_keyType != null) { sb.append('<'); sb.append(_keyType.toCanonical()); sb.append(','); sb.append(_valueType.toCanonical()); sb.append('>'); } return sb.toString(); }
@Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); sb.append('<'); sb.append(_referencedType.toCanonical()); sb.append('>'); return sb.toString(); }
@Override protected String buildCanonicalName() { StringBuilder sb = new StringBuilder(); sb.append(_class.getName()); final int count = _bindings.size(); if (count > 0) { sb.append('<'); for (int i = 0; i < count; ++i) { JavaType t = containedType(i); if (i > 0) { sb.append(','); } sb.append(t.toCanonical()); } sb.append('>'); } return sb.toString(); }
throw new IllegalArgumentException("Failed to specialize base type "+baseType.toCanonical()+" as " +subclass.getName()+", problem: "+error);
(i+1), len, exp.toCanonical(), act.toCanonical());
@VisibleForTesting protected void setType(JavaType type, Map<String, Object> vendorExtensions) { vendorExtensions.put(ExtendConst.EXT_JAVA_CLASS, type.toCanonical()); }
public SerializedObjectDto(Object value) { type = TypeFactory.defaultInstance().constructType(value.getClass()).toCanonical(); object = value; }
public SerializedObjectDto(Object value) { type = TypeFactory.defaultInstance().constructType(value.getClass()).toCanonical(); object = value; }
protected String generateCacheKey(Message message, JavaType javaType) { return message.getCanonicalName() + ":" + javaType.toCanonical(); }
public static void throwNotSupportMerge(Field protoField, JavaType javaType) throws IllegalStateException { throw new IllegalStateException( String.format("not support deserialize proto %s as %s, field=%s:%s", protoField.getTypeName(), javaType.toCanonical(), ((Type) protoField.getParent()).getCanonicalName(), protoField.getName())); }
@Test public void testPutSingleSerializableVariableUnsupportedMediaType() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, "unsupported") .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("Unrecognized content type for serialized java type: unsupported")) .when() .post(SINGLE_PROCESS_INSTANCE_BINARY_VARIABLE_URL); verify(runtimeServiceMock, never()).setVariable(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), eq(variableKey), eq(serializable)); }
@Test public void testPutSingleLocalSerializableVariableUnsupportedMediaType() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, "unsupported") .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("Unrecognized content type for serialized java type: unsupported")) .when() .post(SINGLE_EXECUTION_LOCAL_BINARY_VARIABLE_URL); verify(runtimeServiceMock, never()).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), eq(serializable)); }
@Test public void testPostSingleLocalSerializableVariableUnsupportedMediaType() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", EXAMPLE_TASK_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, "unsupported") .multiPart("type", typeName, MediaType.TEXT_PLAIN) .header("accept", MediaType.APPLICATION_JSON) .expect() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("Unrecognized content type for serialized java type: unsupported")) .when() .post(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL); verify(taskServiceMock, never()).setVariableLocal(eq(EXAMPLE_TASK_ID), eq(variableKey), eq(serializable)); }
@Test public void testPutSingleLocalSerializableVariableUnsupportedMediaType() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_CASE_EXECUTION_ID) .pathParam("varId", variableKey) .multiPart("data", jsonBytes, "unsupported") .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("Unrecognized content type for serialized java type: unsupported")) .when() .post(SINGLE_CASE_EXECUTION_LOCAL_BINARY_VARIABLE_URL); verify(caseServiceMock, never()).withCaseExecution(MockProvider.EXAMPLE_CASE_EXECUTION_ID); }
@Test public void testPutSingleSerializableVariableUnsupportedMediaType() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, "unsupported") .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.BAD_REQUEST.getStatusCode()) .body(containsString("Unrecognized content type for serialized java type: unsupported")) .when() .post(SINGLE_CASE_INSTANCE_BINARY_VARIABLE_URL); }
@Test public void testPutSingleLocalSerializableVariableFromJson() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_EXECUTION_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, MediaType.APPLICATION_JSON) .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.NO_CONTENT.getStatusCode()) .when() .post(SINGLE_EXECUTION_LOCAL_BINARY_VARIABLE_URL); verify(runtimeServiceMock).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), argThat(EqualsObjectValue.objectValueMatcher().isDeserialized().value(serializable))); }
@Test public void testPutSingleSerializableVariable() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, MediaType.APPLICATION_JSON) .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.NO_CONTENT.getStatusCode()) .when() .post(SINGLE_PROCESS_INSTANCE_BINARY_VARIABLE_URL); verify(runtimeServiceMock).setVariable(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), eq(variableKey), argThat(EqualsObjectValue.objectValueMatcher().isDeserialized().value(serializable))); }
@Test public void testPostSingleSerializableVariable() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", EXAMPLE_TASK_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, MediaType.APPLICATION_JSON) .multiPart("type", typeName, MediaType.TEXT_PLAIN) .header("accept", MediaType.APPLICATION_JSON) .expect() .statusCode(Status.NO_CONTENT.getStatusCode()) .when() .post(SINGLE_TASK_SINGLE_BINARY_VARIABLE_URL); verify(taskServiceMock).setVariable(eq(MockProvider.EXAMPLE_TASK_ID), eq(variableKey), argThat(EqualsObjectValue.objectValueMatcher().isDeserialized().value(serializable))); }
@Test public void testPutSingleSerializableVariable() throws Exception { ArrayList<String> serializable = new ArrayList<String>(); serializable.add("foo"); ObjectMapper mapper = new ObjectMapper(); String jsonBytes = mapper.writeValueAsString(serializable); String typeName = TypeFactory.defaultInstance().constructType(serializable.getClass()).toCanonical(); String variableKey = "aVariableKey"; given() .pathParam("id", MockProvider.EXAMPLE_CASE_INSTANCE_ID).pathParam("varId", variableKey) .multiPart("data", jsonBytes, MediaType.APPLICATION_JSON) .multiPart("type", typeName, MediaType.TEXT_PLAIN) .expect() .statusCode(Status.NO_CONTENT.getStatusCode()) .when() .post(SINGLE_CASE_INSTANCE_BINARY_VARIABLE_URL); verify(caseServiceMock).withCaseExecution(MockProvider.EXAMPLE_CASE_INSTANCE_ID); verify(caseExecutionCommandBuilderMock).setVariable(eq(variableKey), argThat(EqualsObjectValue.objectValueMatcher().isDeserialized().value(serializable))); verify(caseExecutionCommandBuilderMock).execute(); }