ELB extends Resource { boolean httpsCertChanged() { Optional<ListenerDescription> remoteHTTPSListener = findRemoteHTTPSListener(); if (!listenHTTPS || !remoteHTTPSListener.isPresent()) return false; String remoteCertARN = remoteHTTPSListener.get().getListener().getSSLCertificateId(); if (cert != null) { if (cert.status == ResourceStatus.LOCAL_ONLY || !cert.remoteCert.getServerCertificateMetadata().getArn().equals(remoteCertARN)) return true; return cert.changed(); } else { return !remoteCertARN.equals(amazonCertARN); } } ELB(String id); @Override void validate(Resources resources); public LoadBalancerDescription remoteELB; public String name; public boolean listenHTTP; public boolean listenHTTPS; public ServerCert cert; public String healthCheckURL; public SecurityGroup securityGroup; public Subnet subnet; public Bucket accessLogBucket; public Optional<String> scheme; public String amazonCertARN; }
@Test void httpsCertChangedWithNewLocalCert() { elb.listenHTTPS = true; elb.remoteELB = new LoadBalancerDescription() .withListenerDescriptions(new ListenerDescription().withListener(new Listener("HTTPS", 443, 80))); elb.cert = new ServerCert("cert"); elb.cert.foundInLocal(); assertTrue(elb.httpsCertChanged()); }