Skip to content

Commit f215843

Browse files
committed
test: create population
Signed-off-by: Otavio Santana <[email protected]>
1 parent bfe558f commit f215843

File tree

3 files changed

+77
-18
lines changed

3 files changed

+77
-18
lines changed

jnosql-tinkerpop/src/test/java/org/eclipse/jnosql/databases/tinkerpop/mapping/NewsstandTest.java

Lines changed: 0 additions & 18 deletions
This file was deleted.

jnosql-tinkerpop/src/test/java/org/eclipse/jnosql/databases/tinkerpop/mapping/Population.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@
1414
*/
1515
package org.eclipse.jnosql.databases.tinkerpop.mapping;
1616

17+
import jakarta.data.repository.Param;
1718
import jakarta.data.repository.Repository;
1819
import org.eclipse.jnosql.databases.tinkerpop.mapping.entities.Human;
1920

21+
import java.util.List;
22+
2023
@Repository
2124
public interface Population extends TinkerPopRepository<Human, String> {
25+
26+
@Gremlin("g.V().hasLabel('Human')")
27+
List<Human> allHumans();
28+
29+
@Gremlin("g.V().hasLabel('Human')")
30+
List<Human> findByName (@Param("name") String name);
31+
2232
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Otavio Santana
14+
*/
15+
package org.eclipse.jnosql.databases.tinkerpop.mapping;
16+
17+
18+
import jakarta.inject.Inject;
19+
import org.assertj.core.api.SoftAssertions;
20+
import org.eclipse.jnosql.databases.tinkerpop.mapping.entities.Human;
21+
import org.eclipse.jnosql.databases.tinkerpop.mapping.spi.TinkerpopExtension;
22+
import org.eclipse.jnosql.mapping.core.Converters;
23+
import org.eclipse.jnosql.mapping.graph.GraphTemplate;
24+
import org.eclipse.jnosql.mapping.graph.spi.GraphExtension;
25+
import org.eclipse.jnosql.mapping.reflection.Reflections;
26+
import org.eclipse.jnosql.mapping.reflection.spi.ReflectionEntityMetadataExtension;
27+
import org.eclipse.jnosql.mapping.semistructured.EntityConverter;
28+
import org.jboss.weld.junit5.auto.AddExtensions;
29+
import org.jboss.weld.junit5.auto.AddPackages;
30+
import org.jboss.weld.junit5.auto.EnableAutoWeld;
31+
import org.junit.jupiter.api.BeforeEach;
32+
import org.junit.jupiter.api.Test;
33+
34+
@EnableAutoWeld
35+
@AddPackages(value = {Converters.class, EntityConverter.class, TinkerpopTemplate.class, GraphTemplate.class})
36+
@AddPackages(GraphProducer.class)
37+
@AddPackages(Reflections.class)
38+
@AddExtensions({ReflectionEntityMetadataExtension.class, TinkerpopExtension.class, GraphExtension.class})
39+
public class PopulationTest {
40+
41+
@Inject
42+
private Population population;
43+
44+
@BeforeEach
45+
void setUp() {
46+
this.population.deleteAll();
47+
}
48+
49+
@Test
50+
void shouldSave() {
51+
var human = Human.builder().withAge().withName("Otavio").build();
52+
Human saved = population.save(human);
53+
54+
SoftAssertions.assertSoftly(soft ->{
55+
soft.assertThat(saved).isNotNull();
56+
soft.assertThat(saved.getId()).isNotNull();
57+
soft.assertThat(saved.getName()).isEqualTo(human.getName());
58+
soft.assertThat(saved.getAge()).isEqualTo(human.getAge());
59+
});
60+
61+
}
62+
63+
@Test
64+
void shouldFindByQuery() {
65+
66+
}
67+
}

0 commit comments

Comments
 (0)