-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
- Loading branch information
1 parent
456b394
commit 2af7b0c
Showing
3 changed files
with
96 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...l-mapping-document/src/test/java/org/eclipse/jnosql/mapping/document/entities/People.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.mapping.document.entities; | ||
|
||
import jakarta.data.repository.Insert; | ||
import jakarta.data.repository.Repository; | ||
|
||
import java.util.List; | ||
|
||
@Repository | ||
public interface People { | ||
|
||
@Insert | ||
List<Person> insert(List<Person> people); | ||
} |
69 changes: 69 additions & 0 deletions
69
...nt/src/test/java/org/eclipse/jnosql/mapping/document/spi/DocumentCustomExtensionTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2022 Contributors to the Eclipse Foundation | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Apache License v2.0 which accompanies this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php. | ||
* | ||
* You may elect to redistribute this code under either of these licenses. | ||
* | ||
* Contributors: | ||
* | ||
* Otavio Santana | ||
*/ | ||
package org.eclipse.jnosql.mapping.document.spi; | ||
|
||
import jakarta.inject.Inject; | ||
import org.eclipse.jnosql.mapping.Database; | ||
import org.eclipse.jnosql.mapping.DatabaseType; | ||
import org.eclipse.jnosql.mapping.core.Converters; | ||
import org.eclipse.jnosql.mapping.core.spi.EntityMetadataExtension; | ||
import org.eclipse.jnosql.mapping.document.DocumentTemplate; | ||
import org.eclipse.jnosql.mapping.document.MockProducer; | ||
import org.eclipse.jnosql.mapping.document.entities.People; | ||
import org.eclipse.jnosql.mapping.reflection.Reflections; | ||
import org.eclipse.jnosql.mapping.semistructured.EntityConverter; | ||
import org.jboss.weld.junit5.auto.AddExtensions; | ||
import org.jboss.weld.junit5.auto.AddPackages; | ||
import org.jboss.weld.junit5.auto.EnableAutoWeld; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
|
||
@EnableAutoWeld | ||
@AddPackages(value = {Converters.class, EntityConverter.class, DocumentTemplate.class}) | ||
@AddPackages(MockProducer.class) | ||
@AddPackages(Reflections.class) | ||
@AddExtensions({EntityMetadataExtension.class, DocumentExtension.class}) | ||
class DocumentCustomExtensionTest { | ||
|
||
@Inject | ||
@Database(value = DatabaseType.DOCUMENT) | ||
private People people; | ||
|
||
@Inject | ||
@Database(value = DatabaseType.DOCUMENT, provider = "documentRepositoryMock") | ||
private People pepoleMock; | ||
|
||
@Inject | ||
private People repository; | ||
|
||
|
||
@Test | ||
void shouldInitiate() { | ||
assertNotNull(people); | ||
} | ||
|
||
@Test | ||
void shouldUseMock(){ | ||
assertNotNull(pepoleMock); | ||
} | ||
|
||
@Test | ||
void shouldUseDefault(){ | ||
assertNotNull(repository); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters