Commit Graph

133 Commits

Author SHA1 Message Date
Katelyn Baker
063771fac4 CORDA-539 - Code Cleanup
Applying IntelliJ's white space reformat as no doubt I didn't follow the
coding convention too closely.

Remove some IntelliJ warnings
2017-09-13 09:52:00 +01:00
Katelyn Baker
c48a37a080 CORDA-539 - Add enum support to the carpenter
If the serializer is going to support enumerated types then the class
carpenter also has to

Refactor the Carpenter schema and fields to add an enum type, add code
in the carpenter to generate enum's and of course add tests
2017-09-13 09:52:00 +01:00
Ross Nicoll
de3468f8a7 Replace X500Name with CordaX500Name (#1447)
Replace X500Name with CordaX500Name, which enforces the specific constraints Corda expects on legal/service identity names.
2017-09-12 01:03:10 +01:00
Viktor Kolomeyko
64963d587c CORDA-540: Expose and fix AMQP serialization problem with UniquenessException (#1470) 2017-09-11 18:43:26 +01:00
Clinton
bc6628a072 ContractState now references contract by class name (#1407)
* ContractState's contract type has been moved to TransactionState and is now a string representing the class name of the contract class to allow classloading of arbitrary contracts from custom classloaders.

* Upgraded isolated JAR to new version.
2017-09-11 16:44:18 +01:00
Shams Asari
4c3ac89d6b Try.Failure is no longer parameterised on Nothing, to avoid any issues with Java 2017-09-10 14:54:32 +01:00
Viktor Kolomeyko
0edaea81d2 CORDA-540: Add a property to make sending stacktraces optional in AMQP mode (#1458) 2017-09-08 17:25:42 +01:00
Viktor Kolomeyko
8710090887 CORDA-540: Fixes to make "node" tests pass in AMQP mode, part 1 (#1455) 2017-09-08 13:46:22 +01:00
Rick Parker
691d9ea0bc Correctly unwrap MissingAttachmentException. (#1454) 2017-09-08 13:41:53 +01:00
Rick Parker
79f1e1ae7f Introduce current context concept for serialization in preparation for WireTransaction changes (#1448) 2017-09-08 08:16:38 +01:00
Rick Parker
6bf2871819 Change descriptor name from string to symbol on the wire to adhere to section 1.5 of the AMQP 1.0 spec (#1423) 2017-09-07 17:05:39 +01:00
Patrick Kuo
57412d4498 Enforce X500Name format defined in design doc (#1427)
* Standardise X500Name format - WIP

* address PR issues

* failing test fix and replace X500Name with getX500Name

* gradle plugin fix

* Added country code validation
2017-09-07 14:47:42 +01:00
Viktor Kolomeyko
d9d17be284 CORDA-540: Small changes to make "finance" tests pass in AMQP mode (#1445) 2017-09-07 13:31:41 +01:00
Viktor Kolomeyko
50c51493c3 CORDA-540: AMQP-forge "example-code" (#1439) 2017-09-07 11:17:55 +01:00
Viktor Kolomeyko
999515db95 CORDA-540: Allow maps as roots of serialization graph (#1432) 2017-09-06 15:06:35 +01:00
Andrzej Cichocki
b2051952d2 Add kotlin throwables to whitelist (#1424) 2017-09-06 12:58:06 +01:00
Viktor Kolomeyko
349692f831 CORDA-540: Tighten-up the unit test to prevent concrete collection classes to be used 2017-09-05 16:50:04 +01:00
Viktor Kolomeyko
cac2465ea5 CORDA-540: Special provisions when artificial "AnyType" is used 2017-09-05 16:50:04 +01:00
Viktor Kolomeyko
a01f390515 CORDA-540: Upgrade version of "org.apache.qpid:proton-j" used and minor project files changes 2017-09-05 16:50:04 +01:00
Viktor Kolomeyko
cd912f8add CORDA-540: Allow lists as root object in AMQP serialization graph 2017-09-05 16:50:04 +01:00
Rick Parker
ead4d09011 Plumb in plugin whitelist additions to AMQP implementation. (#1415) 2017-09-05 08:35:26 +01:00
Ross Nicoll
0df93e6e50 Start cleaning up node API Dokka comments (#1397)
* Change RPCApi comments to inline from Dokka, as the existing comments are not API documentation,
and render simply as "The RPC protocol:" in several places, which is unhelpful.
* Rewrite RPCApi comments to no longer be in semi-Dokka format, but instead better reflect they are functional documentation.
* Add Dokka documentation around RPC API
* Change JvmStatics to const
2017-09-04 22:29:41 +01:00
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