Skip to content

Commit

Permalink
FAB-4478 Post beta update
Browse files Browse the repository at this point in the history
Change-Id: I9736e8bf924230e1271871b727b4aa4a769b653a
Signed-off-by: rickr <cr22rc@gmail.com>
  • Loading branch information
cr22rc committed Jun 8, 2017
1 parent f5b46a2 commit 8f1fe23
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 42 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ SDK's `Enrollment` interface.



<p &nbsp; />
<p &nbsp; />

`*************************************************`
## *v1.0.0-beta*

There is a git tagged v1.0.0-beta [dec17727ddb6b269f8fb30930e10d89bc185225f] release of the SDK where there is no
need to build the Fabric and Fabric-ca described below.
The provided docker-compose.yaml for the integration tests should pull beta images
from Docker hub.

Later versions of the SDK are NOT guaranteed to work with v1.0.0-beta

<p &nbsp; />
<p &nbsp; />

Expand All @@ -43,16 +56,15 @@ SDK's `Enrollment` interface.
Hyperledger Fabric v1.0 is currently under active development and the very latest Hyperledger Fabric builds may not work with this sdk.
You should use the following commit levels of the Hyperledger projects:

TODO: update for beta release
<!--
[comment]: <> (****************************************************************************************************)
[comment]: <> (******* src/test/fabric_test_commitlevel.sh tells Jenkins to use the latest commit levels ******)
-->

| Project | Commit level | Date |
|:---------------|:------------------------------------------:|---------------------------:|
| fabric | d2bfa744059e68d2e50d2cb01d285e3c6e1f2757 | May 30 10:59:01 2017 +0000 |
| fabric-ca | ac2ee79ce8a1f80d5ae9c1ec84968882f45fd0e7 | May 27 06:11:20 2017 +0000 |
| fabric | d25b99453764b49050e3bdfe8745f530f74fee2b | Jun 8 13:22:35 2017 +0000 |
| fabric-ca | a2fb8ea3cf31e70d7fc20ed8a142f1b1a917ed05 | Jun 5 18:08:17 2017 +0000 |

You can clone these projects by going to the [Hyperledger repository](https://gerrit.hyperledger.org/r/#/admin/projects/).

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>org.hyperledger.fabric-sdk-java</groupId>
<artifactId>fabric-sdk-java</artifactId>
<packaging>jar</packaging>
<version>1.0.0-beta</version>
<version>1.0.0-SNAPSHOT</version>
<name>fabric-java-sdk</name>
<description>Java SDK for Hyperledger fabric project</description>
<url>https://www.hyperledger.org/community/projects</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ private static SignaturePolicy parsePolicy(IndexedHashMap<String, MSPPrincipal>
throw new ChaincodeEndorsementPolicyParseException(format("%s expected to have list but found %s.", key, String.valueOf(vo)));
}

@SuppressWarnings("unchecked")
final List<Map<?, ?>> voList = (List<Map<?, ?>>)vo;
@SuppressWarnings ("unchecked") final List<Map<?, ?>> voList = (List<Map<?, ?>>) vo;

if (voList.size() < matchNo) {

Expand All @@ -109,7 +108,8 @@ private static SignaturePolicy parsePolicy(IndexedHashMap<String, MSPPrincipal>
for (Map<?, ?> nlo : voList) {

SignaturePolicy sp = parsePolicy(identities, nlo);
spBuilder.addPolicies(sp);
spBuilder.addRules(sp);

}

return SignaturePolicy.newBuilder().setNOutOf(spBuilder.build()).build();
Expand Down Expand Up @@ -152,7 +152,7 @@ private static IndexedHashMap<String, MSPPrincipal> parseIdentities(Map<?, ?> id
if (!(role instanceof Map)) {
throw new ChaincodeEndorsementPolicyParseException(format("In identities with key %s value expected Map for role got %s ", key, role == null ? "null" : role.getClass().getName()));
}
final Map<?, ?> roleMap = (Map<?, ?>)role;
final Map<?, ?> roleMap = (Map<?, ?>) role;

Object name = (roleMap).get("name");

Expand Down Expand Up @@ -216,22 +216,22 @@ public void fromFile(File policyFile) throws IOException {

public void fromYamlFile(File yamlPolicyFile) throws IOException, ChaincodeEndorsementPolicyParseException {
final Yaml yaml = new Yaml();
final Map<?, ?> load = (Map<?, ?>)yaml.load(new FileInputStream(yamlPolicyFile));
final Map<?, ?> load = (Map<?, ?>) yaml.load(new FileInputStream(yamlPolicyFile));

Map<?, ?> mp = (Map<?, ?>)load.get("policy");
Map<?, ?> mp = (Map<?, ?>) load.get("policy");

if (null == mp) {
throw new ChaincodeEndorsementPolicyParseException("The policy file has no policy section");
}

IndexedHashMap<String, MSPPrincipal> identities = parseIdentities((Map<?, ?>)load.get("identities"));
IndexedHashMap<String, MSPPrincipal> identities = parseIdentities((Map<?, ?>) load.get("identities"));

SignaturePolicy sp = parsePolicy(identities, mp);

policyBytes = Policies.SignaturePolicyEnvelope.newBuilder()
.setVersion(0)
.addAllIdentities(identities.values())
.setPolicy(sp)
.setRule(sp)
.build().toByteArray();
}

Expand Down Expand Up @@ -262,7 +262,7 @@ public byte[] getChaincodeEndorsementPolicyAsBytes() {
return policyBytes;
}

@SuppressWarnings("serial")
@SuppressWarnings ("serial")
private static class IndexedHashMap<K, V> extends LinkedHashMap<K, V> {
final HashMap<K, Integer> kmap = new HashMap<>();

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/hyperledger/fabric/sdk/Channel.java
Original file line number Diff line number Diff line change
Expand Up @@ -1163,11 +1163,11 @@ private static Policy buildPolicyEnvelope(int nOf) {

SignaturePolicyEnvelope signaturePolicyEnvelope = SignaturePolicyEnvelope.newBuilder()
.setVersion(0)
.setPolicy(signaturePolicy).build();
.setRule(signaturePolicy).build();

return Policy.newBuilder()
.setType(Policy.PolicyType.SIGNATURE.getNumber())
.setPolicy(signaturePolicyEnvelope.toByteString())
.setValue(signaturePolicyEnvelope.toByteString())
.build();
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/proto/common/policies.proto
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ message Policy {
IMPLICIT_META = 3;
}
int32 type = 1; // For outside implementors, consider the first 1000 types reserved, otherwise one of PolicyType
bytes policy = 2;
bytes value = 2;
}

// SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements
message SignaturePolicyEnvelope {
int32 version = 1;
SignaturePolicy policy = 2;
SignaturePolicy rule = 2;
repeated MSPPrincipal identities = 3;
}

Expand All @@ -52,7 +52,7 @@ message SignaturePolicyEnvelope {
message SignaturePolicy {
message NOutOf {
int32 n = 1;
repeated SignaturePolicy policies = 2;
repeated SignaturePolicy rules = 2;
}
oneof Type {
int32 signed_by = 1;
Expand Down
8 changes: 4 additions & 4 deletions src/test/fixture/sdkintegration/.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false
ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=
#
#Image tags:
#IMAGE_TAG_FABRIC=
#IMAGE_TAG_FABRIC_CA=
IMAGE_TAG_FABRIC=:x86_64-1.0.0-beta
IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0-beta
#IMAGE_TAG_FABRIC=:x86_64-1.0.0-beta
#IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0-beta
IMAGE_TAG_FABRIC=
IMAGE_TAG_FABRIC_CA=
17 changes: 0 additions & 17 deletions src/test/fixture/sdkintegration/peer-base/peer-base-no-tls.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -112,8 +112,8 @@ public void testSDKIntegrationYaml() throws IOException, ChaincodeEndorsementPol

}

Policies.SignaturePolicy policy = sigPolEnv.getPolicy();
TypeCase typeCase = policy.getTypeCase();
Policies.SignaturePolicy rule = sigPolEnv.getRule();
TypeCase typeCase = rule.getTypeCase();
assertEquals(TypeCase.N_OUT_OF.getNumber(), typeCase.getNumber());


Expand Down

0 comments on commit 8f1fe23

Please sign in to comment.