Search in sources :

Example 11 with GuiceConfig

use of com.peterphi.std.guice.common.serviceprops.composite.GuiceConfig in project stdlib by petergeneric.

the class JAXBResourceFactoryTest method testVariableReferencingLiteralDocument.

/**
 * N.B. this test wouldn't work if the XML contained something that looked like a variable (because when you include variables
 * their values get resolved)
 *
 * @throws Exception
 */
@Test
public void testVariableReferencingLiteralDocument() throws Exception {
    MyType expected = new MyType("test", true);
    GuiceConfig config = new GuiceConfig();
    config.set("some.xml", "${some.xml.incl}");
    config.set("some.xml.incl", "<MyType name=\"test\"/>");
    JAXBResourceFactory factory = new JAXBResourceFactory(config, SERIALISER_FACTORY);
    assertEquals(expected, factory.get(MyType.class, "some.xml"));
}
Also used : GuiceConfig(com.peterphi.std.guice.common.serviceprops.composite.GuiceConfig) Test(org.junit.Test)

Aggregations

GuiceConfig (com.peterphi.std.guice.common.serviceprops.composite.GuiceConfig)11 Test (org.junit.Test)8 Provides (com.google.inject.Provides)2 Named (com.google.inject.name.Named)2 PropertyFile (com.peterphi.std.io.PropertyFile)2 MetricRegistry (com.codahale.metrics.MetricRegistry)1 AbstractModule (com.google.inject.AbstractModule)1 Injector (com.google.inject.Injector)1 Singleton (com.google.inject.Singleton)1 Matchers (com.google.inject.matcher.Matchers)1 GuiceProperties (com.peterphi.std.guice.apploader.GuiceProperties)1 GuiceRole (com.peterphi.std.guice.apploader.GuiceRole)1 GuiceSetup (com.peterphi.std.guice.apploader.GuiceSetup)1 ClassScannerFactory (com.peterphi.std.guice.common.ClassScannerFactory)1 NetworkConfig (com.peterphi.std.guice.common.serviceprops.net.NetworkConfig)1 NetworkConfigGuiceRole (com.peterphi.std.guice.common.serviceprops.net.NetworkConfigGuiceRole)1 Transactional (com.peterphi.std.guice.database.annotation.Transactional)1 HibernateConfigurationValidator (com.peterphi.std.guice.hibernate.module.ext.HibernateConfigurationValidator)1 HibernateObservingInterceptor (com.peterphi.std.guice.hibernate.module.logging.HibernateObservingInterceptor)1 DateUserType (com.peterphi.std.guice.hibernate.usertype.DateUserType)1