I'm using Spring Oauth and I'm trying to insert test data into oauth_client_token table (client side Spring Oauth 2). When I look at the bytecode for Spring Oauth's JdbcClientTokenService.saveAccessToken
, I'm seeing this:
jdbcTemplate.update(
insertAccessTokenSql,
new Object[] { accessToken.getValue(), new SqlLobValue(SerializationUtils.serialize(accessToken)),
keyGenerator.extractKey(resource, authentication), name,
resource.getClientId() }, new int[] { Types.VARCHAR, Types.BLOB, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR });
What I'm concern about is this section new SqlLobValue(SerializationUtils.serialize(accessToken))
which is generating bytes of an object. I wanted a way for DBUnit to insert all this data during my integration test. What I did before was to generate a base64 byte string of some random string and let DBUnit insert it. However, when the JdbcClientTokenService.getAccessToken
is called, which calls SerializationUtils.deserialize on the byte, I get incorrect header exception. I believe this happen because, base64 is not generating the same output as SerializationUtils.serialize. Let me know if there's a way for me to use DBUnit to insert the correct data.
Thanks