Skip to content

Commit c8bf3aa

Browse files
[FAB-15077] Update integration tests
Remove basic-network based tests, all tests now run on top of first-network. Updated java sdk version to 1.4.1 Change-Id: Iae6db69342ee9b6f344588a7b9b5b84a072368b3 Signed-off-by: gennady <[email protected]>
1 parent cbe0ae3 commit c8bf3aa

File tree

71 files changed

+28
-1152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+28
-1152
lines changed

fabric-chaincode-integration-test/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
dependencies {
22
compile project(':fabric-chaincode-docker')
33
testCompile 'org.testcontainers:testcontainers:1.7.1'
4-
testCompile 'org.hyperledger.fabric-sdk-java:fabric-sdk-java:1.3.0-SNAPSHOT'
4+
testCompile 'org.hyperledger.fabric-sdk-java:fabric-sdk-java:1.4.1'
55
compile project(':fabric-chaincode-shim')
66
}
77

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
16
package org.hyperleder.fabric.shim.integration;
27

38
import org.hamcrest.Matchers;
@@ -13,12 +18,14 @@
1318

1419
import java.io.File;
1520
import java.io.IOException;
21+
import java.util.List;
22+
import java.util.stream.Collectors;
1623

1724

1825
public class SACCIntegrationTest {
1926
@ClassRule
2027
public static DockerComposeContainer env = new DockerComposeContainer(
21-
new File("src/test/resources/basic-network/docker-compose.yml")
28+
new File("src/test/resources/first-network/docker-compose-cli.yaml")
2229
)
2330
.withLocalCompose(false)
2431
.withPull(true);
@@ -38,29 +45,30 @@ public void TestSACCChaincodeInstallInstantiateInvokeQuery() throws Exception {
3845
final HFClient client = HFClient.createNewInstance();
3946
client.setCryptoSuite(crypto);
4047

41-
client.setUserContext(Utils.getAdminUser());
48+
client.setUserContext(Utils.getAdminUserOrg1TLS());
4249

43-
Channel myChannel = Utils.getMyChannelBasicNetwork(client);
50+
Channel myChannel = Utils.getMyChannelFirstNetwork(client);
51+
List<Peer> peers = myChannel.getPeers().stream().filter(peer -> peer.getName().indexOf("peer0.org1") != -1).collect(Collectors.toList());
4452

4553
InstallProposalRequest installProposalRequest = generateSACCInstallRequest(client);
46-
Utils.sendInstallProposals(client, installProposalRequest, myChannel.getPeers());
54+
Utils.sendInstallProposals(client, installProposalRequest, peers);
4755

4856
// Instantiating chaincode
4957
InstantiateProposalRequest instantiateProposalRequest = generateSACCInstantiateRequest(client);
50-
Utils.sendInstantiateProposal("javacc", instantiateProposalRequest, myChannel, myChannel.getPeers(), myChannel.getOrderers());
58+
Utils.sendInstantiateProposal("javacc", instantiateProposalRequest, myChannel, peers, myChannel.getOrderers());
5159

52-
client.setUserContext(Utils.getUser1());
60+
client.setUserContext(Utils.getUser1Org1TLS());
5361

5462
final TransactionProposalRequest proposalRequest = generateSACCInvokeRequest(client, "b", "200");
55-
Utils.sendTransactionProposalInvoke(proposalRequest, myChannel, myChannel.getPeers(), myChannel.getOrderers());
63+
Utils.sendTransactionProposalInvoke(proposalRequest, myChannel, peers, myChannel.getOrderers());
5664

5765
// Creating proposal for query
5866
final TransactionProposalRequest queryAProposalRequest = generateSACCQueryRequest(client, "a");
59-
Utils.sendTransactionProposalQuery(queryAProposalRequest, myChannel, myChannel.getPeers(), Matchers.is(200), Matchers.is("100"), null);
67+
Utils.sendTransactionProposalQuery(queryAProposalRequest, myChannel, peers, Matchers.is(200), Matchers.is("100"), null);
6068

6169
// Creating proposal for query
6270
final TransactionProposalRequest queryBProposalRequest = generateSACCQueryRequest(client, "b");
63-
Utils.sendTransactionProposalQuery(queryBProposalRequest, myChannel, myChannel.getPeers(), Matchers.is(200), Matchers.is("200"), null);
71+
Utils.sendTransactionProposalQuery(queryBProposalRequest, myChannel, peers, Matchers.is(200), Matchers.is("200"), null);
6472
}
6573

6674
static public InstallProposalRequest generateSACCInstallRequest(HFClient client) throws IOException, InvalidArgumentException {

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

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
16
package org.hyperleder.fabric.shim.integration;
27

38
import com.google.protobuf.ByteString;
@@ -33,38 +38,6 @@ public static void setUp() throws Exception {
3338
Utils.setUp();
3439
}
3540

36-
// @Test
37-
// public void testSACCFirstNetwork() throws IllegalAccessException, InvocationTargetException, InvalidArgumentException, InstantiationException, NoSuchMethodException, CryptoException, ClassNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, IOException, TransactionException, ProposalException, ChaincodeEndorsementPolicyParseException {
38-
// final CryptoSuite crypto = CryptoSuite.Factory.getCryptoSuite();
39-
//
40-
// // Create client and set default crypto suite
41-
// System.out.println("Creating client");
42-
// final HFClient client = HFClient.createNewInstance();
43-
// client.setCryptoSuite(crypto);
44-
//
45-
// client.setUserContext(Utils.getAdminUserOrg1TLS());
46-
//
47-
// Channel myChannel = Utils.getMyChannelFirstNetwork(client);
48-
//
49-
// System.out.println("Installing chaincode fabric-chaincode-example-sbe, packaged as gzip stream");
50-
// InstallProposalRequest installProposalRequest = generateSACCInstallRequest(client);
51-
// Utils.sendInstallProposals(client, installProposalRequest, myChannel.getPeers().stream().filter(peer -> peer.getName().indexOf("org1") != -1).collect(Collectors.toList()));
52-
//
53-
// client.setUserContext(Utils.getAdminUserOrg2TLS());
54-
// installProposalRequest = generateSACCInstallRequest(client);
55-
// Utils.sendInstallProposals(client, installProposalRequest, myChannel.getPeers().stream().filter(peer -> peer.getName().indexOf("org2") != -1).collect(Collectors.toList()));
56-
//
57-
// InstantiateProposalRequest instantiateProposal = generateSACCInstantiateRequest(client, "a", "100");
58-
// Utils.sendInstantiateProposal("javacc", instantiateProposal, myChannel, myChannel.getPeers().stream().filter(peer -> peer.getName().indexOf("peer0.org2") != -1).collect(Collectors.toList()), myChannel.getOrderers());
59-
//
60-
// client.setUserContext(Utils.getUser1Org1TLS());
61-
// TransactionProposalRequest proposal = generateSACCTransactionRequest(client, "b", "200");
62-
// Utils.sendTransactionProposalInvoke(proposal, myChannel, myChannel.getPeers().stream().filter(peer -> peer.getName().indexOf("peer0.org1") != -1).collect(Collectors.toList()), myChannel.getOrderers());
63-
//
64-
//// proposal = generateSBECCTransactionRequest(client, "getval", "pub");
65-
//
66-
// }
67-
6841
@Test
6942
public void testSBECCFirstNetwork() throws IllegalAccessException, InvocationTargetException, InvalidArgumentException, InstantiationException, NoSuchMethodException, CryptoException, ClassNotFoundException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, IOException, TransactionException, ProposalException, ChaincodeEndorsementPolicyParseException, ChaincodeCollectionConfigurationException {
7043
final CryptoSuite crypto = CryptoSuite.Factory.getCryptoSuite();
@@ -157,18 +130,6 @@ void RunSBE(HFClient client, Channel channel, String mode) throws NoSuchAlgorit
157130

158131
}
159132

160-
// private InstallProposalRequest generateSACCInstallRequest(HFClient client) throws IOException, InvalidArgumentException {
161-
// return Utils.generateInstallRequest(client, "javacc", "1.0", "../fabric-chaincode-example-sacc");
162-
// }
163-
//
164-
// static public InstantiateProposalRequest generateSACCInstantiateRequest(HFClient client, String... args) throws InvalidArgumentException, IOException, ChaincodeEndorsementPolicyParseException {
165-
// return Utils.generateInstantiateRequest(client, "javacc", "1.0", "src/test/resources/chaincodeendorsementpolicy.yaml", "init", args);
166-
// }
167-
//
168-
// static public TransactionProposalRequest generateSACCTransactionRequest(HFClient client, String... args) {
169-
// return Utils.generateTransactionRequest(client, "javacc", "1.0", "set", args);
170-
// }
171-
//
172133
private InstallProposalRequest generateSBECCInstallRequest(HFClient client) throws IOException, InvalidArgumentException {
173134
return Utils.generateInstallRequest(client, "sbecc", "1.0", "../fabric-chaincode-example-sbe");
174135
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
Copyright IBM Corp. All Rights Reserved.
3+
4+
SPDX-License-Identifier: Apache-2.0
5+
*/
16
package org.hyperleder.fabric.shim.integration;
27

38
import com.github.dockerjava.api.model.Container;

fabric-chaincode-integration-test/src/test/resources/basic-network/.env

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.

fabric-chaincode-integration-test/src/test/resources/basic-network/configtx.yaml

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

fabric-chaincode-integration-test/src/test/resources/basic-network/crypto-config.yaml

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

0 commit comments

Comments
 (0)