Skip to content

Commit

Permalink
remove usage of Indices from test codes. Fixes #948
Browse files Browse the repository at this point in the history
  • Loading branch information
anidotnet committed May 7, 2024
1 parent 3808623 commit d20a92e
Show file tree
Hide file tree
Showing 25 changed files with 58 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -264,9 +263,7 @@ public void testNoUniqueAndTextIndex() {
@Data
@NoArgsConstructor
@AllArgsConstructor
@Indices({
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
})
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
public static class Receipt {
@Id
private String clientRef;
Expand All @@ -283,21 +280,17 @@ public enum Status {
public static class EmptyClass {
}

@Indices({
@Index(fields = "value", type = IndexType.FULL_TEXT),
@Index(fields = "value")
})
@Data
@NoArgsConstructor
@AllArgsConstructor
@Index(fields = "value", type = IndexType.FULL_TEXT)
@Index(fields = "value")
public static class EntityUniqueFullText {
private String value;
}

@Indices({
@Index(fields = "value", type = IndexType.FULL_TEXT),
@Index(fields = "value", type = IndexType.NON_UNIQUE)
})
@Index(fields = "value", type = IndexType.FULL_TEXT)
@Index(fields = "value", type = IndexType.NON_UNIQUE)
@Data
@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -113,11 +112,9 @@ public void testFindByEmbeddedField() {

@ToString
@EqualsAndHashCode
@Indices({
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE),
@Index(fields = "address", type = IndexType.FULL_TEXT),
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
})
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE)
@Index(fields = "address", type = IndexType.FULL_TEXT)
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
public static class EmployeeForCustomSeparator implements Serializable {
@Id
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.dizitart.no2.repository.Cursor;
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -173,9 +172,7 @@ public void testUniversalFullTextIndexing() {
}
}

@Indices(
@Index(fields = "text", type = IndexType.FULL_TEXT)
)
@Index(fields = "text", type = IndexType.FULL_TEXT)
public static class TextData {
public int id;
public String text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import lombok.ToString;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;

import java.io.Serializable;
import java.util.Date;
Expand All @@ -38,9 +37,7 @@
@Setter
@ToString
@EqualsAndHashCode
@Indices({
@Index(fields = "companyName")
})
@Index(fields = "companyName")
public class Company implements Serializable {
@Id(fieldName = "company_id")
@JsonProperty("company_id")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.dizitart.no2.common.SortOrder;
import org.dizitart.no2.common.concurrent.ThreadPoolManager;
import org.dizitart.no2.common.mapper.EntityConverter;
import org.dizitart.no2.common.mapper.SimpleNitriteMapper;
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.common.mapper.SimpleNitriteMapper;
import org.dizitart.no2.exceptions.NitriteIOException;
import org.dizitart.no2.exceptions.ValidationException;
import org.dizitart.no2.index.IndexOptions;
Expand All @@ -41,7 +41,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -674,9 +673,7 @@ public CompatChild fromDocument(Document document, NitriteMapper nitriteMapper)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Indices({
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
})
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
public static class Receipt {
@Id
private String clientRef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.*;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
Expand Down Expand Up @@ -371,11 +370,9 @@ public PerfTest fromDocument(Document document, NitriteMapper nitriteMapper) {
}
}

@Indices({
@Index(fields = "firstName", type = IndexType.NON_UNIQUE),
@Index(fields = "age", type = IndexType.NON_UNIQUE),
@Index(fields = "text", type = IndexType.FULL_TEXT),
})
@Index(fields = "firstName", type = IndexType.NON_UNIQUE)
@Index(fields = "age", type = IndexType.NON_UNIQUE)
@Index(fields = "text", type = IndexType.FULL_TEXT)
private static class PerfTestIndexed extends PerfTest {

public static class Converter implements EntityConverter<PerfTestIndexed> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.dizitart.no2.Nitrite;
import org.dizitart.no2.NitriteConfig;
import org.dizitart.no2.collection.Document;
import org.dizitart.no2.common.mapper.EntityConverter;
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.common.mapper.SimpleNitriteMapper;
import org.dizitart.no2.index.IndexType;
import org.dizitart.no2.integration.Retry;
import org.dizitart.no2.integration.repository.data.Company;
import org.dizitart.no2.integration.repository.data.Note;
import org.dizitart.no2.Nitrite;
import org.dizitart.no2.NitriteConfig;
import org.dizitart.no2.collection.Document;
import org.dizitart.no2.index.IndexType;
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.mvstore.MVStoreModule;
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -123,11 +122,9 @@ public void testFindByEmbeddedField() {

@ToString
@EqualsAndHashCode
@Indices({
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE),
@Index(fields = "address", type = IndexType.FULL_TEXT),
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
})
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE)
@Index(fields = "address", type = IndexType.FULL_TEXT)
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
public static class EmployeeForCustomSeparator implements Serializable {
@Id
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import org.dizitart.no2.repository.Cursor;
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -179,9 +178,7 @@ public void testUniversalFullTextIndexing() {
}
}

@Indices(
@Index(fields = "text", type = IndexType.FULL_TEXT)
)
@Index(fields = "text", type = IndexType.FULL_TEXT)
public static class TextData {
public Integer id;
public String text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;

import java.io.Serializable;
import java.util.Date;
Expand All @@ -37,9 +36,7 @@
*/
@Getter
@EqualsAndHashCode
@Indices({
@Index(fields = "companyName")
})
@Index(fields = "companyName")
public class Company implements Serializable {
@Id(fieldName = "company_id")
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import org.dizitart.no2.common.SortOrder;
import org.dizitart.no2.common.concurrent.ThreadPoolManager;
import org.dizitart.no2.common.mapper.EntityConverter;
import org.dizitart.no2.common.mapper.SimpleNitriteMapper;
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.common.mapper.SimpleNitriteMapper;
import org.dizitart.no2.exceptions.NitriteIOException;
import org.dizitart.no2.exceptions.ValidationException;
import org.dizitart.no2.index.IndexOptions;
Expand All @@ -40,7 +40,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Expand Down Expand Up @@ -477,9 +476,7 @@ public CompatChild fromDocument(Document document, NitriteMapper nitriteMapper)
@Data
@NoArgsConstructor
@AllArgsConstructor
@Indices({
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
})
@Index(fields = "synced", type = IndexType.NON_UNIQUE)
public static class Receipt {
@Id
private String clientRef;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.junit.*;
import uk.co.jemos.podam.api.PodamFactory;
import uk.co.jemos.podam.api.PodamFactoryImpl;
Expand Down Expand Up @@ -368,11 +367,9 @@ public PerfTest fromDocument(Document document, NitriteMapper nitriteMapper) {
}
}

@Indices({
@Index(fields = "firstName", type = IndexType.NON_UNIQUE),
@Index(fields = "age", type = IndexType.NON_UNIQUE),
@Index(fields = "text", type = IndexType.FULL_TEXT),
})
@Index(fields = "firstName", type = IndexType.NON_UNIQUE)
@Index(fields = "age", type = IndexType.NON_UNIQUE)
@Index(fields = "text", type = IndexType.FULL_TEXT)
private static class PerfTestIndexed extends PerfTest {
public static class Converter implements EntityConverter<PerfTestIndexed> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.dizitart.no2.rocksdb.RocksDBModule;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -122,11 +121,9 @@ public void testFindByEmbeddedField() {

@ToString
@EqualsAndHashCode
@Indices({
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE),
@Index(fields = "address", type = IndexType.FULL_TEXT),
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
})
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE)
@Index(fields = "address", type = IndexType.FULL_TEXT)
@Index(fields = "employeeNote:text", type = IndexType.FULL_TEXT)
public static class EmployeeForCustomSeparator implements Serializable {
@Id
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.dizitart.no2.repository.Cursor;
import org.dizitart.no2.repository.ObjectRepository;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.dizitart.no2.rocksdb.RocksDBModule;
import org.junit.After;
import org.junit.Before;
Expand Down Expand Up @@ -165,9 +164,7 @@ public void testUniversalFullTextIndexing() {
}
}

@Indices(
@Index(fields = "text", type = IndexType.FULL_TEXT)
)
@Index(fields = "text", type = IndexType.FULL_TEXT)
public static class TextData {
public Integer id;
public String text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;

import java.io.Serializable;
import java.util.Date;
Expand All @@ -37,9 +36,7 @@
*/
@Getter
@EqualsAndHashCode
@Indices({
@Index(fields = "companyName")
})
@Index(fields = "companyName")
public class Company implements Serializable {
@Id(fieldName = "company_id")
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;

import java.io.Serializable;
import java.util.Date;
Expand All @@ -33,9 +32,7 @@
* @author Anindya Chatterjee.
*/
@Data
@Indices({
@Index(fields = "companyName")
})
@Index(fields = "companyName")
public class Company implements Serializable {
@Id(fieldName = "company_id")
private Long companyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import lombok.ToString;
import org.dizitart.no2.collection.Document;
import org.dizitart.no2.common.mapper.EntityConverter;
import org.dizitart.no2.common.mapper.NitriteMapper;
import org.dizitart.no2.index.IndexType;
import org.dizitart.no2.repository.annotations.Id;
import org.dizitart.no2.repository.annotations.Index;
import org.dizitart.no2.repository.annotations.Indices;
import org.dizitart.no2.common.mapper.NitriteMapper;

import java.io.Serializable;
import java.util.Date;
Expand All @@ -36,11 +35,9 @@
*/
@ToString
@EqualsAndHashCode
@Indices({
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE),
@Index(fields = "address", type = IndexType.FULL_TEXT),
@Index(fields = "employeeNote.text", type = IndexType.FULL_TEXT)
})
@Index(fields = "joinDate", type = IndexType.NON_UNIQUE)
@Index(fields = "address", type = IndexType.FULL_TEXT)
@Index(fields = "employeeNote.text", type = IndexType.FULL_TEXT)
public class Employee implements Serializable {
@Id
@Getter
Expand Down
Loading

0 comments on commit d20a92e

Please sign in to comment.