Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit 8f1fe23

Browse files
committed
FAB-4478 Post beta update
Change-Id: I9736e8bf924230e1271871b727b4aa4a769b653a Signed-off-by: rickr <cr22rc@gmail.com>
1 parent f5b46a2 commit 8f1fe23

File tree

8 files changed

+37
-42
lines changed

8 files changed

+37
-42
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,19 @@ SDK's `Enrollment` interface.
3232

3333

3434

35+
<p &nbsp; />
36+
<p &nbsp; />
37+
38+
`*************************************************`
39+
## *v1.0.0-beta*
40+
41+
There is a git tagged v1.0.0-beta [dec17727ddb6b269f8fb30930e10d89bc185225f] release of the SDK where there is no
42+
need to build the Fabric and Fabric-ca described below.
43+
The provided docker-compose.yaml for the integration tests should pull beta images
44+
from Docker hub.
45+
46+
Later versions of the SDK are NOT guaranteed to work with v1.0.0-beta
47+
3548
<p &nbsp; />
3649
<p &nbsp; />
3750

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

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

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

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

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>org.hyperledger.fabric-sdk-java</groupId>
55
<artifactId>fabric-sdk-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>1.0.0-beta</version>
7+
<version>1.0.0-SNAPSHOT</version>
88
<name>fabric-java-sdk</name>
99
<description>Java SDK for Hyperledger fabric project</description>
1010
<url>https://www.hyperledger.org/community/projects</url>

src/main/java/org/hyperledger/fabric/sdk/ChaincodeEndorsementPolicy.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ private static SignaturePolicy parsePolicy(IndexedHashMap<String, MSPPrincipal>
9595
throw new ChaincodeEndorsementPolicyParseException(format("%s expected to have list but found %s.", key, String.valueOf(vo)));
9696
}
9797

98-
@SuppressWarnings("unchecked")
99-
final List<Map<?, ?>> voList = (List<Map<?, ?>>)vo;
98+
@SuppressWarnings ("unchecked") final List<Map<?, ?>> voList = (List<Map<?, ?>>) vo;
10099

101100
if (voList.size() < matchNo) {
102101

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

111110
SignaturePolicy sp = parsePolicy(identities, nlo);
112-
spBuilder.addPolicies(sp);
111+
spBuilder.addRules(sp);
112+
113113
}
114114

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

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

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

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

221-
Map<?, ?> mp = (Map<?, ?>)load.get("policy");
221+
Map<?, ?> mp = (Map<?, ?>) load.get("policy");
222222

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

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

229229
SignaturePolicy sp = parsePolicy(identities, mp);
230230

231231
policyBytes = Policies.SignaturePolicyEnvelope.newBuilder()
232232
.setVersion(0)
233233
.addAllIdentities(identities.values())
234-
.setPolicy(sp)
234+
.setRule(sp)
235235
.build().toByteArray();
236236
}
237237

@@ -262,7 +262,7 @@ public byte[] getChaincodeEndorsementPolicyAsBytes() {
262262
return policyBytes;
263263
}
264264

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

src/main/java/org/hyperledger/fabric/sdk/Channel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,11 +1163,11 @@ private static Policy buildPolicyEnvelope(int nOf) {
11631163

11641164
SignaturePolicyEnvelope signaturePolicyEnvelope = SignaturePolicyEnvelope.newBuilder()
11651165
.setVersion(0)
1166-
.setPolicy(signaturePolicy).build();
1166+
.setRule(signaturePolicy).build();
11671167

11681168
return Policy.newBuilder()
11691169
.setType(Policy.PolicyType.SIGNATURE.getNumber())
1170-
.setPolicy(signaturePolicyEnvelope.toByteString())
1170+
.setValue(signaturePolicyEnvelope.toByteString())
11711171
.build();
11721172
}
11731173

src/main/proto/common/policies.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ message Policy {
3333
IMPLICIT_META = 3;
3434
}
3535
int32 type = 1; // For outside implementors, consider the first 1000 types reserved, otherwise one of PolicyType
36-
bytes policy = 2;
36+
bytes value = 2;
3737
}
3838

3939
// SignaturePolicyEnvelope wraps a SignaturePolicy and includes a version for future enhancements
4040
message SignaturePolicyEnvelope {
4141
int32 version = 1;
42-
SignaturePolicy policy = 2;
42+
SignaturePolicy rule = 2;
4343
repeated MSPPrincipal identities = 3;
4444
}
4545

@@ -52,7 +52,7 @@ message SignaturePolicyEnvelope {
5252
message SignaturePolicy {
5353
message NOutOf {
5454
int32 n = 1;
55-
repeated SignaturePolicy policies = 2;
55+
repeated SignaturePolicy rules = 2;
5656
}
5757
oneof Type {
5858
int32 signed_by = 1;

src/test/fixture/sdkintegration/.env

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_TLS=false
66
ORG_HYPERLEDGER_FABRIC_SDKTEST_INTEGRATIONTESTS_CA_TLS=
77
#
88
#Image tags:
9-
#IMAGE_TAG_FABRIC=
10-
#IMAGE_TAG_FABRIC_CA=
11-
IMAGE_TAG_FABRIC=:x86_64-1.0.0-beta
12-
IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0-beta
9+
#IMAGE_TAG_FABRIC=:x86_64-1.0.0-beta
10+
#IMAGE_TAG_FABRIC_CA=:x86_64-1.0.0-beta
11+
IMAGE_TAG_FABRIC=
12+
IMAGE_TAG_FABRIC_CA=

src/test/fixture/sdkintegration/peer-base/peer-base-no-tls.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/test/java/org/hyperledger/fabric/sdk/ChaincodeEndorsementPolicyTest.java

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

113113
}
114114

115-
Policies.SignaturePolicy policy = sigPolEnv.getPolicy();
116-
TypeCase typeCase = policy.getTypeCase();
115+
Policies.SignaturePolicy rule = sigPolEnv.getRule();
116+
TypeCase typeCase = rule.getTypeCase();
117117
assertEquals(TypeCase.N_OUT_OF.getNumber(), typeCase.getNumber());
118118

119119

0 commit comments

Comments
 (0)