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

Commit 33e43ee

Browse files
author
Jason Yellick
committed
FAB-16290 Make metadata fields lower case
As part of the effort to homogonize the package structure, the key names will (soon) be required to be lower case. This CR simply modifies the generated metadata keys to conform to this standard. Change-Id: Ida23c333c9bbe33d60afb1e6667cba19813b5656 Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
1 parent 31727ee commit 33e43ee

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ static byte[] generatePackageMataDataBytes(String label, String path, Transactio
327327
if (path == null) {
328328
path = "";
329329
}
330-
return format("{\"Path\":%s,\"Type\":\"%s\",\"Label\":%s}", new Gson().toJson(path), type.toPackageName(), new Gson().toJson(label)).getBytes(UTF_8);
330+
return format("{\"path\":%s,\"type\":\"%s\",\"label\":%s}", new Gson().toJson(path), type.toPackageName(), new Gson().toJson(label)).getBytes(UTF_8);
331331
}
332332

333333
public JsonObject getMetaInfJson() throws IOException {
@@ -380,7 +380,7 @@ public TransactionRequest.Type getType() throws IOException {
380380
JsonObject metaInfJson = getMetaInfJson();
381381
if (null != metaInfJson) {
382382

383-
String type = metaInfJson.containsKey("Type") ? metaInfJson.getString("Type") : null;
383+
String type = metaInfJson.containsKey("type") ? metaInfJson.getString("type") : null;
384384
if (null != type) {
385385

386386
return TransactionRequest.Type.fromPackageName(type);
@@ -393,7 +393,7 @@ public String getLabel() throws IOException {
393393
JsonObject metaInfJson = getMetaInfJson();
394394
if (null != metaInfJson) {
395395

396-
String label = metaInfJson.containsKey("Label") ? metaInfJson.getString("Label") : null;
396+
String label = metaInfJson.containsKey("label") ? metaInfJson.getString("label") : null;
397397
if (null != label) {
398398

399399
return label;
@@ -406,7 +406,7 @@ public String getPath() throws IOException {
406406
JsonObject metaInfJson = getMetaInfJson();
407407
if (null != metaInfJson) {
408408

409-
return metaInfJson.containsKey("Path") ? metaInfJson.getString("Path") : null;
409+
return metaInfJson.containsKey("path") ? metaInfJson.getString("path") : null;
410410
}
411411
return null;
412412
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ public void testGoLangCode() throws Exception {
4545
assertTrue(lifecycleChaincodePackage.getAsBytes().length > 1);
4646

4747
JsonObject metaInfJson = lifecycleChaincodePackage.getMetaInfJson();
48-
Assert.assertEquals(metaInfJson.getString("Path"), "github.com/example_cc");
49-
Assert.assertEquals(metaInfJson.getString("Type"), "golang");
48+
Assert.assertEquals(metaInfJson.getString("path"), "github.com/example_cc");
49+
Assert.assertEquals(metaInfJson.getString("type"), "golang");
5050
Assert.assertEquals(lifecycleChaincodePackage.getType(), TransactionRequest.Type.GO_LANG);
5151
Assert.assertEquals(lifecycleChaincodePackage.getPath(), "github.com/example_cc");
5252
Assert.assertEquals(lifecycleChaincodePackage.getLabel(), "mylabel");

0 commit comments

Comments
 (0)