mirror of
https://github.com/google/nomulus.git
synced 2025-08-13 04:59:51 +02:00
Add persistence.xml to the war files (#293)
* Add persistence.xml to the war files * Always use the DummyJpaTransactionManager Use the DJTM until we get all of the dependencies set up for all of the environments. This shouldn't affect any of the unit tests, these use the JpaTransactionManagerRule to set up a local database and connection. This fixes the App Engine build.
This commit is contained in:
parent
e9ce389269
commit
ebc8d54f94
2 changed files with 13 additions and 9 deletions
|
@ -25,14 +25,19 @@ project.convention.plugins['war'].webAppDirName =
|
||||||
|
|
||||||
apply plugin: 'com.google.cloud.tools.appengine'
|
apply plugin: 'com.google.cloud.tools.appengine'
|
||||||
|
|
||||||
|
def coreResourcesDir = "${rootDir}/core/build/resources/main"
|
||||||
|
|
||||||
// Get the web.xml file for the service.
|
// Get the web.xml file for the service.
|
||||||
war {
|
war {
|
||||||
webInf {
|
webInf {
|
||||||
from "../../core/src/main/java/google/registry/env/common/${project.name}/WEB-INF"
|
from "../../core/src/main/java/google/registry/env/common/${project.name}/WEB-INF"
|
||||||
|
|
||||||
|
from("${coreResourcesDir}/META-INF/persistence.xml") {
|
||||||
|
into "classes/META-INF"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def coreResourcesDir = "${rootDir}/core/build/resources/main"
|
|
||||||
war {
|
war {
|
||||||
from("${coreResourcesDir}/google/registry/ui/html") {
|
from("${coreResourcesDir}/google/registry/ui/html") {
|
||||||
include "*.html"
|
include "*.html"
|
||||||
|
|
|
@ -14,11 +14,8 @@
|
||||||
|
|
||||||
package google.registry.model.transaction;
|
package google.registry.model.transaction;
|
||||||
|
|
||||||
import com.google.appengine.api.utils.SystemProperty;
|
|
||||||
import com.google.appengine.api.utils.SystemProperty.Environment.Value;
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import google.registry.model.ofy.DatastoreTransactionManager;
|
import google.registry.model.ofy.DatastoreTransactionManager;
|
||||||
import google.registry.persistence.DaggerPersistenceComponent;
|
|
||||||
|
|
||||||
/** Factory class to create {@link TransactionManager} instance. */
|
/** Factory class to create {@link TransactionManager} instance. */
|
||||||
// TODO: Rename this to PersistenceFactory and move to persistence package.
|
// TODO: Rename this to PersistenceFactory and move to persistence package.
|
||||||
|
@ -30,11 +27,13 @@ public class TransactionManagerFactory {
|
||||||
private TransactionManagerFactory() {}
|
private TransactionManagerFactory() {}
|
||||||
|
|
||||||
private static JpaTransactionManager createJpaTransactionManager() {
|
private static JpaTransactionManager createJpaTransactionManager() {
|
||||||
if (SystemProperty.environment.value() == Value.Production) {
|
// TODO(shicong): There is currently no environment where we want to create a real JPA
|
||||||
return DaggerPersistenceComponent.create().jpaTransactionManager();
|
// transaction manager here. The unit tests that require one are all set up using
|
||||||
} else {
|
// JpaTransactionManagerRule which launches its own PostgreSQL instance. When we actually have
|
||||||
return DummyJpaTransactionManager.create();
|
// PostgreSQL tables in production, ensure that all of the test environments are set up
|
||||||
}
|
// correctly and restore the code that creates a JpaTransactionManager when
|
||||||
|
// RegistryEnvironment.get() != UNITTEST.
|
||||||
|
return DummyJpaTransactionManager.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TransactionManager createTransactionManager() {
|
private static TransactionManager createTransactionManager() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue