|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 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 | + * Alessandro Moscatelli |
| 15 | + */ |
| 16 | +package org.eclipse.jnosql.databases.mongodb.tck; |
| 17 | + |
| 18 | +import jakarta.enterprise.inject.se.SeContainer; |
| 19 | +import jakarta.enterprise.inject.se.SeContainerInitializer; |
| 20 | +import jakarta.nosql.Template; |
| 21 | +import jakarta.nosql.tck.TemplateSupplier; |
| 22 | +import org.eclipse.jnosql.databases.mongodb.communication.MongoDBDocumentConfigurations; |
| 23 | +import org.eclipse.jnosql.mapping.core.config.MappingConfigurations; |
| 24 | + |
| 25 | +import static org.eclipse.jnosql.databases.mongodb.communication.DocumentDatabase.INSTANCE; |
| 26 | + |
| 27 | +public class MongoDBTemplateSupplier implements TemplateSupplier { |
| 28 | + |
| 29 | + static { |
| 30 | + INSTANCE.get("jakarta-nosql-tck"); |
| 31 | + System.setProperty(MongoDBDocumentConfigurations.HOST.get() + ".1", INSTANCE.host()); |
| 32 | + System.setProperty(MappingConfigurations.DOCUMENT_DATABASE.get(), "jakarta-nosql-tck"); |
| 33 | + } |
| 34 | + |
| 35 | + @Override |
| 36 | + public Template get() { |
| 37 | + SeContainer container = SeContainerInitializer.newInstance().initialize(); |
| 38 | + return container.select(Template.class).get(); |
| 39 | + } |
| 40 | +} |
0 commit comments