4141
4242/**
4343 * Forced order is used here to allow better error reporting
44- * but to let all the tests run and make sure
44+ * but to let all the tests run and make sure
4545 */
4646@ Tag ("integration" )
4747@ TestMethodOrder (OrderAnnotation .class )
4848@ TestInstance (Lifecycle .PER_CLASS )
4949public class ApiKeyControllerTestIT extends DataApiTestIT {
5050
51-
51+
5252 private final String KEY_NAME = "TestKey1" ;
5353 private final String EXPIRED_KEY_NAME = "TestKey2-Expired" ;
5454
@@ -76,7 +76,7 @@ void test_api_key_creation_no_expiration(String authType, TestAccounts.KeyUser t
7676 .statusCode (is (HttpCode .CREATED .getStatus ()))
7777 .body ("user-id" ,is (key .getUserId ().toUpperCase ()))
7878 .body ("key-name" ,is (key .getKeyName ()))
79- .body ("api-key.size()" ,is (256 ))
79+ .body ("api-key.size()" ,is (AuthDao . API_KEY_TOTAL_LENGTH ))
8080 .body ("created" ,not (equalTo (null )))
8181 .body ("expires" ,is (equalTo (null )))
8282 .extract ().as (ApiKey .class );
@@ -90,8 +90,8 @@ void test_api_key_creation_no_expiration(String authType, TestAccounts.KeyUser t
9090 @ AuthType (user = TestAccounts .KeyUser .SPK_NORMAL )
9191 void test_api_key_creation_with_expiration (String authType , TestAccounts .KeyUser theUser , RequestSpecification authSpec ) {
9292 final String keyName = "TestKey1-Expires" ;
93-
94-
93+
94+
9595 final ApiKey key = new ApiKey (theUser .getName (),keyName ,null ,null ,ZonedDateTime .now ());
9696 final ApiKey expiredKey = new ApiKey (key .getUserId (),EXPIRED_KEY_NAME ,null ,null ,ZonedDateTime .now ().minusMinutes (1L ));
9797
@@ -108,7 +108,7 @@ void test_api_key_creation_with_expiration(String authType, TestAccounts.KeyUser
108108 .statusCode (is (HttpCode .CREATED .getStatus ()))
109109 .body ("user-id" ,is (key .getUserId ().toUpperCase ()))
110110 .body ("key-name" ,is (key .getKeyName ()))
111- .body ("api-key.size()" ,is (256 ))
111+ .body ("api-key.size()" ,is (AuthDao . API_KEY_TOTAL_LENGTH ))
112112 .body ("created" ,not (equalTo (null )))
113113 .body ("expires" ,not (equalTo (null )))
114114 .extract ().as (ApiKey .class );
@@ -127,15 +127,15 @@ void test_api_key_creation_with_expiration(String authType, TestAccounts.KeyUser
127127 .statusCode (is (HttpCode .CREATED .getStatus ()))
128128 .body ("user-id" ,is (expiredKey .getUserId ().toUpperCase ()))
129129 .body ("key-name" ,is (expiredKey .getKeyName ()))
130- .body ("api-key.size()" ,is (256 ))
130+ .body ("api-key.size()" ,is (AuthDao . API_KEY_TOTAL_LENGTH ))
131131 .body ("created" ,not (equalTo (null )))
132132 .body ("expires" ,not (equalTo (null )))
133133 .extract ().as (ApiKey .class );
134134 realKeys .add (returnedKey );
135135
136136
137137 final String bodyWithSpecificExpiresFormat = "{\" user-id\" : \" " + theUser .getName () + "\" ,\" key-name\" : \" foo\" ,\" api-key\" : \" string\" ,\" expires\" : \" 2023-09-23T14:20:00.908Z\" }" ;
138- returnedKey =
138+ returnedKey =
139139 given ()
140140 .log ().ifValidationFails (LogDetail .ALL ,true )
141141 .spec (authSpec )
@@ -148,7 +148,7 @@ void test_api_key_creation_with_expiration(String authType, TestAccounts.KeyUser
148148 .statusCode (is (HttpCode .CREATED .getStatus ()))
149149 .body ("user-id" ,is (expiredKey .getUserId ().toUpperCase ()))
150150 .body ("key-name" ,is ("foo" ))
151- .body ("api-key.size()" ,is (256 ))
151+ .body ("api-key.size()" ,is (AuthDao . API_KEY_TOTAL_LENGTH ))
152152 .body ("created" ,not (equalTo (null )))
153153 .body ("expires" ,not (equalTo (null )))
154154 .extract ().as (ApiKey .class );
@@ -184,7 +184,7 @@ void test_api_key_creation_not_other_user(String authType, TestAccounts.KeyUser
184184 @ ArgumentsSource (UserSpecSource .class )
185185 @ AuthType (user = TestAccounts .KeyUser .SPK_NORMAL )
186186 void test_api_key_listing (String authType , TestAccounts .KeyUser theUser , RequestSpecification authSpec ) {
187- List <ApiKey > keys =
187+ List <ApiKey > keys =
188188 given ()
189189 .log ().ifValidationFails (LogDetail .ALL ,true )
190190 .spec (authSpec )
@@ -215,12 +215,12 @@ void test_api_key_listing(String authType, TestAccounts.KeyUser theUser, Request
215215 .statusCode (HttpCode .OK .getStatus ());
216216 }
217217
218-
218+
219219 // use api key
220220 @ Test
221221 @ Order (5 )
222222 public void test_key_usage () throws Exception {
223-
223+
224224 createLocation ("ApiKey-Test Location" ,true ,"SPK" );
225225 String json = loadResourceAsString ("cwms/cda/api/location_create_spk.json" );
226226 Location location = new Location .Builder (Formats .parseContent (Formats .parseHeader (Formats .JSON , Location .class ),
@@ -394,7 +394,7 @@ private void assertContainsKey(ApiKey expectedKey, List<ApiKey> returnedSet) {
394394 ZonedDateTime expectedExpires = expected .getExpires ();
395395 if (expectedKeyExpires == null && expectedExpires == null ) {
396396 return ;
397- } else if ((expectedKeyExpires != null && expectedExpires != null )
397+ } else if ((expectedKeyExpires != null && expectedExpires != null )
398398 && expectedExpires .isEqual (expectedKeyExpires )) {
399399 return ;
400400 }
0 commit comments