<commit_before>/*
Copyright IBM Corp All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package pvtdata

import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"syscall"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	docker "github.com/fsouza/go-dockerclient"
	"github.com/hyperledger/fabric/core/ledger/util"
	"github.com/hyperledger/fabric/integration/nwo"
	"github.com/hyperledger/fabric/integration/nwo/commands"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
	"github.com/tedsuo/ifrit"
	yaml "gopkg.in/yaml.v2"
)

// The chaincode used in these tests has two collections defined:
// collectionMarbles and collectionMarblePrivateDetails
// when calling QueryChaincode with first arg "readMarble", it will query collectionMarbles
// when calling QueryChaincode with first arg "readMarblePrivateDetails", it will query collectionMarblePrivateDetails

var _ bool = Describe("PrivateData", func() {
	var (
		testDir  string
		network  *nwo.Network
		process  ifrit.Process
		orderer  *nwo.Orderer
		allPeers []*nwo.Peer

		legacyChaincode       nwo.Chaincode
		newLifecycleChaincode nwo.Chaincode
		testChaincode         chaincode
		helper                *testHelper
	)

	BeforeEach(func() {
		testDir, network, process, orderer, allPeers = initThreeOrgsSetup()
		helper = &testHelper{
			networkHelper: &networkHelper{
				Network:   network,
				orderer:   orderer,
				peers:     allPeers,
				testDir:   testDir,
				channelID: "testchannel",
			},
		}

		legacyChaincode = nwo.Chaincode{
			Name:    "marblesp",
			Version: "1.0",
			Path:    "github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd",
			Ctor:    `{"Args":["init"]}`,
			Policy:  `OR ('Org1MSP.member','Org2MSP.member', 'Org3MSP.member')`,
			// collections_config1.json defines the access as follows:
			// 1. collectionMarbles - Org1, Org2 have access to this collection
			// 2. collectionMarblePrivateDetails - Org2 and Org3 have access to this collection
			CollectionsConfig: collectionConfig("collections_config1.json"),
		}

		newLifecycleChaincode = nwo.Chaincode{
			Name:              "marblesp",
			Version:           "1.0",
			Path:              "github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd",
			Lang:              "golang",
			PackageFile:       filepath.Join(testDir, "marbles-pvtdata.tar.gz"),
			Label:             "marbles-private-20",
			SignaturePolicy:   `OR ('Org1MSP.member','Org2MSP.member', 'Org3MSP.member')`,
			CollectionsConfig: collectionConfig("collections_config1.json"),
			Sequence:          "1",
		}
	})

	AfterEach(func() {
		testCleanup(testDir, network, process)
	})<commit_msg>Update pvtdata integration to use binary launcher<commit_after>/*
Copyright IBM Corp All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package pvtdata

import (
	"bytes"
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"syscall"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	docker "github.com/fsouza/go-dockerclient"
	"github.com/hyperledger/fabric/core/ledger/util"
	"github.com/hyperledger/fabric/integration/nwo"
	"github.com/hyperledger/fabric/integration/nwo/commands"
	"github.com/onsi/gomega/gbytes"
	"github.com/onsi/gomega/gexec"
	"github.com/tedsuo/ifrit"
	yaml "gopkg.in/yaml.v2"
)

// The chaincode used in these tests has two collections defined:
// collectionMarbles and collectionMarblePrivateDetails
// when calling QueryChaincode with first arg "readMarble", it will query collectionMarbles
// when calling QueryChaincode with first arg "readMarblePrivateDetails", it will query collectionMarblePrivateDetails

var _ bool = Describe("PrivateData", func() {
	var (
		testDir  string
		network  *nwo.Network
		process  ifrit.Process
		orderer  *nwo.Orderer
		allPeers []*nwo.Peer

		legacyChaincode       nwo.Chaincode
		newLifecycleChaincode nwo.Chaincode
		testChaincode         chaincode
		helper                *testHelper
	)

	BeforeEach(func() {
		testDir, network, process, orderer, allPeers = initThreeOrgsSetup()
		helper = &testHelper{
			networkHelper: &networkHelper{
				Network:   network,
				orderer:   orderer,
				peers:     allPeers,
				testDir:   testDir,
				channelID: "testchannel",
			},
		}

		legacyChaincode = nwo.Chaincode{
			Name:    "marblesp",
			Version: "1.0",
			Path:    "github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd",
			Ctor:    `{"Args":["init"]}`,
			Policy:  `OR ('Org1MSP.member','Org2MSP.member', 'Org3MSP.member')`,
			// collections_config1.json defines the access as follows:
			// 1. collectionMarbles - Org1, Org2 have access to this collection
			// 2. collectionMarblePrivateDetails - Org2 and Org3 have access to this collection
			CollectionsConfig: collectionConfig("collections_config1.json"),
		}

		newLifecycleChaincode = nwo.Chaincode{
			Name:              "marblesp",
			Version:           "1.0",
			Path:              components.Build("github.com/hyperledger/fabric/integration/chaincode/marbles_private/cmd"),
			Lang:              "binary",
			PackageFile:       filepath.Join(testDir, "marbles-pvtdata.tar.gz"),
			Label:             "marbles-private-20",
			SignaturePolicy:   `OR ('Org1MSP.member','Org2MSP.member', 'Org3MSP.member')`,
			CollectionsConfig: collectionConfig("collections_config1.json"),
			Sequence:          "1",
		}
	})

	AfterEach(func() {
		testCleanup(testDir, network, process)
	})
{'fraction_non_alphanumeric': 0.1190388848129127, 'fraction_numerical': 0.009904622157006602, 'mean_word_length': 3.5290697674418605, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3086305', 'n_tokens_mistral': 2041, 'n_tokens_neox': 1828, 'n_words': 362}