diff --git a/README.md b/README.md index de7c76e9..cd47cbec 100644 --- a/README.md +++ b/README.md @@ -26,23 +26,23 @@ SDK's `Enrollment` interface. * TCerts are not supported: JIRA FAB-1401 * HSM not supported. JIRA FAB-3137 -* Single Crypto strength 256 JIRA FAB-2564 - -

`*************************************************` -## *v1.0.1* +## *v1.1.0-alpha* + +## v1.1 release notes +Please review the [v1.1 release notes](./docs/release_v1.1.0_notes.md) to familarize yourself with changes since v1.0 sdk release -### Git v1.0.1 +### Git v1.1.0-alpha -There is a git tagged v1.0.1 release of the SDK where there is no +There is a git tagged v1.1.0-alpha release of the SDK where there is no need to build the Hyperledger Fabric and Hyperledger Fabric CA described below. -The provided docker-compose.yaml for the integration tests should pull v1.0.1 tagged images from Docker hub. +The provided docker-compose.yaml for the integration tests should pull v1.1.0-alpha tagged images from Docker hub. -The v1.0.1 version of the Hyperledger Fabric Java SDK is published to Maven so you can directly use in your application's pom.xml. +The v1.1.0-alpha version of the Hyperledger Fabric Java SDK is published to Maven so you can directly use in your application's pom.xml. [Maven Repository Hyperledger Fabric Java SDK](https://mvnrepository.com/artifact/org.hyperledger.fabric-sdk-java/fabric-sdk-java) @@ -50,7 +50,7 @@ _Make sure you're using docker images at the level of the Fabric that matches th ### Using the SDK in your application -Add below code in your `pom.xml` to download fabric-sdk-java-1.0.1 +Add below code in your `pom.xml` to download fabric-sdk-java-1.1.0-alpha ```xml @@ -58,7 +58,7 @@ Add below code in your `pom.xml` to download fabric-sdk-java-1.0.1 org.hyperledger.fabric-sdk-java fabric-sdk-java - 1.0.1 + 1.1.0-alpha ``` @@ -182,7 +182,7 @@ Alternatively, mvn dependency:analyze-report will produce a repor ## Using the SDK The SDK's test cases uses chaincode in the SDK's source tree: `/src/test/fixture` -The SDK's JAR is in `target/fabric-sdk-java-1.1.0-SNAPSHOT.jar` and you will need the additional dependencies listed above. +The SDK's JAR is in `target/fabric-sdk-java-1.1.0-alpha.jar` and you will need the additional dependencies listed above. ### Compiling diff --git a/docs/release_v1.1.0_notes.md b/docs/release_v1.1.0_notes.md new file mode 100644 index 00000000..a1fb216d --- /dev/null +++ b/docs/release_v1.1.0_notes.md @@ -0,0 +1,103 @@ +# Java SDK for Hyperledger Fabric 1.1 release notes. + +The JSDK 1.1 has features added since the 1.0 based release to match those added to the Fabric 1.1 release. + +## Fabric v1.0 considerations +The SDK is mostly backward compatible with the v1.0 based Fabric with the following considerations +- The new peer eventing service is the default for the SDK however, in v1.0 Fabric peer eventing service is not supported. To address in applications that are + connecting to Fabric 1.0 you must when adding or joining a peer to a channel provide a PeerRole option. + A role with `PeerRole.NO_EVENT_SOURCE` has been defined that has the equivalent functionality of a v1.0 Peer. + You can see an example of this + in [End2endIT.java#L732](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L732) + and in [End2endAndBackAgainIT.java#L597](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L597) + + +## v1.1 Fabric features + +### [FAB-6066 JSDK Channel service for events](https://jira.hyperledger.org/browse/FAB-6066) +The Fabric Peer now implements eventing services on the same endpoint as proposal endorsements and it is no longer necessary to have an EventHub service. Using Peer +eventing is the preferred means for receiving events. Future releases of Fabric may not support Eventhubs. When joining or adding Peers to a channel the default is +to have the peer provide the eventing service. Whether a peer is an eventing or non-eventing is controlled by the peer options when adding or joining +a channel.You can see an example of this in [End2endIT.java#L732](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L732) +and in [End2endAndBackAgainIT.java#L597](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L597) + +Peers may be added to a channel with specific roles to help with distributing the workload. PeerRoles are defined in [Peer.java#L328](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/main/java/org/hyperledger/fabric/sdk/Peer.java#L328) +The default is for Peers to have all roles. + + +The new Peer eventing services will by default just return the last block on the blockchain. Note this is *not* the **next** block that gets +added to the chain. The application can now specifiy both the starting and ending block number to be sent. Applications set these +options when adding or joining peers to the channel with the PeerOption methods *startEvents*, *stopEvents* and *startEventsNewest* which +is the default. [End2endAndBackAgainIT.java#L234-L257](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L234-L257) +calls the method [`testPeerServiceEventingReplay`](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L719-L881) which restarts the channel with different start and stop values. + + + +### [FAB-7652 JSDK filterblock enablement](https://jira.hyperledger.org/browse/FAB-7652) + +Fabric supports on the new Peer eventing service limits to what the events return thourgh ACLs. The block event may contain the full Block or a FilteredBlock. +Applications requesting for a full Block without authority will get a permission failure. Application by default will get the full block. To request +request a FiltedBlock when adding or joining peers applications can add via PeerOptions.registerEventsForFilteredBlocks. An example of this is seen in +[End2endAndBackAgainIT.java#L592-595](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L592-L595) + +Application's that register block listeners need to be written to check for *isFiltered()" to know if the block is full or filtered. + +Filtered blocks are limited to the following methods. + +FilteredBlocks + - isFiltered should return true + - getChannelId the channel name + - getFilteredBlock the raw filtered block + - getBlockNumber blocknumber + - getEnvelopeCount number of envelopes + - getEnvelopeInfo index into envelopes. + - getEnvelopeInfos interator on envelopes + + EnvelopeInfo + - getChannelId channel name + - getTransactionID the transaction id + - isValid was the transaction valid. + - getType the type of envelope + + TransactionEnvelopeInfo all the methods on EnvelopeInfo + - getTransactionActionInfoCount number transactions + - getTransactionActionInfos an integrater over all the TransactionAction + + TransactionActionInfo + - getEvent chaincode events + + +### [FAB-6603 Java SDK CryptoPrimitives should perform Signature operations using standard JCA/JCE](https://jira.hyperledger.org/browse/FAB-6603) +Changes made to make the Java SDK crypto primitives to use more JCA/JCE compliant methods. These changes are internal and not +directly apparant to the application. This allows specifying other JCA/JCE provider. + +### [FAB-5632 Implement "Connection Profile" for java-sdk](https://jira.hyperledger.org/browse/FAB-5632) +Allow creating channels from a yaml or json specified document. Examples of this can be found in [NetworkConfigIT.java#L65](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/NetworkConfigIT.java#L65) + +### [FAB-5387 Provide listener for custom chaincode events.](https://jira.hyperledger.org/browse/FAB-5387) +Allow application to register for specific events triggered by chaincode. Example of this can be found in +[End2endIT.java#L303](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L303) + +The registerChaincodeEventListener method on the channel registers a call back that matches via a Java pattern on both the event name and the +chaincodeId. When ledger block with an event that matches that criteria specified is found by event hub or new peer event service the +callback is called to handle the event. + +### [FAB-6200 Java serialize channels.](https://jira.hyperledger.org/browse/FAB-6200) +Channels can be Java serialized and deserialized. Examples of this can be found throughout the integration tests. Example of serialization +in [End2endIT.java#L257](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java#L257) +where the sample store stores channel bar. Later in [End2endAndBackAgainIT.java#L562](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.java#L562-L565) +it's restored. +*Applications using this serialziation means will be tasked with any migrating future changes. The SDK will not do this.* +It's advised to use a different persistene means for saving and restoring channel.s + +## v1.1 Fabric/CA features + +### [FAB-7383 Implement the Fabric-CA identities and affiliations API](https://jira.hyperledger.org/browse/FAB-7383) +Fabric CA API added APIs for managing identies and affiliations. Examples how this can be done with Java SDK on how to +create, modify, read and delete are in [HFCAClientIT.java#L514-L658](https://github.com/hyperledger/fabric-sdk-java/blob/9224fa3f45a70392d1b244c080bf41bd561470d3/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L514-L658) +for identies and [HFCAClientIT#L704](https://github.com/hyperledger/fabric-sdk-java/blob/09f386c340e157e2a4f3f5cdde85e340f4586923/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L704-L1015) +for affiliations. + +### [FAB-6411 Add Java SDK support for gencrl endpoint](https://jira.hyperledger.org/browse/FAB-6411) +Support for getting certificate revocation list from Fabric-ca was added to the HFCAClient's **generateCRL** method. +Examples of this are in the integration tests that call [HFCAClientIT.java getRevokes method](https://github.com/hyperledger/fabric-sdk-java/blob/224f569d9d1f1f77e5d22e8e0c78f3d4e298b3fc/src/test/java/org/hyperledger/fabric_ca/sdkintegration/HFCAClientIT.java#L496-L500) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 65f18286..d857cf9a 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.hyperledger.fabric-sdk-java fabric-sdk-java jar - 1.1.0-SNAPSHOT + 1.1.0-alpha fabric-java-sdk Java SDK for Hyperledger fabric project https://www.hyperledger.org/community/projects diff --git a/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java b/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java index 66b42868..8410afc0 100644 --- a/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java +++ b/src/main/java/org/hyperledger/fabric_ca/sdk/HFCAAffiliation.java @@ -16,9 +16,6 @@ package org.hyperledger.fabric_ca.sdk; -import java.io.PrintWriter; -import java.io.StringWriter; - import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -28,7 +25,6 @@ import javax.json.JsonArray; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; -import javax.json.JsonWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,7 +32,6 @@ import org.hyperledger.fabric.sdk.helper.Utils; import org.hyperledger.fabric_ca.sdk.exception.AffiliationException; import org.hyperledger.fabric_ca.sdk.exception.HTTPException; -import org.hyperledger.fabric_ca.sdk.exception.IdentityException; import org.hyperledger.fabric_ca.sdk.exception.InvalidArgumentException; import static java.lang.String.format; @@ -521,7 +516,7 @@ private JsonObject affToJsonObject() { /** * Validate affiliation name for proper formatting * - * @param url the string to test. + * @param name the string to test. * @throws InvalidArgumentException */ void validateAffiliationNames(String name) throws InvalidArgumentException { @@ -542,7 +537,7 @@ void validateAffiliationNames(String name) throws InvalidArgumentException { /** * Validate affiliation name for proper formatting * - * @param url the string to test. + * @param name the string to test. * @throws InvalidArgumentException */ void validateSingleAffiliationName(String name) throws InvalidArgumentException { diff --git a/src/test/cirun.sh b/src/test/cirun.sh index 2c180cca..5bcfe6c1 100755 --- a/src/test/cirun.sh +++ b/src/test/cirun.sh @@ -27,10 +27,15 @@ export IMAGE_TAG_FABRIC=:x86_64-1.0.0 export IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0 else export ORG_HYPERLEDGER_FABRIC_SDKTEST_ITSUITE="" -export IMAGE_TAG_FABRIC=:latest -export IMAGE_TAG_FABRIC_CA=:latest +#unset to use what's in docker's .env file. +unset IMAGE_TAG_FABRIC +unset IMAGE_TAG_FABRIC_CA fi +echo "environment:--------------------" +env +echo "environment:--------------------" + cd $WD/src/test/fixture/sdkintegration ./fabric.sh restart >dockerlogfile.log 2>&1 & sleep 5; #give it this much to start. diff --git a/src/test/fixture/sdkintegration/.env b/src/test/fixture/sdkintegration/.env index a8c90228..20fa4359 100644 --- a/src/test/fixture/sdkintegration/.env +++ b/src/test/fixture/sdkintegration/.env @@ -7,13 +7,11 @@ #TLS: #ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=true #ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=--tls.enabled -#ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false +ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS= # #Image tags: -#IMAGE_TAG_FABRIC=:x86_64-1.0.1 -#IMAGE_TAG_FABRIC_CA=:x86_64-1.0.1 -IMAGE_TAG_FABRIC= -IMAGE_TAG_FABRIC_CA= +IMAGE_TAG_FABRIC=:x86_64-1.1.0-alpha +IMAGE_TAG_FABRIC_CA=:x86_64-1.1.0-alpha V11_IDENTITIES_ALLOWREMOVE=--cfg.identities.allowremove V11_AFFILIATIONS_ALLOWREMOVE=--cfg.affiliations.allowremove