Skip to content

Commit cd4ee5b

Browse files
Merge pull request #30 from quantori/bug-fix/change-library-type-case
change library type to lower case
2 parents 2791a04 + ae394bd commit cd4ee5b

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

cqp-api/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ plugins {
66

77
group = "com.quantori"
88
description = "Chem query platform. Storage API"
9-
version = "0.0.13"
9+
version = "0.0.14"
1010

1111
dependencies {
1212
implementation("commons-codec:commons-codec:1.15")
13-
implementation("com.quantori:cqp-core:0.0.10")
13+
implementation("com.quantori:cqp-core:0.0.13")
1414

1515
implementation(libs.javax.validation)
1616
implementation(libs.bundles.indigo)

cqp-api/src/main/java/com/quantori/cqp/api/model/LibraryType.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ public enum LibraryType {
77
/**
88
* Molecules structure library.
99
*/
10-
MOLECULES,
10+
molecules,
1111
/**
1212
* Reactions structures library.
1313
*/
14-
REACTIONS,
14+
reactions,
1515
/**
1616
* Metrics libraries (for internal usage).
1717
*/
18-
METRICS,
18+
metrics,
1919
/**
2020
* Library with arbitrary data.
2121
*/
22-
ANY
22+
any
2323
}

cqp-api/src/test/java/com/quantori/cqp/api/service/StorageLibraryTest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ class StorageLibraryTest {
5050
@Mock
5151
private ItemWriter<Molecule> itemWriter;
5252

53-
private final String LIBRARY_ID = UUID.randomUUID().toString();
53+
private static final String LIBRARY_ID = UUID.randomUUID().toString();
5454

5555
@ParameterizedTest
56-
@EnumSource(value = LibraryType.class, names = {"MOLECULES", "REACTIONS"})
56+
@EnumSource(value = LibraryType.class, names = {"molecules", "reactions"})
5757
void testCreateLibrary(LibraryType libraryType) {
5858
Instant now = Instant.now().truncatedTo(ChronoUnit.MICROS);
5959
String libraryName = "test_create_library_" + libraryType;
@@ -85,12 +85,12 @@ void testCreateLibrary_withPropertiesMapping() {
8585
library.setUpdatedStamp(now.plusSeconds(1));
8686
library.setId(LIBRARY_ID);
8787

88-
when(storageLibrary.createLibrary(anyString(), eq(LibraryType.MOLECULES), eq(propertiesMapping), any()))
88+
when(storageLibrary.createLibrary(anyString(), eq(LibraryType.molecules), eq(propertiesMapping), any()))
8989
.thenReturn(library);
9090
when(storageLibrary.getPropertiesMapping(LIBRARY_ID)).thenReturn(propertiesMapping);
9191

9292
Library result = storageLibrary.createLibrary("test_create_library_properties_mapping",
93-
LibraryType.MOLECULES, propertiesMapping, null);
93+
LibraryType.molecules, propertiesMapping, null);
9494

9595
assertEquals("test_create_library_properties_mapping", result.getName());
9696
assertEquals(result.getCreatedStamp(), result.getUpdatedStamp());
@@ -128,7 +128,7 @@ void testCreateLibrary_addExistingPropertyMapping() {
128128
doThrow(new StorageException("A library %s already contains the following properties test1".formatted(LIBRARY_ID)))
129129
.when(storageLibrary).addPropertiesMapping(eq(LIBRARY_ID), eq(duplicate));
130130

131-
Library result = storageLibrary.createLibrary("lib", LibraryType.MOLECULES, initial, null);
131+
Library result = storageLibrary.createLibrary("lib", LibraryType.molecules, initial, null);
132132

133133
Exception exception = assertThrows(StorageException.class, () ->
134134
storageLibrary.addPropertiesMapping(result.getId(), duplicate)
@@ -151,7 +151,7 @@ void testCreateLibrary_updatePropertyMapping() {
151151
Map.of("test1", new Property("new test 1", Property.PropertyType.STRING, 1, true, false))
152152
);
153153

154-
Library result = storageLibrary.createLibrary("lib", LibraryType.MOLECULES, Map.of(), null);
154+
Library result = storageLibrary.createLibrary("lib", LibraryType.molecules, Map.of(), null);
155155
boolean status = storageLibrary.updatePropertiesMapping(result.getId(), newMapping);
156156
assertTrue(status);
157157

@@ -173,7 +173,7 @@ void testCreateLibrary_updateNonExistingPropertyMapping() {
173173
doThrow(new StorageException("A library %s does not contain the following properties test4".formatted(LIBRARY_ID)))
174174
.when(storageLibrary).updatePropertiesMapping(eq(LIBRARY_ID), eq(newMapping));
175175

176-
Library result = storageLibrary.createLibrary("lib", LibraryType.MOLECULES, Map.of(), null);
176+
Library result = storageLibrary.createLibrary("lib", LibraryType.molecules, Map.of(), null);
177177
Exception exception = assertThrows(StorageException.class, () ->
178178
storageLibrary.updatePropertiesMapping(result.getId(), newMapping)
179179
);
@@ -208,7 +208,7 @@ void testCreateLibrary_updateGeneratedPropertyMapping() {
208208
}
209209

210210
@ParameterizedTest
211-
@EnumSource(value = LibraryType.class, names = {"MOLECULES", "REACTIONS"})
211+
@EnumSource(value = LibraryType.class, names = {"molecules", "reactions"})
212212
void testUpdateLibrary(LibraryType libraryType) {
213213
Library library = new Library();
214214
library.setId(LIBRARY_ID);
@@ -240,7 +240,7 @@ void testUpdateLibrary_parallel() throws InterruptedException {
240240
when(storageLibrary.createLibrary(any(), any(), any())).thenReturn(baseLibrary);
241241
when(storageLibrary.updateLibrary(any())).thenAnswer(invocation -> invocation.getArgument(0));
242242

243-
Library library = storageLibrary.createLibrary(libraryName, LibraryType.MOLECULES, null);
243+
Library library = storageLibrary.createLibrary(libraryName, LibraryType.molecules, null);
244244

245245
int threadCounts = 10;
246246
CountDownLatch latch = new CountDownLatch(threadCounts);
@@ -275,7 +275,7 @@ void testUpdateLibrary_parallel() throws InterruptedException {
275275
}
276276

277277
@ParameterizedTest
278-
@EnumSource(value = LibraryType.class, names = {"MOLECULES", "REACTIONS"})
278+
@EnumSource(value = LibraryType.class, names = {"molecules", "reactions"})
279279
void testDeleteLibrary(LibraryType libraryType) {
280280
Library library = new Library();
281281
library.setId(LIBRARY_ID);
@@ -291,7 +291,7 @@ void testDeleteLibrary(LibraryType libraryType) {
291291
}
292292

293293
@ParameterizedTest
294-
@EnumSource(value = LibraryType.class, names = {"METRICS", "ANY"})
294+
@EnumSource(value = LibraryType.class, names = {"metrics", "any"})
295295
void testDeleteLibraryWrongType(LibraryType libraryType) {
296296
Library library = new Library();
297297
library.setId("1");

0 commit comments

Comments
 (0)