44import com .uid2 .shared .secure .TestClock ;
55import org .junit .jupiter .api .Disabled ;
66import org .junit .jupiter .params .ParameterizedTest ;
7- import org .junit .jupiter .params .provider .ValueSource ;
7+ import org .junit .jupiter .params .provider .Arguments ;
8+ import org .junit .jupiter .params .provider .MethodSource ;
9+
10+ import java .util .stream .Stream ;
811
912import static com .uid2 .shared .secure .TestUtils .loadFromJson ;
1013import static com .uid2 .shared .secure .azurecc .MaaTokenUtils .validateAndParseToken ;
1114import static org .junit .jupiter .api .Assertions .assertEquals ;
1215
1316public class MaaTokenSignatureValidatorTest {
1417 @ ParameterizedTest
15- @ ValueSource ( strings = { "/com.uid2.shared/test/secure/azurecc/jwt_payload_aci.json" , "/com.uid2.shared/test/secure/azurecc/jwt_payload_aks.json" } )
16- public void testPayload (String payloadPath ) throws Exception {
18+ @ MethodSource ( "argumentProvider" )
19+ public void testPayload (String payloadPath , String protocol ) throws Exception {
1720 // expire at 1695313895
1821 var payload = loadFromJson (payloadPath );
1922 var clock = new TestClock ();
@@ -23,7 +26,7 @@ public void testPayload(String payloadPath) throws Exception {
2326 var expectedLocation = "East US" ;
2427 var expectedPublicKey = "abc" ;
2528
26- var tokenPayload = validateAndParseToken (payload , clock , "azure-cc" );
29+ var tokenPayload = validateAndParseToken (payload , clock , protocol );
2730 assertEquals (true , tokenPayload .isSevSnpVM ());
2831 assertEquals (true , tokenPayload .isUtilityVMCompliant ());
2932 assertEquals (false , tokenPayload .isVmDebuggable ());
@@ -40,4 +43,11 @@ public void testE2E() throws AttestationException {
4043 var validator = new MaaTokenSignatureValidator (maaServerUrl );
4144 var token = validator .validate (maaToken , "azure-cc" );
4245 }
46+
47+ static Stream <Arguments > argumentProvider () {
48+ return Stream .of (
49+ Arguments .of ("/com.uid2.shared/test/secure/azurecc/jwt_payload_aci.json" , "azure-cc" ),
50+ Arguments .of ("/com.uid2.shared/test/secure/azurecc/jwt_payload_aks.json" , "azure-cc-aks" )
51+ );
52+ }
4353}
0 commit comments