This repository has been archived by the owner on Sep 26, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PAN-2972] Additional integration test for contract creation with pri…
…vacyGroupId (#1762) * Unit test for send raw transaction with privacy group * Integration test works a bit better now, need to abstract to a separate subclass, fix verifyForParticipants logic bug * Abstracts nodeCanDeployWithPrivacyGroupId to separate acceptance test * Tidies up integration test * Fix whitespace * Fix inspection issues * Restructure private transaction builder * Fix default privateFrom behaviour
- Loading branch information
1 parent
237281e
commit 4703548
Showing
3 changed files
with
150 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...src/test/java/tech/pegasys/pantheon/tests/web3j/privacy/PrivacyGroupIdAcceptanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* Copyright 2019 ConsenSys AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
package tech.pegasys.pantheon.tests.web3j.privacy; | ||
|
||
import tech.pegasys.pantheon.enclave.Enclave; | ||
import tech.pegasys.pantheon.enclave.types.CreatePrivacyGroupRequest; | ||
import tech.pegasys.pantheon.enclave.types.PrivacyGroup; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivacyAcceptanceTestBase; | ||
import tech.pegasys.pantheon.tests.acceptance.dsl.privacy.PrivacyNet; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class PrivacyGroupIdAcceptanceTest extends PrivacyAcceptanceTestBase { | ||
private static final String CONTRACT_NAME = "Event Emmiter"; | ||
private EventEmitterHarness eventEmitterHarness; | ||
private PrivacyGroup privacyGroup; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
PrivacyNet privacyNet = | ||
PrivacyNet.builder(privacy, privacyPantheon, cluster, false) | ||
.addMinerNode("Alice") | ||
.addMinerNode("Bob") | ||
.addMinerNode("Charlie") | ||
.build(); | ||
|
||
privacyNet.startPrivacyNet(); | ||
|
||
Enclave enclave = | ||
new Enclave(privacyNet.getNode("Alice").getPrivacyParameters().getEnclaveUri()); | ||
String[] addresses = | ||
privacyNet.getNodes().values().stream() | ||
.map(privacyNode -> privacyNode.orion.getPublicKeys()) | ||
.flatMap(List::stream) | ||
.toArray(String[]::new); | ||
this.privacyGroup = | ||
enclave.createPrivacyGroup( | ||
new CreatePrivacyGroupRequest( | ||
addresses, | ||
privacyNet.getNode("Alice").orion.getPublicKeys().get(0), | ||
"testName", | ||
"testDesc")); | ||
|
||
eventEmitterHarness = | ||
new EventEmitterHarness( | ||
privateTransactionBuilder, | ||
privacyNet, | ||
privateTransactions, | ||
privateTransactionVerifier, | ||
eea); | ||
} | ||
|
||
@Test | ||
public void nodeCanDeployWithPrivacyGroupId() { | ||
eventEmitterHarness.deployWithPrivacyGroup( | ||
CONTRACT_NAME, "Alice", privacyGroup.getPrivacyGroupId(), "Alice", "Bob", "Charlie"); | ||
} | ||
} |