Commit Graph

111 Commits

Author SHA1 Message Date
Rick Parker
015483656a Fix bad merge bdb87e38ca (#1411) 2017-09-04 16:21:58 +01:00
Katelyn Baker
a829dfadaa Bring enum serializer into line with AMQP
AMQP doesn't define an enum type itself yet the old implementation
listed our snum type as that in the schema despite what we are actually
doing which is serialising the enum down as a list of a string and an
int accompanied by a list of AMQP choices that represent all of the enum
values

Review Comments

Use fingerprinting of the enum types to catch whenever they're changed,
include the enum constants in the fingerprint to avoid any collisions
2017-09-04 11:56:45 +01:00
Katelyn Baker
ed2b2b02ca Add support for serialising enum types - Part 1
Part 2 will address the carpenting of enum classes
2017-09-04 11:56:36 +01:00
Rick Parker
f0b2b0a566 Change the condition for what is stored in AMQP object history for object reference logic (#1404) 2017-09-04 11:23:13 +01:00
Rick Parker
fef8a997f2 Fix the ToStringSerializer so it interacts with reference counting co… (#1385)
* Fix the ToStringSerializer so it interacts with reference counting correctly, and stop ref counting byte arrays since they are invariable wrapped in an object we do reference count.

* Pull out object reference condition into a helper function shared by serialization and deserialization
2017-09-01 16:07:30 +01:00
Viktor Kolomeyko
954ed69102 CORDA-540: Introduce mandatory reason for "kryoSpecific" (#1386)
* CORDA-540: Introduce mandatory reason for "kryoSpecific"

... before we forget why they are ignored in such a way

* CORDA-540: Write a test that exposes list serialization problem in AMQP mode

* Revert "Remove CompositeSignaturesWithKeys"

This reverts commit 9b3cad3
2017-09-01 14:45:14 +01:00
Ross Nicoll
7e3dd4c12c Restructure net.corda.core.crypto package
* Rename KeyFactory to CompositeKeyFactory
* Move expandedCompositeKeys into TestDSL as the only place that uses it
* Move NullKeys out of their own package
* Move remaining crypto classes into superpackage
* Move utility classes out of crypto and into utilities package
2017-09-01 10:55:58 +01:00
Rick Parker
9a8e7294e7 Fix AMQP object graph alignment bug and an issue with private constru… (#1376)
* Fix AMQP object graph alignment bug and an issue with private constructors.
2017-08-31 18:15:56 +01:00
Rick Parker
35dec9abdc Make addToWhitelist vararg for compactness. (#1361) 2017-08-31 13:24:45 +01:00
Viktor Kolomeyko
4387be0c4b CORDA-540: Mark CompositeKeyTests which works with cyclic graphs as Kryo specific (#1354) 2017-08-30 11:41:04 +01:00
Viktor Kolomeyko
0176184a86 CORDA-540: Cater for repeated object references found in the AMQP serialization graph (#1326)
Also provide unit test that clearly exposes the problem
2017-08-29 17:59:03 +01:00
Katelyn Baker
414f2b4b40 Review Comments - give test methods a better name 2017-08-29 16:23:10 +01:00
Katelyn Baker
1e023fcf54 Add alt serialise method that returns the schema and the bytes
For future testing it would be nice, post serialisation, to have easy
access to the serialised objects schema so we can check how it was
serialised. Adding a helper function to return a data class that does
this in the same way we can for deserialize
2017-08-29 15:20:43 +01:00
Rick Parker
c61b036844 Some custom serializers, fixes to generics handling, some annotations and added NonEmptySet as a special case of Set. (#1330) 2017-08-25 15:09:43 +01:00
Katelyn Baker
dda9d22264 Review Comments
* Typos in comments
 * Refactor some one liners
2017-08-24 17:36:01 +01:00
Katelyn Baker
e4a2529de0 More Review Comments
Move more logic into the constructor factory for the evolver seraliser
rather than everytime we read
2017-08-24 17:36:01 +01:00
Katelyn Baker
cf9fbc715d Review Comments
Refactor small bits of the serialiser, move things out of the read
methods and into the make factory companion object
2017-08-24 17:36:01 +01:00
Katelyn Baker
299b8026c7 Add constructor annotation for evolve selection
Current implementation is such that if we find *a* constructor that
works for us we use that, this is of course rather non deterministic, it
also means we may not select the best constructor

for example

old versions had constructors that took

V1: A B
V2: A B C D

if current version, V3 is

V3: A B C D E

which provides secondary constructors for the above then there is a
chance we'd de-serialise objects that were serialised as V2 using the V1
constructor and thus throw away information we don't need to

Additional Changes:

Fixes following rebase onto master
2017-08-24 17:36:01 +01:00
Katelyn Baker
7894e723e8 Fix evolver to work on nested schema types
Dumb assumption in the initial implementation meant it could only
evolve a top level type in the schema
2017-08-24 17:36:01 +01:00
Katelyn Baker
6bcfb2eddf Add better test, add support for constructor determination 2017-08-24 17:36:01 +01:00
Katelyn Baker
1d131eced5 Add Evolvability to Serializer
If we attempt to deserialize a class and find that since it's
serialization the definition has changed we need to create a serializer
capable of evolving the serialised data and constructing an instance of
the new type

We currently cope with

* Removing members
* Adding nullable members
* Adding non nullable members if a constructor is provided that
  allows us to set the old arguments and defaults the new (mandatory)
  fields
* Reordering paramters
2017-08-24 17:35:03 +01:00
Rick Parker
db07d717e0 Make constructors always accessible to deserialization code. (#1320) 2017-08-24 17:33:09 +01:00
Viktor Kolomeyko
d6d7fb52b4 Make sure members of type Class correctly serialized using AMQP (#1314)
* Minor changes and expose the problem with class serialization
* Custom serializer for Class
* More changes to make TransactionEncumbranceTests pass in AMQP mode
2017-08-23 17:37:49 +01:00
Rick Parker
0458e5415a java.time.* custom AMQP serializers and tests. Excludes pure enums. (#1308)
* java.time.* custom AMQP serializers and tests.  Excludes pure enums.

* Register java.time.* serializers with scheme.

* Provide default implementation of `additionalSerializers`
2017-08-23 12:08:09 +01:00
Viktor Kolomeyko
86fdbb9f22 Make OpaqueBytesSubSequence AMQP serializable (#1303) 2017-08-23 08:40:09 +01:00
Viktor Kolomeyko
66e6f90140 Make WireTransaction @CordaSerializable (#1299)
And do everything necessary for AttachmentClassLoaderTests to be passing in AMQP mode

* Changes following code review by @fenryka and @rick-r3
2017-08-22 16:53:55 +01:00
Viktor Kolomeyko
970ecf1bae Extend unit test to cover SecureHash and Opaque bytes 2017-08-22 10:04:36 +01:00
Chris Rankin
b33e299e3a Refactor serialisation contexts into separate classes, according to their use-cases. (#1293)
* Refactor Kryo contexts into separate classes, according to their use-cases. This prevents Kotlin from trying to instantiate them all every time.
* Also refactor AMQP contexts accordingly.
* Expand comments to explain why these serialisation contexts have been separated.
2017-08-21 14:19:21 +01:00
josecoll
a2ede0fc73 Requery removal (#1276)
* Removed Requery object relational mapping usage (and associated schemas including node-schemas module)

* Fixed issues with NodeAttachmentService tests.
Cannot use JPA custom converters with Primary Key fields.
Hibernate entities require explicit call to flush() to persist to disk.

* Removed redundant requery converters (equivalents not even required in Hibernate).

* Removed remaining gradle requery dependency definitions.

* Fixed broken tests.

* Fixes for failing NodeVaultService tests:
- Dynamic SQL updates (in soft locking code)
- Explicit request by session to participate in transaction (causing "TransactionRequiredException" Executing an update/delete query)
- Explicit flush() required to persist to disk

* Updated changelog.
Fixed compiler warning.

* Fixed WHERE clause AND/OR condition.
Enforced immediate data visibility through transaction commit.

* Final fixes to address failing tests.

* Deferred all hibernate session/txn management to DatabaseTransactionManager.

* Fixed transaction boundaries in failing Cash tests.

* Fixes to address failing tests (transaction boundaries, merge detached object, config clean-up).

* Final adjustment to transaction boundaries in JUnit tests.

* Refactored AttachmentSchemaV1 into NodeAttachmentService itself and referenced from NodeServicesV1.

* Refactored HSQL UPDATE statements to use CriteriaUpdate API.

* Updated all criteria API getters to reference attribute names by type.

* Remove redundant VaultSchema entity name (required when previously using HSQL UPDATE syntax)

* Fix compiler warnings.

* Minor changes following rebase from master.

* Fixed suppress warning type.
2017-08-21 10:42:59 +01:00
Rick Parker
56a84882a7 AMQP fixes: Don't attempt to include non-serializable interfaces in schemas (#1281)
* Ignore interfaces that are not serializable

* Annotate so test still works.

* Make methods accessible to serializer.

* Make sure interfaces are annotated in the carpenter.  Expand tests to check whitelisting.  Object is now whitelisted by default since it has no fields.

* Prevented Object from being whitelisted but allow arrays of Objects (i.e. pretty much an untyped array)
2017-08-21 10:27:27 +01:00
Viktor Kolomeyko
06ad2ddd45 Eliminate warnings in Java and Kotlin code
Functionally this change is a NOP
2017-08-21 09:36:24 +01:00
Viktor Kolomeyko
ee76de0957 Resolve a problem when Exceptions with suppression passed through Kryo serialization (#1280)
Also added some unit tests that expose the problem
2017-08-18 15:58:35 +01:00
Andrzej Cichocki
2829faa01f Retire legalContractReference (#1188)
* Add LegalProseReference annotation
* Migrate code from autogenerated javascript to TypeScript source
* Add instructions to rebuild the web resources
* Make installWeb more reproducible
2017-08-18 13:30:39 +01:00
Viktor Kolomeyko
5864a22d05 Move dependency on "proton-j" library from "core" sub-project to "node-api" 2017-08-18 09:49:46 +01:00
Viktor Kolomeyko
51ed943272 Remove SerializationFactory parameter from the places where it is not needed
Also minor improvements to the looping/if-branching code and documentation changes

Functionally, this change is a NOP
2017-08-17 17:53:40 +01:00
Viktor Kolomeyko
4a3848cc2a Delete KryoAMQPSerializer and its registration
As discussed with @rick-r3 this class is no longer fit for purpose because it may break reference equality if part of the graph been serialized with Kryo and part with AMQP
2017-08-17 17:52:47 +01:00
Katelyn Baker
e6e6644fc9 Fixes to bring into line with changes API
Can't have default factories now, they need building with whitelist and
classloader.

Also remove completely spurious import that broke everything, have a
feeling that was something IntelliJ pulled in "to be helpful"
2017-08-17 14:17:59 +01:00
Katelyn Baker
6076d39ee4 Remove spurious printlns 2017-08-17 13:53:35 +01:00
Katelyn Baker
c72ac2a102 Add WeakHashMap to the blacklist 2017-08-17 13:53:35 +01:00
Katelyn Baker
8bebd6ea0b Rework To better deal with types we won't serialise
* Add depricated jvm types to the blacklist
* Add concrete types for user convenience
* Add better "We won't serialise this because" error handling
2017-08-17 13:53:35 +01:00
Katelyn Baker
d2933ca8a3 Finalise which map containers to serialize 2017-08-17 13:53:35 +01:00
Katelyn Baker
de05a11511 Move toward allowing serialisation of concrete types 2017-08-17 13:53:35 +01:00
Katelyn Baker
4b8d6e32c3 Merge pull request #1269 from corda/bugfix/kat/missingFactory
Re-re-move Java test to the correct location, fix compile issue
2017-08-17 13:25:30 +01:00
Viktor Kolomeyko
4286065872 Eliminate explicit Kryo configuration to allow flexibility for AMQP 2017-08-17 12:01:27 +01:00
Chris Rankin
1672b4aa0a Simple deserialisation fixes. (#1243)
* Fix typo: prefered -> preferred
* Simplify KryoVerifierSerializationScheme and resolve warning.
* Add a custom serialiser for PrivacySeed so that we can avoid invoking RNG.
2017-08-17 11:15:04 +01:00
Katelyn Baker
f38954e550 Re-re-move Java test to the correct location, fix compile issue
Somehow this slipped past Gradle that I hadn't changed the serializer
factory here to take the needed argument now it's no longer defaulted
2017-08-17 11:04:30 +01:00
Katelyn Baker
2dc362a409 Merge pull request #1252 from corda/feature/kat/moveAMQPSerialiserTowardCommonInterface
Move AMQP serialiser toward common interface
2017-08-17 09:43:30 +01:00
Shams Asari
dc8d232480 Creating a PartyAndCertificate only requires a CertPath 2017-08-16 16:36:03 +01:00
Katelyn Baker
4d54d1a8dc Review Comments
Removing unused default method on the factory, it was added for testing
although given there are easier ways to build factories for the tests it
was never used and doesn't need leaving in
2017-08-16 11:39:07 +01:00
Katelyn Baker
49c23a58d1 Final changes integrating tests into the new API
Fix some rebase issues
Ensure tests are using the correct versions of the factories
2017-08-15 15:11:26 +01:00