Cleanup unused variables

This commit is contained in:
Ignasi Barrera 2018-05-04 09:27:39 +02:00
parent 7c5927038a
commit 6a10544b16
No known key found for this signature in database
GPG Key ID: 3D5414A0D959B94F
3 changed files with 6 additions and 26 deletions

View File

@ -330,7 +330,6 @@ public class AzurePredicatesModule extends AbstractModule {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
boolean present = false;
List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults(); List<Vault.DeletedVault> vaults = api.getVaultApi(resourceGroup).listDeletedVaults();
return shouldBePresent == Iterables.any(vaults, new Predicate<Vault.DeletedVault>() { return shouldBePresent == Iterables.any(vaults, new Predicate<Vault.DeletedVault>() {
@Override public boolean apply(Vault.DeletedVault input) { @Override public boolean apply(Vault.DeletedVault input) {
@ -380,7 +379,6 @@ public class AzurePredicatesModule extends AbstractModule {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
boolean present = false;
DeletedKeyBundle key = api.getVaultApi(resourceGroup).getDeletedKey(vaultUri, name); DeletedKeyBundle key = api.getVaultApi(resourceGroup).getDeletedKey(vaultUri, name);
return shouldBePresent == (key != null); return shouldBePresent == (key != null);
} }
@ -408,7 +406,6 @@ public class AzurePredicatesModule extends AbstractModule {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
boolean result = false;
KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name); KeyBundle key = api.getVaultApi(resourceGroup).getKey(vaultUri, name);
return key != null ? (isRecovered ? true : key.attributes().recoveryLevel().contains("Recoverable")) : false; return key != null ? (isRecovered ? true : key.attributes().recoveryLevel().contains("Recoverable")) : false;
} }
@ -453,7 +450,6 @@ public class AzurePredicatesModule extends AbstractModule {
return retry(new Predicate<String>() { return retry(new Predicate<String>() {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
boolean present = false;
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
DeletedSecretBundle secret = api.getVaultApi(resourceGroup).getDeletedSecret(vaultUri, name); DeletedSecretBundle secret = api.getVaultApi(resourceGroup).getDeletedSecret(vaultUri, name);
return shouldBePresent == (secret != null); return shouldBePresent == (secret != null);
@ -534,7 +530,6 @@ public class AzurePredicatesModule extends AbstractModule {
return retry(new Predicate<String>() { return retry(new Predicate<String>() {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
boolean present = false;
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
DeletedCertificateBundle cert = api.getVaultApi(resourceGroup).getDeletedCertificate(vaultUri, name); DeletedCertificateBundle cert = api.getVaultApi(resourceGroup).getDeletedCertificate(vaultUri, name);
return shouldBePresent == (cert != null); return shouldBePresent == (cert != null);
@ -591,7 +586,6 @@ public class AzurePredicatesModule extends AbstractModule {
@Override @Override
public boolean apply(final String name) { public boolean apply(final String name) {
checkNotNull(name, "name cannot be null"); checkNotNull(name, "name cannot be null");
boolean result = false;
CertificateOperation certOp = api.getVaultApi(resourceGroup).getCertificateOperation(vaultUri, name); CertificateOperation certOp = api.getVaultApi(resourceGroup).getCertificateOperation(vaultUri, name);
return isCreate ? ((certOp != null) ? !certOp.status().equals("inProgress") : false) : (certOp == null); return isCreate ? ((certOp != null) ? !certOp.status().equals("inProgress") : false) : (certOp == null);
} }

View File

@ -318,17 +318,6 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = "testUpdateKey") @Test(dependsOnMethods = "testUpdateKey")
public void testListKeyVersions() { public void testListKeyVersions() {
// Create a second version of the key
KeyAttributes keyAttr = KeyAttributes.create(true, null, null, null, null, null);
KeyBundle keyBundle = api().createKey(vaultUri,
KEY_NAME,
keyAttr,
null,
null,
3072,
"RSA",
null);
// List key versions // List key versions
List<Key> keys = api().getKeyVersions(vaultUri, KEY_NAME); List<Key> keys = api().getKeyVersions(vaultUri, KEY_NAME);
assertNotNull(keys); assertNotNull(keys);
@ -427,7 +416,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = {"testDeleteRecoverableKey", "testGetDeletedKey"}) @Test(dependsOnMethods = {"testDeleteRecoverableKey", "testGetDeletedKey"})
public void testRecoverDeletedKey() { public void testRecoverDeletedKey() {
KeyBundle key = api().recoverDeletedKey(vaultUri, RECOVERABLE_KEY_NAME); api().recoverDeletedKey(vaultUri, RECOVERABLE_KEY_NAME);
checkState(recoverableKeyStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_KEY_NAME), checkState(recoverableKeyStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_KEY_NAME),
"key was not recovered before timeout"); "key was not recovered before timeout");
} }
@ -435,7 +424,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = "testRecoverDeletedKey") @Test(dependsOnMethods = "testRecoverDeletedKey")
public void testPurgeDeletedKey() { public void testPurgeDeletedKey() {
// delete the key // delete the key
DeletedKeyBundle dkb = api().deleteKey(vaultUri, RECOVERABLE_KEY_NAME); api().deleteKey(vaultUri, RECOVERABLE_KEY_NAME);
checkState(deletedKeyStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_KEY_NAME), checkState(deletedKeyStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_KEY_NAME),
"key was not deleted before timeout"); "key was not deleted before timeout");
@ -559,7 +548,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
public void testListSecretVersions() { public void testListSecretVersions() {
// Create a second version of the secret // Create a second version of the secret
SecretAttributes attributes = SecretAttributes.create(true, null, null, null, null, null); SecretAttributes attributes = SecretAttributes.create(true, null, null, null, null, null);
SecretBundle secretBundle = api().setSecret(vaultUri, api().setSecret(vaultUri,
SECRET_NAME, SECRET_NAME,
attributes, attributes,
"aNewSecretKey", "aNewSecretKey",
@ -684,7 +673,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = {"testDeleteRecoverableSecret", "testGetDeletedSecret"}) @Test(dependsOnMethods = {"testDeleteRecoverableSecret", "testGetDeletedSecret"})
public void testRecoverDeletedSecret() { public void testRecoverDeletedSecret() {
SecretBundle secret = api().recoverDeletedSecret(vaultUri, RECOVERABLE_SECRET_NAME); api().recoverDeletedSecret(vaultUri, RECOVERABLE_SECRET_NAME);
checkState(recoverableSecretStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_SECRET_NAME), checkState(recoverableSecretStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_SECRET_NAME),
"secret was not created before timeout"); "secret was not created before timeout");
} }
@ -692,7 +681,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = "testRecoverDeletedSecret") @Test(dependsOnMethods = "testRecoverDeletedSecret")
public void testPurgeDeletedSecret() { public void testPurgeDeletedSecret() {
// delete the secret // delete the secret
DeletedSecretBundle dsb = api().deleteSecret(vaultUri, RECOVERABLE_SECRET_NAME); api().deleteSecret(vaultUri, RECOVERABLE_SECRET_NAME);
checkState(deletedSecretStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_SECRET_NAME), checkState(deletedSecretStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_SECRET_NAME),
"secret was not deleted before timeout"); "secret was not deleted before timeout");
@ -1041,7 +1030,7 @@ public class VaultApiLiveTest extends BaseAzureComputeApiLiveTest {
@Test(dependsOnMethods = "testRecoverDeletedCertificate") @Test(dependsOnMethods = "testRecoverDeletedCertificate")
public void testPurgeDeletedCertificate() { public void testPurgeDeletedCertificate() {
// delete the certificate // delete the certificate
DeletedCertificateBundle dcb = api().deleteCertificate(vaultUri, RECOVERABLE_CERTIFICATE_NAME); api().deleteCertificate(vaultUri, RECOVERABLE_CERTIFICATE_NAME);
checkState(deletedCertificateStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_CERTIFICATE_NAME), checkState(deletedCertificateStatus.create(resourceGroupName, vaultUri, true).apply(RECOVERABLE_CERTIFICATE_NAME),
"certificate was not deleted before timeout"); "certificate was not deleted before timeout");

View File

@ -84,15 +84,12 @@ public class VaultApiMockTest extends BaseAzureComputeApiMockTest {
private URI vaultUri; private URI vaultUri;
private static String KEY_NAME = "myKey"; private static String KEY_NAME = "myKey";
private static String TEMP_KEY_NAME = "myTempKey";
private static String IMPORT_KEY_NAME = "myImportKey"; private static String IMPORT_KEY_NAME = "myImportKey";
private static String RECOVERABLE_KEY_NAME = "myRecoverableKey"; private static String RECOVERABLE_KEY_NAME = "myRecoverableKey";
private static String SECRET_NAME = "mySecret"; private static String SECRET_NAME = "mySecret";
private static String RECOVERABLE_SECRET_NAME = "myRecoverableSecret"; private static String RECOVERABLE_SECRET_NAME = "myRecoverableSecret";
private static String CERTIFICATE_NAME = "myCertificate"; private static String CERTIFICATE_NAME = "myCertificate";
private static String TEMP_CERTIFICATE_NAME = "myTempCertificate";
private static String RECOVERABLE_CERTIFICATE_NAME = "myRecoverableCertificate"; private static String RECOVERABLE_CERTIFICATE_NAME = "myRecoverableCertificate";
private static String IMPORTABLE_CERTIFICATE_NAME = "myImportableCertificate";
private static String CERTIFICATE_ISSUER_NAME = "globalsign01"; private static String CERTIFICATE_ISSUER_NAME = "globalsign01";
private String IMPORTABLE_CERTIFICATE_PEM = stringFromResource("/vaultimportablecert.txt"); private String IMPORTABLE_CERTIFICATE_PEM = stringFromResource("/vaultimportablecert.txt");
private String sampleSecret = stringFromResource("/vaultsamplesecret.txt"); private String sampleSecret = stringFromResource("/vaultsamplesecret.txt");