You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2025. It is now read-only.
This command needs to be rerun each time the Integration tests are run.
172
79
80
+
You can clone these projects by going to the [Hyperledger repository](https://gerrit.hyperledger.org/r/#/admin/projects/).
173
81
82
+
## Latest Fabric Builds.
83
+
Latest Fabric builds are seldom needed except for those working on the very latest Fabric features.
84
+
Some information to help with that can been found in [Developer Instructions](./docs/DeveloperInstructions.md)
174
85
86
+
### Setting Up Eclipse
87
+
To get started using the Fabric Java SDK with Eclipse, refer to the instructions at: ./docs/EclipseSetup.md
175
88
176
89
## SDK dependencies
177
90
SDK depends on few third party libraries that must be included in your classpath when using the JAR file. To get a list of dependencies, refer to pom.xml file or run
178
91
<code>mvn dependency:tree</code> or <code>mvn dependency:list</code>.
179
-
180
92
Alternatively, <code> mvn dependency:analyze-report </code> will produce a report in HTML format in target directory listing all the dependencies in a more readable format.
181
93
182
-
## Using the SDK
183
-
The SDK's test cases uses chaincode in the SDK's source tree: `/src/test/fixture`
184
-
185
-
The SDK's JAR is in `target/fabric-sdk-java-1.1.0-SNAPSHOT.jar` and you will need the additional dependencies listed above.
94
+
To build this project, the following dependencies must be met
95
+
* JDK 1.8 or above
96
+
* Apache Maven 3.5.0
186
97
98
+
## Using the SDK
187
99
188
100
### Compiling
189
-
To build this project, the following dependencies must be met
190
-
* JDK 1.8 or above
191
-
* Apache Maven
192
101
193
102
Once your JAVA_HOME points to your installation of JDK 1.8 (or above) and JAVA_HOME/bin and Apache maven are in your PATH, issue the following command to build the jar file:
194
103
<code>
@@ -200,17 +109,16 @@ or
200
109
</code> if you don't want to run the unit tests
201
110
202
111
### Running the unit tests
203
-
To run the unit tests, please use <code>mvn test</code> or <code>mvn install</code> which will run the unit tests and build the jar file.
204
-
You must be running a local peer and orderer to be able to run the unit tests.
112
+
To run the unit tests, please use <code>mvn install</code> which will run the unit tests and build the jar file.
205
113
206
114
**Many unit tests will test failure condition's resulting in exceptions and stack traces being displayed. This is not an indication of failure!**
207
115
208
116
**[INFO] BUILD SUCCESS****_At the end is usually a very reliable indication that all tests have passed successfully!_**
209
117
210
118
### Running the integration tests
211
-
You must be running local instances of Fabric-ca, Fabric peers, and Fabric orderers to be able to run the integration tests. See above for running these services in Vagrant.
119
+
You must be running local instances of Fabric-ca, Fabric peers, and Fabric orderers to be able to run the integration tests. See above for for how to get a Fabric network running.
212
120
Use this `maven` command to run the integration tests:
The _src/test/java/org/hyperledger/fabric/sdkintegration/End2endIT.java_ integration test is an example of installing, instantiating, invoking and querying a chaincode.
@@ -220,13 +128,9 @@ The _src/test/java/org/hyperledger/fabric/sdkintegration/End2endAndBackAgainIT.j
220
128
upgrading chaincode and invoking the up graded chaincode.
221
129
222
130
Between End2endIT.java and End2endAndBackAgainIT.java this code shows almost all that the SDK can do.
223
-
To learn the SDK you must have some understanding first of the Fabric. Then it's best to study these two integrations tests and better yet work with them in a debugger to follow the code. ( *a live demo* )
131
+
To learn the SDK you must have some understanding first of the Fabric. Then it's best to study these two integrations tests and better yet work with them in a debugger to follow the code. ( *a live demo* )
224
132
Then once you understand them you can cut and paste from there to your own application. ( _the code is done for you!_ )
225
133
226
-
227
-
This test is a reworked version of the Fabric [e2e_cli example](https://github.com/hyperledger/fabric/tree/master/examples/e2e_cli) to demonstrate the features of the SDK.
228
-
To better understand blockchain and Fabric concepts, we recommend you install and run the _e2e_cli_ example.
229
-
230
134
### End to end test environment
231
135
The test defines one Fabric orderer and two organizations (peerOrg1, peerOrg2), each of which has 2 peers, one fabric-ca service.
232
136
@@ -243,7 +147,7 @@ In the directory src/test/fixture/sdkintegration/e2e-2Orgs/channel
For ease of assigning ports and mapping of artifacts to physical files, all peers, orderers, and fabric-ca are run as Docker containers controlled via a docker-compose configuration file.
249
153
@@ -253,8 +157,6 @@ The files used by the end to end are:
We need certificate and key for each of the Orderer and Peers for TLS connection. You can generate your certificate and key files with openssl command as follows:
169
+
Currently, the pom.xml is set to use netty-tcnative-boringssl for TLS connection to Orderer and Peers, however, you can change the pom.xml (uncomment a few lines) to use an alternative TLS connection via ALPN.
268
170
269
-
* Set up your own Certificate Authority (CA) for issuing certificates
270
-
* For each of orderers and peers:
271
-
* generate a private key: <code>openssl genrsa 512 > key.pem</code>.
272
-
* generate a certificate request (csr): <code>openssl req -new -days 365 -key key.pem -out csr.pem</code>, which will request your input for some information, where CN has to be the container's alias name (e.g. peer0, peer1, etc), all others can be left blank.
273
-
* sign the csr with the CA private key to generate a certificate: <code>openssl ca -days 365 -in csr.pem -keyfile {CA's privatekey} -notext -out cert.pem</code>
274
-
* put the resulting cert.pem and key.pem together with the CA's certificate (as the name cacert.pem) in the directory where the docker container can access.
171
+
### TLS Environment for SDK Integration Tests
172
+
The SDK Integration tests can be enabled by adding before the ./fabric restart the follow as:
275
173
276
-
The option -notext in the last openssl command in the above is important. Without the option, the resulting cert.pemmay does not work for some Java implementation (e.g. IBM JDK).
277
-
The certificates and keys for the end-to-end test case are stored in the directory _src/test/fixture/sdkintegration/e2e-2Org/tls/_.
Currently, the pom.xml is set to use netty-tcnative-boringssl for TLS connection to Orderer and Peers, however, you can change the pom.xml (uncomment a few lines) to use an alternative TLS connection via ALPN.
Policies are described in the [Fabric Endorsement Policies document](https://gerrit.hyperledger.org/r/gitweb?p=fabric.git;a=blob;f=docs/endorsement-policies.md;h=1eecf359c12c3f7c1ddc63759a0b5f3141b07f13;hb=HEAD).
@@ -321,19 +220,14 @@ For v1.1 integration the commands use the v11 profiles in configtx.yaml.
321
220
This should produce in the `v1.1` directory: bar.tx,foo.tx, orderer.block
322
221
323
222
**Note:** The above describes how this was done. If you redo this there are private key files
324
-
which are produced with uniqe names which won't match what's expected in the integration tests.
223
+
which are produced with unique names which won't match what's expected in the integration tests.
325
224
One examle of this is the docker-compose.yaml (search for **_sk**)
326
225
327
226
328
-
329
-
330
227
### GO Lang chaincode
331
228
Go lang chaincode dependencies must be contained in vendor folder.
332
229
For an explanation of this see [Vendor folder explanation](https://blog.gopheracademy.com/advent-2015/vendor-folder/)
333
230
334
-
### Setting Up Eclipse
335
-
336
-
To get started using the Fabric Java SDK with Eclipse, refer to the instructions at: ./docs/EclipseSetup.md
0 commit comments