Skip to content

Commit 3c04ad5

Browse files
committed
feat: define integration test
Signed-off-by: Otavio Santana <[email protected]>
1 parent 66cb135 commit 3c04ad5

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2023 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+
* Maximillian Arruda
14+
*/
15+
16+
package org.eclipse.jnosql.databases.neo4j.integration;
17+
18+
import jakarta.data.repository.Repository;
19+
import org.eclipse.jnosql.databases.neo4j.mapping.Neo4JRepository;
20+
import org.eclipse.jnosql.mapping.NoSQLRepository;
21+
22+
@Repository
23+
public interface MagazineRepository extends Neo4JRepository<Magazine, String> {
24+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright (c) 2023 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.neo4j.integration;
16+
17+
18+
import jakarta.inject.Inject;
19+
import org.eclipse.jnosql.databases.neo4j.communication.DatabaseContainer;
20+
import org.eclipse.jnosql.databases.neo4j.communication.Neo4JConfigurations;
21+
import org.eclipse.jnosql.databases.neo4j.mapping.Neo4JExtension;
22+
import org.eclipse.jnosql.databases.neo4j.mapping.Neo4JTemplate;
23+
import org.eclipse.jnosql.mapping.Database;
24+
import org.eclipse.jnosql.mapping.DatabaseType;
25+
import org.eclipse.jnosql.mapping.core.Converters;
26+
import org.eclipse.jnosql.mapping.core.spi.EntityMetadataExtension;
27+
import org.eclipse.jnosql.mapping.reflection.Reflections;
28+
import org.eclipse.jnosql.mapping.semistructured.EntityConverter;
29+
import org.jboss.weld.junit5.auto.AddExtensions;
30+
import org.jboss.weld.junit5.auto.AddPackages;
31+
import org.jboss.weld.junit5.auto.EnableAutoWeld;
32+
import org.junit.jupiter.api.Test;
33+
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
34+
35+
import static java.util.UUID.randomUUID;
36+
import static org.assertj.core.api.Assertions.assertThat;
37+
import static org.eclipse.jnosql.communication.driver.IntegrationTest.MATCHES;
38+
import static org.eclipse.jnosql.communication.driver.IntegrationTest.NAMED;
39+
40+
@EnableAutoWeld
41+
@AddPackages(value = {Database.class, EntityConverter.class, Neo4JTemplate.class})
42+
@AddPackages(Magazine.class)
43+
@AddPackages(Reflections.class)
44+
@AddPackages(Converters.class)
45+
@AddExtensions({EntityMetadataExtension.class, Neo4JExtension.class})
46+
@EnabledIfSystemProperty(named = NAMED, matches = MATCHES)
47+
public class RepositoryIntegrationTest {
48+
49+
static {
50+
DatabaseContainer.INSTANCE.host();
51+
System.setProperty(Neo4JConfigurations.URI.get(), DatabaseContainer.INSTANCE.host());
52+
System.setProperty(Neo4JConfigurations.DATABASE.get(), "neo4j");
53+
}
54+
55+
@Inject
56+
private MagazineRepository repository;
57+
58+
@Test
59+
void shouldSave() {
60+
Magazine magazine = new Magazine(null, "Effective Java", 1);
61+
assertThat(repository.save(magazine))
62+
.isNotNull();
63+
64+
}
65+
66+
}

0 commit comments

Comments
 (0)