aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-plugins/settings-encryption-plugin/src/main/java/EncryptionVerifier.java
blob: c3ea7361c6459aabe5d46685256025ee2956e315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import org.sonar.api.BatchExtension;
import org.sonar.api.batch.InstantiationStrategy;
import org.sonar.api.config.Settings;

@InstantiationStrategy(InstantiationStrategy.PER_BATCH)
public class EncryptionVerifier implements BatchExtension {
  private Settings settings;

  public EncryptionVerifier(Settings settings) {
    this.settings = settings;
  }

  public void start() {
    System.out.println("Start EncryptionVerifier");

    String decryptedValue = settings.getString("encryptedProperty");
    if (!"this is a secret".equals(decryptedValue)) {
      throw new IllegalStateException("The property 'encryptedProperty' can not be decrypted");
    }
  }
}