Skip to content

Commit

Permalink
fix(cloudfoundry): add equals and hash code to managed account (#5246)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Cohen <ncknt@users.noreply.github.com>
Co-authored-by: Cameron Motevasselani <cmotevasselani@gmail.com>
  • Loading branch information
3 people committed Feb 15, 2021
1 parent 27b8209 commit c7e8b15
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/integration_tests.yml
Expand Up @@ -8,6 +8,8 @@ on:

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g
TESTCONTAINERS_RYUK_DISABLED: true
TESTCONTAINERS_CHECKS_DISABLE: true

jobs:
it-test:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr.yml
Expand Up @@ -4,6 +4,8 @@ on: [ pull_request ]

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx6g -Xms6g
TESTCONTAINERS_RYUK_DISABLED: true
TESTCONTAINERS_CHECKS_DISABLE: true

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -59,6 +59,7 @@ subprojects {

dependencies {
implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")
testImplementation platform("org.testcontainers:testcontainers-bom:1.15.1")

annotationProcessor platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")
annotationProcessor "org.projectlombok:lombok"
Expand Down
Expand Up @@ -20,10 +20,7 @@
import com.netflix.spinnaker.fiat.model.resources.Permissions;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
Expand Down Expand Up @@ -55,6 +52,7 @@ public void destroy() {
@Getter
@Setter
@ToString(exclude = "password")
@EqualsAndHashCode
public static class ManagedAccount implements CredentialsDefinition {
private String name;
private String api;
Expand Down
@@ -0,0 +1,42 @@
/*
* Copyright 2021 Armory, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.spinnaker.clouddriver.cloudfoundry.config;

import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

class CloudFoundryConfigurationPropertiesTest {

@Test
public void shouldCompareManagedAccountsWithEquals() {
CloudFoundryConfigurationProperties.ManagedAccount managedAccount =
new CloudFoundryConfigurationProperties.ManagedAccount();
managedAccount.setName("account1");
managedAccount.setApi("api.com");
managedAccount.setPassword("password");

CloudFoundryConfigurationProperties.ManagedAccount sameAccount =
new CloudFoundryConfigurationProperties.ManagedAccount();
sameAccount.setName("account1");
sameAccount.setApi("api.com");
sameAccount.setPassword("password");

assertTrue(managedAccount.equals(sameAccount));
}
}
Expand Up @@ -15,6 +15,7 @@
*/
package com.netflix.spinnaker.clouddriver.sql.event

import com.fasterxml.jackson.annotation.JsonTypeName
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.kotlin.KotlinModule
Expand All @@ -30,7 +31,6 @@ import dev.minutest.rootContext
import io.mockk.every
import io.mockk.mockk
import org.springframework.context.ApplicationEventPublisher
import org.testcontainers.shaded.com.fasterxml.jackson.annotation.JsonTypeName
import strikt.api.expect
import strikt.api.expectThat
import strikt.api.expectThrows
Expand Down

0 comments on commit c7e8b15

Please sign in to comment.