diff --git a/integration/java_chaincode/javacc_test.go b/integration/java_chaincode/javacc_test.go index 3e37fadca09..0b6015978a4 100644 --- a/integration/java_chaincode/javacc_test.go +++ b/integration/java_chaincode/javacc_test.go @@ -23,7 +23,7 @@ import ( "github.com/hyperledger/fabric/integration/nwo/commands" ) -var _ = Describe("EndToEnd-JavaCC", func() { +var _ = Describe("Java Chaincode EndToEnd Suite", func() { var ( testDir string client *docker.Client @@ -40,11 +40,18 @@ var _ = Describe("EndToEnd-JavaCC", func() { client, err = docker.NewClientFromEnv() Expect(err).NotTo(HaveOccurred()) + network = nwo.New(nwo.BasicSolo(), testDir, client, 40000+1000*GinkgoParallelNode(), components) + network.GenerateConfigTree() + network.Bootstrap() + + networkRunner := network.NetworkGroupRunner() + process = ifrit.Invoke(networkRunner) + Eventually(process.Ready()).Should(BeClosed()) }) AfterEach(func() { if process != nil { - process.Signal(syscall.SIGILL) + process.Signal(syscall.SIGKILL) Eventually(process.Wait(), time.Minute).Should(Receive()) } if network != nil { @@ -53,66 +60,55 @@ var _ = Describe("EndToEnd-JavaCC", func() { os.RemoveAll(testDir) }) - Describe("javacc project runs on top of basic solo network with 2 org", func() { - BeforeEach(func() { - network = nwo.New(nwo.BasicSolo(), testDir, client, 30000, components) - network.GenerateConfigTree() - network.Bootstrap() - - networkRunner := network.NetworkGroupRunner() - process = ifrit.Invoke(networkRunner) - Eventually(process.Ready()).Should(BeClosed()) - }) - - It("support for java chaincode gradle project", func() { - chaincode = nwo.Chaincode{ - Name: "mycc", - Version: "0.0", - Path: "../chaincode/java/simple/gradle/", - Ctor: `{"Args":["init","a","100","b","200"]}`, - Policy: `OR ('Org1MSP.member','Org2MSP.member')`, - Lang: "java", - } - - By("getting the orderer by name") - orderer := network.Orderer("orderer") - - By("setting up the channel") - network.CreateAndJoinChannel(orderer, "testchannel") - - By("deploying the chaincode") - nwo.DeployChaincode(network, "testchannel", orderer, chaincode) - - By("getting the client peer by name") - peer := network.Peer("Org1", "peer0") - - RunQueryInvokeQuery(network, orderer, peer) - }) - It("support for private data in java chaincode", func() { - chaincode = nwo.Chaincode{ - Name: "mycc", - Version: "0.0", - Path: "../chaincode/java/simple_pvtdata/gradle/", - Ctor: `{"Args":["init","a","100","b","200"]}`, - Policy: `OR ('Org1MSP.member','Org2MSP.member')`, - Lang: "java", - CollectionsConfig: "testdata/collection_config.json", - } - - By("getting the orderer by name") - orderer := network.Orderer("orderer") - - By("setting up the channel") - network.CreateAndJoinChannel(orderer, "testchannel") - - By("deploying the chaincode") - nwo.DeployChaincode(network, "testchannel", orderer, chaincode) - - By("getting the client peer by name") - peer := network.Peer("Org1", "peer0") - - RunQueryInvokeQuery(network, orderer, peer) - }) + It("supports java chaincode from a gradle project", func() { + chaincode = nwo.Chaincode{ + Name: "mycc", + Version: "0.0", + Path: "../chaincode/java/simple/gradle/", + Ctor: `{"Args":["init","a","100","b","200"]}`, + Policy: `OR ('Org1MSP.member','Org2MSP.member')`, + Lang: "java", + } + + By("getting the orderer by name") + orderer := network.Orderer("orderer") + + By("setting up the channel") + network.CreateAndJoinChannel(orderer, "testchannel") + + By("deploying the chaincode") + nwo.DeployChaincode(network, "testchannel", orderer, chaincode) + + By("getting the client peer by name") + peer := network.Peer("Org1", "peer0") + + RunQueryInvokeQuery(network, orderer, peer) + }) + + It("supports private data in java chaincode", func() { + chaincode = nwo.Chaincode{ + Name: "mycc", + Version: "0.0", + Path: "../chaincode/java/simple_pvtdata/gradle/", + Ctor: `{"Args":["init","a","100","b","200"]}`, + Policy: `OR ('Org1MSP.member','Org2MSP.member')`, + Lang: "java", + CollectionsConfig: "testdata/collection_config.json", + } + + By("getting the orderer by name") + orderer := network.Orderer("orderer") + + By("setting up the channel") + network.CreateAndJoinChannel(orderer, "testchannel") + + By("deploying the chaincode") + nwo.DeployChaincode(network, "testchannel", orderer, chaincode) + + By("getting the client peer by name") + peer := network.Peer("Org1", "peer0") + + RunQueryInvokeQuery(network, orderer, peer) }) }) diff --git a/integration/nwo/components.go b/integration/nwo/components.go index c3f7ca6825e..e9d6197b81e 100644 --- a/integration/nwo/components.go +++ b/integration/nwo/components.go @@ -7,7 +7,9 @@ SPDX-License-Identifier: Apache-2.0 package nwo import ( + "fmt" "os" + "runtime" "github.com/hyperledger/fabric/integration/helpers" "github.com/hyperledger/fabric/integration/runner" @@ -20,7 +22,8 @@ type Components struct { } var RequiredImages = []string{ - "hyperledger/fabric-ccenv:latest", + fmt.Sprintf("hyperledger/fabric-ccenv:%s-latest", runtime.GOARCH), + fmt.Sprintf("hyperledger/fabric-javaenv:%s-latest", runtime.GOARCH), runner.CouchDBDefaultImage, runner.KafkaDefaultImage, runner.ZooKeeperDefaultImage, diff --git a/sampleconfig/core.yaml b/sampleconfig/core.yaml index 594506d87f3..1c595228c6b 100644 --- a/sampleconfig/core.yaml +++ b/sampleconfig/core.yaml @@ -531,7 +531,6 @@ chaincode: # This image is packed with shim layer libraries that are necessary # for Java chaincode runtime. runtime: $(DOCKER_NS)/fabric-javaenv:$(ARCH)-$(PROJECT_VERSION) - # from $(DOCKER_NS)/fabric-javaenv:$(ARCH)-1.2.0 node: # need node.js engine at runtime, currently available in baseimage