@@ -529,9 +529,14 @@ TEST_F(ProjMgrRpcTests, RpcResolveComponents) {
529529 vector<string> contextList = {
530530 context
531531 };
532+ RpcArgs::Options opt{" " };
533+ json resolveParam;
534+ resolveParam[" context" ] = context;
535+ RpcArgs::to_json (resolveParam[" options" ], opt);
536+
532537 auto requests = CreateLoadRequests (" /Validation/dependencies.csolution.yml" , " " , contextList);
533538 requests += FormatRequest (3 , " ValidateComponents" , json ({{ " context" , context }}));
534- requests += FormatRequest (4 , " Resolve" , json ({{ " context " , context }}) );
539+ requests += FormatRequest (4 , " Resolve" , resolveParam );
535540 requests += FormatRequest (5 , " ValidateComponents" , json ({{ " context" , context }}));
536541
537542 const auto & responses = RunRpcMethods (requests);
@@ -666,7 +671,63 @@ TEST_F(ProjMgrRpcTests, RpcSelectComponentLayer) {
666671 EXPECT_TRUE (components[1 ][" options" ][" explicitVendor" ]);
667672}
668673
674+ TEST_F (ProjMgrRpcTests, RpcResolveComponentLayer) {
675+ string context = " selectable+CM0" ;
676+ vector<string> contextList = {
677+ context
678+ };
679+ RpcArgs::Options opt{" core.clayer.yml" , " @>=0.1.0" , true };
680+ json param;
681+ param[" context" ] = context;
682+ RpcArgs::to_json (param[" options" ], opt);
683+
684+ auto requests = CreateLoadRequests (" /Validation/dependencies.csolution.yml" , " " , contextList);
685+ requests += FormatRequest (3 , " GetUsedItems" , json ({{ " context" , context }}));
686+ requests += FormatRequest (4 , " Resolve" , param);
687+ requests += FormatRequest (5 , " GetComponentsTree" , json ({{ " context" , context }, {" all" , false }}));
688+ requests += FormatRequest (6 , " GetComponentsTree" , json ({{ " context" , context }, {" all" , true }}));
689+ requests += FormatRequest (7 , " GetComponentsTree" , json ({{ " context" , context }, {" all" , false }}));
690+ requests += FormatRequest (8 , " Apply" , json ({{ " context" , context }}));
691+ requests += FormatRequest (9 , " GetUsedItems" , json ({{ " context" , context }}));
692+
693+ const auto & responses = RunRpcMethods (requests);
669694
695+ EXPECT_TRUE (responses[2 ][" result" ][" success" ]);
696+ auto components = responses[2 ][" result" ][" components" ];
697+ auto packs = responses[2 ][" result" ][" packs" ];
698+ EXPECT_EQ (packs.size (), 2 );
699+ EXPECT_EQ (packs[0 ][" pack" ], " ARM::RteTest_DFP@0.2.0" );
700+ EXPECT_EQ (packs[0 ][" resolvedPack" ], " ARM::RteTest_DFP@0.2.0" );
701+ EXPECT_EQ (components[0 ][" id" ], " Device:Startup&RteTest Startup" );
702+ EXPECT_EQ (components[0 ][" resolvedComponent" ][" id" ], " ARM::Device:Startup&RteTest Startup@2.0.3" );
703+
704+ EXPECT_TRUE (responses[3 ][" result" ][" success" ]); // resolve successful
705+
706+ EXPECT_TRUE (responses[7 ][" result" ][" success" ]); // apply successful
707+
708+ components = responses[8 ][" result" ][" components" ];
709+ packs = responses[8 ][" result" ][" packs" ];
710+ EXPECT_EQ (packs.size (), 3 ); // added reference to layer file
711+ EXPECT_EQ (packs[0 ][" pack" ], " ARM::RteTest_DFP@0.2.0" );
712+ string origin = packs[0 ][" origin" ];
713+ EXPECT_TRUE (origin.find (" .csolution.yml" ) != string::npos);
714+ EXPECT_TRUE (!!packs[0 ][" selected" ]);
715+ EXPECT_EQ (packs[2 ][" pack" ], " ARM::RteTest_DFP@0.2.0" );
716+ EXPECT_EQ (packs[2 ][" origin" ], " core.clayer.yml" );
717+ EXPECT_TRUE (!!packs[2 ][" selected" ]);
718+
719+ EXPECT_EQ (components[0 ][" id" ], " Device:Startup&RteTest Startup" );
720+ EXPECT_EQ (components[0 ][" resolvedComponent" ][" id" ], " ARM::Device:Startup&RteTest Startup@2.0.3" );
721+
722+ string id = components[1 ][" id" ];
723+ EXPECT_EQ (id, " ARM::RteTest:CORE@>=0.1.0" );
724+ EXPECT_EQ (RteUtils::ExtractPrefix (id, " ::" ), " ARM" );
725+ EXPECT_EQ (RteUtils::ExtractSuffix (id, " @" , true ), " @>=0.1.0" );
726+ EXPECT_EQ (components[1 ][" resolvedComponent" ][" id" ], " ARM::RteTest:CORE@0.1.1" );
727+ EXPECT_EQ (components[1 ][" options" ][" layer" ], " core.clayer.yml" );
728+ EXPECT_EQ (components[1 ][" options" ][" explicitVersion" ], " @>=0.1.0" );
729+ EXPECT_TRUE (components[1 ][" options" ][" explicitVendor" ]);
730+ }
670731
671732TEST_F (ProjMgrRpcTests, RpcSelectComponentMissing) {
672733 string context = " missing-component+CM0" ;
0 commit comments