Skip to content

Commit

Permalink
Merge branch 'axon-multitenancy-4.9.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
smcvb committed Nov 8, 2023
2 parents 7ef046e + 4791c1a commit 8384d6a
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ updates:
- "gklijs"
- "schananas"
- "smcvb"
milestone: 9
milestone: 10
- package-ecosystem: maven
directory: "/"
schedule:
Expand All @@ -27,4 +27,4 @@ updates:
- "gklijs"
- "schananas"
- "smcvb"
milestone: 9
milestone: 10
2 changes: 1 addition & 1 deletion coverage-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>axon-multitenancy-parent</artifactId>
<groupId>org.axonframework.extensions.multitenancy</groupId>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>
</parent>

<artifactId>axon-coverage-report</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion multitenancy-spring-boot-3-integrationtests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<description>
Module used to test the integration with Spring Boot 3
</description>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>

<packaging>jar</packaging>

Expand Down
2 changes: 1 addition & 1 deletion multitenancy-spring-boot-autoconfigure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>axon-multitenancy-parent</artifactId>
<groupId>org.axonframework.extensions.multitenancy</groupId>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>
</parent>

<artifactId>axon-multitenancy-spring-boot-autoconfigure</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion multitenancy-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<groupId>org.axonframework.extensions.multitenancy</groupId>
<artifactId>axon-multitenancy-spring-boot-starter</artifactId>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>

<name>Spring Boot Starter module for Axon Framework Multi-Tenancy Extension</name>
<description>Spring Boot Starter module for the Multi-Tenancy Extension of Axon Framework</description>
Expand Down
2 changes: 1 addition & 1 deletion multitenancy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>axon-multitenancy-parent</artifactId>
<groupId>org.axonframework.extensions.multitenancy</groupId>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>
</parent>

<artifactId>axon-multitenancy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ public boolean equals(Object o) {
return false;
}
TenantDescriptor that = (TenantDescriptor) o;
return Objects.equals(tenantId, that.tenantId) && Objects.equals(properties, that.properties);
return Objects.equals(tenantId, that.tenantId);
}

@Override
public int hashCode() {
return Objects.hash(tenantId, properties);
return Objects.hash(tenantId);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* Copyright (c) 2010-2023. Axon Framework
*
* 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 org.axonframework.extensions.multitenancy.components;

import org.junit.jupiter.api.*;

import java.util.HashMap;

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

/**
* Test class validating the {@link TenantDescriptor}.
*
* @author Steven van Beelen
*/
class TenantDescriptorTest {

private static final String TENANT_ID_ONE = "me";
private static final String TENANT_ID_TWO = "you";

private HashMap<String, String> testPropertiesOne;
private HashMap<String, String> testPropertiesTwo;

private final TenantDescriptor testSubjectOne = TenantDescriptor.tenantWithId(TENANT_ID_ONE);
private final TenantDescriptor testSubjectTwo = TenantDescriptor.tenantWithId(TENANT_ID_TWO);
private final TenantDescriptor testSubjectThree = new TenantDescriptor(TENANT_ID_ONE, testPropertiesOne);
private final TenantDescriptor testSubjectFour = new TenantDescriptor(TENANT_ID_TWO, testPropertiesTwo);
private final TenantDescriptor testSubjectFive = new TenantDescriptor(TENANT_ID_ONE, testPropertiesTwo);

@BeforeEach
void setUp() {
testPropertiesOne = new HashMap<>();
testPropertiesOne.put("key", "value");
testPropertiesOne.put("key1", "value2");
testPropertiesTwo = new HashMap<>();
testPropertiesOne.put("value", "key");
testPropertiesOne.put("value2", "key1");
}

@Test
void equalsOnlyValidatesTenantId() {
// Validate test subject one, only matching on tenant id
assertNotEquals(testSubjectOne, testSubjectTwo);
assertEquals(testSubjectOne, testSubjectThree);
assertNotEquals(testSubjectOne, testSubjectFour);
assertEquals(testSubjectOne, testSubjectFive);
// Validate test subject two, only matching on tenant id
assertNotEquals(testSubjectTwo, testSubjectThree);
assertEquals(testSubjectTwo, testSubjectFour);
assertNotEquals(testSubjectTwo, testSubjectFive);
// Validate test subject three, only matching on tenant id
assertNotEquals(testSubjectThree, testSubjectFour);
assertEquals(testSubjectThree, testSubjectFive);
// Validate test subject four, only matching on tenant id
assertNotEquals(testSubjectFour, testSubjectFive);
}

@Test
void hashOnlyHashesTenantId() {
// Validate test subject one, only matching on tenant id
assertNotEquals(testSubjectOne.hashCode(), testSubjectTwo.hashCode());
assertEquals(testSubjectOne.hashCode(), testSubjectThree.hashCode());
assertNotEquals(testSubjectOne.hashCode(), testSubjectFour.hashCode());
assertEquals(testSubjectOne.hashCode(), testSubjectFive.hashCode());
// Validate test subject two, only matching on tenant id
assertNotEquals(testSubjectTwo.hashCode(), testSubjectThree.hashCode());
assertEquals(testSubjectTwo.hashCode(), testSubjectFour.hashCode());
assertNotEquals(testSubjectTwo.hashCode(), testSubjectFive.hashCode());
// Validate test subject three, only matching on tenant id
assertNotEquals(testSubjectThree.hashCode(), testSubjectFour.hashCode());
assertEquals(testSubjectThree.hashCode(), testSubjectFive.hashCode());
// Validate test subject four, only matching on tenant id
assertNotEquals(testSubjectFour.hashCode(), testSubjectFive.hashCode());
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<groupId>org.axonframework.extensions.multitenancy</groupId>
<artifactId>axon-multitenancy-parent</artifactId>
<version>4.9.1-SNAPSHOT</version>
<version>4.9.2-SNAPSHOT</version>
<modules>
<module>multitenancy</module>
<module>multitenancy-spring-boot-autoconfigure</module>
Expand Down

0 comments on commit 8384d6a

Please sign in to comment.