2
2
package com .hedera .services .yahcli .suites ;
3
3
4
4
import static com .hedera .node .app .hapi .utils .CommonPbjConverters .fromPbj ;
5
+ import static com .hedera .services .bdd .spec .HapiPropertySource .asAccount ;
5
6
import static com .hedera .services .bdd .spec .transactions .TxnVerbs .nodeCreate ;
6
7
import static com .hedera .services .bdd .spec .utilops .UtilVerbs .keyFromFile ;
7
8
import static com .hedera .services .bdd .spec .utilops .UtilVerbs .noOp ;
8
9
import static java .util .Objects .requireNonNull ;
9
10
10
11
import com .hedera .hapi .node .base .ServiceEndpoint ;
11
12
import com .hedera .services .bdd .spec .HapiSpec ;
13
+ import com .hedera .services .bdd .spec .SpecOperation ;
14
+ import com .hedera .services .bdd .spec .props .MapPropertySource ;
12
15
import com .hedera .services .bdd .suites .HapiSuite ;
13
- import com .hederahashgraph .api .proto .java .AccountID ;
16
+ import com .hedera .services .yahcli .config .ConfigManager ;
17
+ import com .hedera .services .yahcli .util .HapiSpecUtils ;
14
18
import edu .umd .cs .findbugs .annotations .NonNull ;
15
19
import edu .umd .cs .findbugs .annotations .Nullable ;
16
20
import java .util .List ;
17
- import java .util .Map ;
18
21
import java .util .stream .Stream ;
19
22
import org .apache .logging .log4j .LogManager ;
20
23
import org .apache .logging .log4j .Logger ;
23
26
public class CreateNodeSuite extends HapiSuite {
24
27
private static final Logger log = LogManager .getLogger (CreateNodeSuite .class );
25
28
26
- private final Map < String , String > specConfig ;
27
- private final AccountID accountId ;
29
+ private final ConfigManager configManager ;
30
+ private final long accountId ;
28
31
private final String description ;
29
32
private final String adminKeyLoc ;
30
33
@@ -40,17 +43,17 @@ public class CreateNodeSuite extends HapiSuite {
40
43
private Long createdId ;
41
44
42
45
public CreateNodeSuite (
43
- @ NonNull final Map < String , String > specConfig ,
44
- @ NonNull final AccountID accountId ,
46
+ @ NonNull final ConfigManager configManager ,
47
+ final long accountId ,
45
48
@ NonNull final String description ,
46
49
@ NonNull final List <ServiceEndpoint > gossipEndpoints ,
47
50
@ NonNull final List <ServiceEndpoint > serviceEndpoints ,
48
51
@ NonNull final byte [] gossipCaCertificate ,
49
52
@ NonNull final byte [] grpcCertificateHash ,
50
53
@ NonNull final String adminKeyLoc ,
51
54
@ Nullable final String feeAccountKeyLoc ) {
52
- this .specConfig = requireNonNull (specConfig );
53
- this .accountId = requireNonNull ( accountId ) ;
55
+ this .configManager = requireNonNull (configManager );
56
+ this .accountId = accountId ;
54
57
this .description = requireNonNull (description );
55
58
this .gossipEndpoints = requireNonNull (gossipEndpoints );
56
59
this .serviceEndpoints = requireNonNull (serviceEndpoints );
@@ -72,25 +75,28 @@ public List<Stream<DynamicTest>> getSpecsInSuite() {
72
75
final Stream <DynamicTest > createNode () {
73
76
final var adminKey = "adminKey" ;
74
77
final var feeAccountKey = "feeAccountKey" ;
75
- return HapiSpec .customHapiSpec ("CreateNode" )
76
- .withProperties (specConfig )
77
- .given (
78
- keyFromFile (adminKey , adminKeyLoc ).yahcliLogged (),
79
- feeAccountKeyLoc == null
80
- ? noOp ()
81
- : keyFromFile (feeAccountKey , feeAccountKeyLoc ).yahcliLogged ())
82
- .when ()
83
- .then (nodeCreate ("node" )
84
- .signedBy (availableSigners ())
85
- .accountId (accountId )
86
- .description (description )
87
- .gossipEndpoint (fromPbj (gossipEndpoints ))
88
- .serviceEndpoint (fromPbj (serviceEndpoints ))
89
- .gossipCaCertificate (gossipCaCertificate )
90
- .grpcCertificateHash (grpcCertificateHash )
91
- .adminKey (adminKey )
92
- .advertisingCreation ()
93
- .exposingCreatedIdTo (createdId -> this .createdId = createdId ));
78
+ final var fqAcctId = asAccount (
79
+ configManager .shard ().getShardNum (), configManager .realm ().getRealmNum (), accountId );
80
+
81
+ final var spec =
82
+ new HapiSpec ("CreateNode" , new MapPropertySource (configManager .asSpecConfig ()), new SpecOperation [] {
83
+ keyFromFile (adminKey , adminKeyLoc ).yahcliLogged (),
84
+ feeAccountKeyLoc == null
85
+ ? noOp ()
86
+ : keyFromFile (feeAccountKey , feeAccountKeyLoc ).yahcliLogged (),
87
+ nodeCreate ("node" )
88
+ .signedBy (availableSigners ())
89
+ .accountId (fqAcctId )
90
+ .description (description )
91
+ .gossipEndpoint (fromPbj (gossipEndpoints ))
92
+ .serviceEndpoint (fromPbj (serviceEndpoints ))
93
+ .gossipCaCertificate (gossipCaCertificate )
94
+ .grpcCertificateHash (grpcCertificateHash )
95
+ .adminKey (adminKey )
96
+ .advertisingCreation ()
97
+ .exposingCreatedIdTo (createdId -> this .createdId = createdId )
98
+ });
99
+ return HapiSpecUtils .targeted (spec , configManager );
94
100
}
95
101
96
102
private String [] availableSigners () {
0 commit comments