Skip to content

Commit

Permalink
style: fix style check violations
Browse files Browse the repository at this point in the history
Signed-off-by: Malte Hedderich <github@hedderich.pro>
  • Loading branch information
maltehedderich committed Jun 8, 2023
1 parent deeb591 commit 43bbdbf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonParser;
import junit.framework.TestCase;
import org.junit.Test;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;
import static org.junit.Assert.assertEquals;

import java.io.StringReader;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.opensearch.client.json.JsonData;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;

import jakarta.json.stream.JsonParser;
import junit.framework.TestCase;

public class KnnVectorMethodTest {
@Test
Expand All @@ -27,8 +36,7 @@ public void testCreateKnnVectorMethodWithAll() {
.spaceType("l2")
.engine("nmslib")
.parameters(Map.of(
"ef_construction", JsonData.of(128)
))
"ef_construction", JsonData.of(128)))
.build();
assertEquals("hnsw", knnVectorMethod.name());
assertEquals("l2", knnVectorMethod.spaceType());
Expand All @@ -38,7 +46,8 @@ public void testCreateKnnVectorMethodWithAll() {

@Test
public void testDeserializeKnnVectorMethod() {
String jsonString = "{\"name\": \"hnsw\", \"space_type\": \"l2\", \"engine\": \"nmslib\", \"parameters\": {\"ef_construction\": 128, \"m\": 24}}";
String jsonString = "{\"name\": \"hnsw\", \"space_type\": \"l2\", \"engine\": \"nmslib\"," +
" \"parameters\": {\"ef_construction\": 128, \"m\": 24}}";
StringReader reader = new StringReader(jsonString);
JacksonJsonpMapper mapper = new JacksonJsonpMapper();
JsonParser parser = mapper.jsonProvider().createParser(reader);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.client.opensearch._types.mapping;

import jakarta.json.stream.JsonParser;
import static junit.framework.TestCase.assertEquals;

import java.io.StringReader;

import org.junit.Test;
import org.opensearch.client.json.jackson.JacksonJsonpMapper;
import org.opensearch.client.util.MissingRequiredPropertyException;

import java.io.StringReader;

import static junit.framework.TestCase.assertEquals;
import jakarta.json.stream.JsonParser;

public class KnnVectorPropertyTest {

Expand Down Expand Up @@ -40,7 +49,9 @@ public void testCreateKnnVectorPropertyNoDimension() {

@Test
public void testDeserializeKnnVectorProperty() {
String jsonString = "{\"type\": \"knn_vector\", \"dimension\": 4, \"model_id\": \"testModelId\", \"method\": {\"name\": \"hnsw\", \"space_type\": \"l2\", \"engine\": \"nmslib\", \"parameters\": {\"ef_construction\": 128, \"m\": 24}}}";
String jsonString = "{\"type\": \"knn_vector\", \"dimension\": 4, \"model_id\":" +
" \"testModelId\", \"method\": {\"name\": \"hnsw\", \"space_type\": \"l2\"," +
" \"engine\": \"nmslib\", \"parameters\": {\"ef_construction\": 128, \"m\": 24}}}";
StringReader reader = new StringReader(jsonString);
JacksonJsonpMapper mapper = new JacksonJsonpMapper();
JsonParser parser = mapper.jsonProvider().createParser(reader);
Expand Down

0 comments on commit 43bbdbf

Please sign in to comment.