@Test public void updateThrowsInvalidSecretFormatException() { exceptionRule.expect(InvalidSecretFormatException.class); exceptionRule.expectMessage( "Invalid encrypted secret format, must have at least one parameter"); EncryptedSecret encryptedSecret = new EncryptedSecret(); encryptedSecret.update("encrypted:s3"); }
protected void update(String secretConfig) { encryptedFile = isEncryptedFile(secretConfig); String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, must have at least one parameter"); } for (int i = 0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } }
EncryptedSecret { protected void update(String secretConfig) { encryptedFile = isEncryptedFile(secretConfig); String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, must have at least one parameter"); } for (int i = 0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } } }
EncryptedSecret { protected void update(String secretConfig) { encryptedFile = isEncryptedFile(secretConfig); String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, must have at least one parameter"); } for (int i = 0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } } EncryptedSecret(String secretConfig); }
EncryptedSecret { protected void update(String secretConfig) { encryptedFile = isEncryptedFile(secretConfig); String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, must have at least one parameter"); } for (int i = 0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } } EncryptedSecret(String secretConfig); static EncryptedSecret parse(String secretConfig); static boolean isEncryptedSecret(String secretConfig); static boolean isEncryptedFile(String secretConfig); }
EncryptedSecret { protected void update(String secretConfig) { encryptedFile = isEncryptedFile(secretConfig); String[] keyValues = secretConfig.split("!"); if (keyValues.length < 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, must have at least one parameter"); } for (int i = 0; i < keyValues.length; i++) { String[] keyV = keyValues[i].split(":", 2); if (keyV.length != 2) { throw new InvalidSecretFormatException( "Invalid encrypted secret format, keys and values must be delimited by ':'"); } if (i == 0) { this.engineIdentifier = keyV[1]; } else { this.params.put(keyV[0], keyV[1]); } } } EncryptedSecret(String secretConfig); static EncryptedSecret parse(String secretConfig); static boolean isEncryptedSecret(String secretConfig); static boolean isEncryptedFile(String secretConfig); static final String ENCRYPTED_STRING_PREFIX; static final String ENCRYPTED_FILE_PREFIX; }