Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

Commit

Permalink
Updated version to 2.2.4 for release (#525)
Browse files Browse the repository at this point in the history
* Updated version to 2.2.4 for release

* Added PageableEntities for concurrent test issues

* Added specific scoping

* More testing improvements

* Provided bean name

* Separated internal class to its own parent class

* Testing dynamicContainer bean registration

* Removed testing logs

* Added new Sorted Project repository

* Updated setup() to setUp() because of codacy
  • Loading branch information
kushagraThapar authored Apr 7, 2020
1 parent 477df0a commit 35e2e0d
Show file tree
Hide file tree
Showing 35 changed files with 334 additions and 138 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ If you are using Maven, add the following dependency.
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb</artifactId>
<version>2.2.3.FIX1</version>
<version>2.2.4</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb</artifactId>
<version>2.2.4-SNAPSHOT</version>
<version>2.2.4</version>

<name>Spring Data for Azure Cosmos DB SQL API</name>
<description>Spring Data for Azure Cosmos DB SQL API</description>
Expand Down
4 changes: 2 additions & 2 deletions samplecode/example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb-samples</artifactId>
<version>2.2.4-SNAPSHOT</version>
<version>2.2.4</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -20,7 +20,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb</artifactId>
<version>2.2.4-SNAPSHOT</version>
<version>2.2.4</version>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion samplecode/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>com.microsoft.azure</groupId>
<artifactId>spring-data-cosmosdb-samples</artifactId>
<version>2.2.4-SNAPSHOT</version>
<version>2.2.4</version>
<packaging>pom</packaging>

<parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/

package com.microsoft.azure.spring.data.cosmosdb.common;

public class DynamicContainer {
private String containerName;

public DynamicContainer(String containerName) {
this.containerName = containerName;
}

public String getContainerName() {
return this.containerName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public class CosmosTemplateIT {
private ResponseDiagnosticsTestUtils responseDiagnosticsTestUtils;

@Before
public void setup() throws ClassNotFoundException {
public void setUp() throws ClassNotFoundException {
if (!initialized) {
final CosmosDbFactory cosmosDbFactory = new CosmosDbFactory(dbConfig);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class CosmosTemplatePartitionIT {
private CosmosDBConfig dbConfig;

@Before
public void setup() throws ClassNotFoundException {
public void setUp() throws ClassNotFoundException {
if (!initialized) {
final CosmosDbFactory cosmosDbFactory = new CosmosDbFactory(dbConfig);
final CosmosMappingContext mappingContext = new CosmosMappingContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class MappingCosmosConverterUnitTest {
ApplicationContext applicationContext;

@Before
public void setup() {
public void setUp() {
final CosmosMappingContext mappingContext = new CosmosMappingContext();
final ObjectMapper objectMapper = new ObjectMapper();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/
package com.microsoft.azure.spring.data.cosmosdb.domain;

import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;

import java.util.Objects;

@Document()
@Data
@AllArgsConstructor
public class PageableAddress {
@Id
private String postalCode;
private String street;
@PartitionKey
private String city;

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
final PageableAddress address = (PageableAddress) o;
return Objects.equals(postalCode, address.postalCode) &&
Objects.equals(street, address.street) &&
Objects.equals(city, address.city);
}

@Override
public int hashCode() {
return Objects.hash(postalCode, street, city);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/
package com.microsoft.azure.spring.data.cosmosdb.domain;

import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document;
import lombok.AllArgsConstructor;
import lombok.Data;

import java.util.Date;

/**
* For testing date and enum purpose
*/
@Document()
@Data
@AllArgsConstructor
public class PageableMemo {
private String id;
private String message;
private Date date;
private Importance importance;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/

package com.microsoft.azure.spring.data.cosmosdb.domain;

import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Version;

import java.util.List;

@Document()
@Data
@EqualsAndHashCode(exclude = "_etag")
@NoArgsConstructor
@DocumentIndexingPolicy(includePaths = TestConstants.ORDER_BY_STRING_PATH)
public class PageablePerson {
private String id;
private String firstName;

@PartitionKey
private String lastName;
private List<String> hobbies;
private List<Address> shippingAddresses;
@Version
private String _etag;

public PageablePerson(String id, String firstName, String lastName,
List<String> hobbies, List<Address> shippingAddresses) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
this.hobbies = hobbies;
this.shippingAddresses = shippingAddresses;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for
* license information.
*/
package com.microsoft.azure.spring.data.cosmosdb.domain;

import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.Document;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.DocumentIndexingPolicy;
import com.microsoft.azure.spring.data.cosmosdb.core.mapping.PartitionKey;
import lombok.AllArgsConstructor;
import lombok.Data;
import org.springframework.data.annotation.Id;

@Document()
@Data
@AllArgsConstructor
@DocumentIndexingPolicy(includePaths = TestConstants.ORDER_BY_STRING_PATH)
public class SortedProject {

@Id
private String id;

private String name;

@PartitionKey
private String creator;

private Boolean hasReleased;

private Long starCount;

private Long forkCount;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(collection = "#{@dynamicCollectionContainer.getContainerName()}")
@Document(collection = "#{@dynamicContainer.getContainerName()}")
public class SpELBeanStudent {
private String id;
private String firstName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class PerformanceCompare {
private static PerformanceReport report = new PerformanceReport();

@Before
public void setup() throws CosmosClientException {
public void setUp() throws CosmosClientException {
if (!hasInit) {
DatabaseUtils.createDatabase(cosmosSyncClient, Constants.PERF_DATABASE_NAME);
DatabaseUtils.createContainer(cosmosSyncClient, Constants.PERF_DATABASE_NAME,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import com.azure.data.cosmos.ConsistencyLevel;
import com.azure.data.cosmos.internal.RequestOptions;
import com.microsoft.azure.spring.data.cosmosdb.common.DynamicContainer;
import com.microsoft.azure.spring.data.cosmosdb.common.ResponseDiagnosticsTestUtils;
import com.microsoft.azure.spring.data.cosmosdb.common.TestConstants;
import com.microsoft.azure.spring.data.cosmosdb.config.AbstractCosmosConfiguration;
Expand Down Expand Up @@ -72,19 +73,7 @@ public CosmosDBConfig getConfig() {
}

@Bean
public DynamicCollectionContainer dynamicCollectionContainer() {
return new DynamicCollectionContainer("spel-bean-collection");
}

public class DynamicCollectionContainer {
private String containerName;

public DynamicCollectionContainer(String containerName) {
this.containerName = containerName;
}

public String getContainerName() {
return this.containerName;
}
public DynamicContainer dynamicContainer() {
return new DynamicContainer(TestConstants.DYNAMIC_BEAN_COLLECTION_NAME);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class AddressRepositoryIT {
public ExpectedException expectedException = ExpectedException.none();

@Before
public void setup() {
public void setUp() {
if (!isSetupDone) {
staticTemplate = template;
template.createContainerIfNotExists(entityInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ContactRepositoryIT {
private CosmosTemplate template;

@Before
public void setup() {
public void setUp() {
if (!isSetupDone) {
staticTemplate = template;
template.createContainerIfNotExists(entityInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class CustomerRepositoryIT {
private CosmosTemplate template;

@Before
public void setup() {
public void setUp() {
if (!isSetupDone) {
staticTemplate = template;
template.createContainerIfNotExists(entityInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class IntegerIdDomainRepositoryIT {
private IntegerIdDomainRepository repository;

@Before
public void setup() {
public void setUp() {
if (!isSetupDone) {
staticTemplate = template;
template.createContainerIfNotExists(entityInformation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void init() throws ParseException {
}

@Before
public void setup() {
public void setUp() {
if (!isSetupDone) {
staticTemplate = template;
template.createContainerIfNotExists(entityInformation);
Expand Down
Loading

0 comments on commit 35e2e0d

Please sign in to comment.