Skip to content

Commit 0154aa4

Browse files
committed
Merge branch 'upstream-master' into external-chaincode
# Conflicts: # fabric-chaincode-shim/build.gradle # fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/shim/ChaincodeBase.java # fabric-chaincode-shim/src/test/java/org/hyperledger/fabric/shim/ChaincodeBaseTest.java
2 parents 6975e54 + 95c401b commit 0154aa4

25 files changed

Lines changed: 174 additions & 89 deletions

File tree

ci/azure-pipelines.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ stages:
6565
javaHomeOption: "JDKVersion"
6666
jdkVersionOption: "1.8"
6767
jdkArchitectureOption: "x64"
68+
options: "-x javadoc"
6869
publishJUnitResults: true
6970
testResultsFiles: "$(System.DefaultWorkingDirectory)/**/TEST-*.xml"
7071
tasks: "build"
@@ -122,7 +123,6 @@ stages:
122123

123124
- job: javadoc
124125
dependsOn: displayenv
125-
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
126126
variables:
127127
${{ if eq(variables['Build.SourceBranch'], 'refs/heads/master') }}:
128128
javadoc_release: master
@@ -159,6 +159,7 @@ stages:
159159
git commit -m "Publishing GitHub Pages"
160160
git push https://$(GITHUB-PAT)@github.com/hyperledger/fabric-chaincode-java.git gh-pages
161161
displayName: 'Commit gh-pages changes'
162+
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
162163
163164
# As the next script is more complex and uses loops, run this discretely in a sh file
164165
# Publishing step for git tags

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Check the [release notes](https://github.com/hyperledger/fabric-chaincode-java/r
4242

4343
## Compatibility
4444

45-
For details on what versions of Java and Hyperledger Fabric can be used please see the [compatibility document](COMPATIBILITY.md).
45+
For details on what versions of Java and Hyperledger Fabric can be used please see the [compatibility document](https://github.com/hyperledger/fabric-chaincode-java/blob/master/COMPATIBILITY.md).
4646

4747
## Samples
4848

49-
Java chaincode samples for commercial paper and fabcar can be found in the [fabric-samples repository](https://github.com/hyperledger/fabric-samples)
49+
Several Java chaincode samples can be found in the [fabric-samples repository](https://github.com/hyperledger/fabric-samples)

examples/fabric-contract-example-gradle-kotlin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
55

66

77
plugins {
8-
id("com.github.johnrengelman.shadow") version "2.0.3"
8+
id("com.github.johnrengelman.shadow") version "5.2.0"
99
id("org.jetbrains.kotlin.jvm") version "1.3.41"
1010
}
1111

fabric-chaincode-integration-test/src/contracts/fabric-shim-api/src/main/java/org/hyperledger/fabric/example/AllAPI.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import org.hyperledger.fabric.contract.Context;
77
import org.hyperledger.fabric.contract.ContractInterface;
88
import org.hyperledger.fabric.contract.annotation.*;
9-
10-
9+
import org.hyperledger.fabric.metrics.Metrics;
10+
import org.hyperledger.fabric.metrics.MetricsProvider;
1111
import org.hyperledger.fabric.shim.ledger.*;
1212
import org.hyperledger.fabric.shim.*;
1313
import java.util.*;
@@ -96,5 +96,12 @@ public String getByRangePaged(Context ctx, String start, String end, int pageSiz
9696
System.out.println("getByRangePaged<<");
9797
return newbookmark;
9898
}
99+
100+
@Transaction()
101+
public String getMetricsProviderName(Context ctx){
102+
final MetricsProvider provider = Metrics.getProvider();
103+
final String name = provider.getClass().getName();
104+
return name;
105+
}
99106

100107
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
MAX_INBOUND_MESSAGE_SIZE=4000
2+
CHAINCODE_METRICS_ENABLED=true
3+
TP_CORE_POOL_SIZE=4
4+
TP_MAX_POOL_SIZE=4
5+
TP_QUEUE_SIZE=4000
6+

fabric-chaincode-integration-test/src/test/java/org/hyperleder/fabric/shim/integration/shimtests/SACCIntegrationTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public void TestLedger(){
3838
System.out.println(text);
3939
assertThat(text, containsString("key130"));
4040

41+
text = helper.invoke(new String[]{"getMetricsProviderName"});
42+
System.out.println(text);
43+
assertThat(text, containsString("org.hyperledger.fabric.metrics.impl.DefaultProvider"));
4144
}
4245

4346
}

fabric-chaincode-shim/build.gradle

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ checkstyle {
3030
checkstyleMain {
3131
source ='src/main/java'
3232
}
33-
checkstyleMain.exclude("**/ChaincodeServerProperties.**")
3433
checkstyleTest {
3534
source ='src/test/java'
3635
}
@@ -125,8 +124,7 @@ jacocoTestCoverageVerification {
125124
'org.hyperledger.fabric.shim.impl.InvocationTaskExecutor',
126125
'org.hyperledger.fabric.shim.impl.ChaincodeInvocationTask',
127126
'org.hyperledger.fabric.shim.impl.QueryResultsIteratorImpl*',
128-
'org.hyperledger.fabric.shim.impl.ChaincodeMessageFactory',
129-
'org.hyperledger.fabric.shim.ChaincodeServerProperties']
127+
'org.hyperledger.fabric.shim.impl.ChaincodeMessageFactory']
130128
limit {
131129
minimum = 0.86
132130
}
@@ -215,21 +213,24 @@ task licenseCheck {
215213

216214

217215
javadoc {
218-
failOnError = false
216+
failOnError = true
219217
excludes = ['org/hyperledger/fabric/contract/ContextFactory.java',
220218
'org/hyperledger/fabric/contract/ContractRouter.java',
221219
'org/hyperledger/fabric/contract/ContractRuntimeException.java',
222220
'org/hyperledger/fabric/contract/execution/**',
223221
'org/hyperledger/fabric/contract/metadata/**',
224222
'org/hyperledger/fabric/contract/routing/**',
225223
'org/hyperledger/fabric/contract/systemcontract/**',
226-
'org/hyperledger/fabric/**/impl/**',
224+
'org/hyperledger/fabric/ledger/**',
227225
'org/hyperledger/fabric/shim/helper/**',
228-
'org/hyperledger/fabric/shim/ChaincodeBase.java',
229-
'org/hyperledger/fabric/shim/ChaincodeServerProperties.java']
226+
'org/hyperledger/fabric/**/impl/**']
227+
230228
source = sourceSets.main.allJava
231229

232-
classpath = sourceSets.main.compileClasspath
230+
classpath = sourceSets.main.runtimeClasspath
231+
232+
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
233+
options.overview = "src/main/java/org/hyperledger/fabric/overview.html"
233234
}
234235

235236
if (JavaVersion.current().isJava8Compatible()) {
@@ -359,4 +360,4 @@ tasks.withType(Test) {
359360
}
360361
}
361362
}
362-
}
363+
}

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* All methods on this interface have default implementations; for
1717
* many contracts it may not be needed to sub-class these.
1818
* <p>
19-
* Each method on the Contract that is marked with the {@link Transaction}
19+
* Each method on the Contract that is marked with the {@link org.hyperledger.fabric.contract.annotation.Transaction}
2020
* annotation is considered a Transaction Function. This is eligible for
2121
* calling. Each transaction function is supplied with its first parameter
2222
* being a {@link org.hyperledger.fabric.contract.Context}. The other parameters

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/ContractRouter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
/**
3333
* Router class routes Init/Invoke requests to contracts. Implements
3434
* {@link org.hyperledger.fabric.shim.Chaincode} interface.
35+
*
36+
* @see ContractInterface
3537
*/
3638
public final class ContractRouter extends ChaincodeBase {
3739
private static Logger logger = Logger.getLogger(ContractRouter.class.getName());
@@ -55,11 +57,11 @@ public ContractRouter(final String[] args) {
5557
super.initializeLogging();
5658
super.processEnvironmentOptions();
5759
super.processCommandLineOptions(args);
60+
super.validateOptions();
5861

5962
final Properties props = super.getChaincodeConfig();
6063
Metrics.initialize(props);
6164

62-
super.validateOptions();
6365
logger.fine("ContractRouter<init>");
6466
registry = new RoutingRegistryImpl();
6567
typeRegistry = TypeRegistry.getRegistry();

fabric-chaincode-shim/src/main/java/org/hyperledger/fabric/contract/annotation/package-info.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66

77
/**
8-
8+
* Provides annotations required for Contract implementations.
9+
*
10+
* @see org.hyperledger.fabric.contract.ContractInterface
911
*/
1012
package org.hyperledger.fabric.contract.annotation;

0 commit comments

Comments
 (0)