use of org.n52.iceland.i18n.I18NDAORepository in project SOS by 52North.
the class HibernateFeatureQueryHandlerTest method setUp.
@Before
public void setUp() throws ConfigurationError {
geometryHandler = new GeometryHandler();
geometryHandler.setStorageEpsg(4326);
geometryHandler.setStorage3DEpsg(4979);
geometryHandler.setEpsgCodesWithNorthingFirstAxisOrder("2044-2045;2081-2083;2085-2086;2093;2096-2098;2105-2132;2169-2170;2176-2180;2193;2200;2206-2212;2319;" + "2320-2462;2523-2549;2551-2735;2738-2758;2935-2941;2953;3006-3030;3034-3035;3058-3059;3068;" + "3114-3118;3126-3138;3300-3301;3328-3335;3346;3350-3352;3366;3416;4001-4999;20004-20032;" + "20064-20092;21413-21423;21473-21483;21896-21899;22171;22181-22187;22191-22197;25884;27205-27232;" + "27391-27398;27492;28402-28432;28462-28492;30161-30179;30800;31251-31259;31275-31279;31281-31290;" + "31466-31700");
geometryHandler.setDatasourceNorthingFirst(false);
contentCacheController.setPersistenceStrategy(Mockito.mock(ContentCachePersistenceStrategy.class));
contentCacheController.setCacheFactory(Mockito.mock(ContentCacheFactory.class));
contentCacheController.setCompleteCacheUpdateFactory(Mockito.mock(CompleteCacheUpdateFactory.class));
contentCacheController.setCache(cache);
featureQueryHandler = new HibernateFeatureQueryHandler();
featureQueryHandler.setGeometryHandler(geometryHandler);
featureQueryHandler.setContentCacheController(contentCacheController);
featureQueryHandler.setI18NDAORepository(i18NDAORepository);
}
use of org.n52.iceland.i18n.I18NDAORepository in project SOS by 52North.
the class CacheQueryTest method fillObservations.
@BeforeClass
public static void fillObservations() throws OwsExceptionReport {
Session session = getSession();
Transaction transaction = null;
try {
transaction = session.beginTransaction();
I18NDAORepository i18NDAORepository = new I18NDAORepository();
DaoFactory daoFactory = new DaoFactory();
daoFactory.setI18NDAORepository(i18NDAORepository);
HibernateObservationBuilder b = new HibernateObservationBuilder(session, daoFactory);
DateTime begin = new DateTime();
int numObs = 10000;
for (int i = 0; i < numObs; ++i) {
if (i % 50 == 0) {
LOGGER.debug(LOG_TEMPLATE, i, numObs);
session.flush();
session.clear();
}
b.createObservation(String.valueOf(i), begin.plusHours(i));
}
LOGGER.debug(LOG_TEMPLATE, numObs, numObs);
session.flush();
transaction.commit();
} catch (HibernateException | CodedException he) {
if (transaction != null) {
transaction.rollback();
}
throw he;
} finally {
returnSession(session);
}
}
use of org.n52.iceland.i18n.I18NDAORepository in project SOS by 52North.
the class TemporalRestrictionTest method getBuilder.
protected HibernateObservationBuilder getBuilder(Session session) throws OwsExceptionReport {
I18NDAORepository i18NDAORepository = new I18NDAORepository();
DaoFactory daoFactory = new DaoFactory();
daoFactory.setI18NDAORepository(i18NDAORepository);
return new HibernateObservationBuilder(session, daoFactory);
}
use of org.n52.iceland.i18n.I18NDAORepository in project SOS by 52North.
the class AbstractInsertDAOTest method setUp.
public void setUp() throws OwsExceptionReport, ConverterException, EncodingException {
GEOMETRY.setSRID(4326);
SOSHibernateSessionHolder holder = new SOSHibernateSessionHolder();
holder.setConnectionProvider(this);
daoFactory.setSweHelper(new SweHelper());
SosHelper sosHelper = new SosHelper();
sosHelper.setServiceURL(URI.create("http://test.org"));
daoFactory.setSosHelper(sosHelper);
GeometryHandler geometryHandler = new GeometryHandler();
initGeometryHandler(geometryHandler);
daoFactory.setGeometryHandler(geometryHandler);
HibernateFeatureQueryHandler featureQueryHandler = new HibernateFeatureQueryHandler();
featureQueryHandler.setDaoFactory(daoFactory);
featureQueryHandler.setI18NDAORepository(i18NDAORepository);
featureQueryHandler.setGeometryHandler(geometryHandler);
featureQueryHandler.setContentCacheController(contentCacheController);
daoFactory.setFeatureQueryHandler(featureQueryHandler);
daoFactory.setDecoderRepository(decoderRepository);
daoFactory.setEncoderRepository(encoderRepository);
daoFactory.setI18NDAORepository(i18NDAORepository);
daoFactory.setSweHelper(initSweHelper());
cacheFeeder.setConnectionProvider(holder);
cacheFeeder.setI18NDAORepository(i18NDAORepository);
cacheFeeder.setGeometryHandler(geometryHandler);
initEncoder();
initDecoder();
bindingRepository.setComponentFactories(Optional.empty());
bindingRepository.setComponents(Optional.empty());
additionalObservationCreatorRepository.setComponentFactories(Optional.empty());
additionalObservationCreatorRepository.setComponents(Optional.empty());
contentCacheController.setPersistenceStrategy(Mockito.mock(ContentCachePersistenceStrategy.class));
contentCacheController.setCacheFactory(Mockito.mock(ContentCacheFactory.class));
contentCacheController.setCompleteCacheUpdateFactory(Mockito.mock(CompleteCacheUpdateFactory.class));
contentCacheController.setCache(cache);
cache.setSupportedTypeRepository(Mockito.mock(SupportedTypeRepository.class));
i18NDAORepository.init();
decoderRepository.init();
converterRepository.init();
factoryRepository.init();
bindingRepository.init();
additionalObservationCreatorRepository.init();
DefaultContentModificationListener defaultContentModificationListener = new DefaultContentModificationListener(cacheFeeder, contentCacheController);
defaultContentModificationListener.setConverterRepository(converterRepository);
serviceEventBus.register(defaultContentModificationListener);
ctx = new HibernateProcedureCreationContext(serviceMetadataRepository, decoderRepository, factoryRepository, i18NDAORepository, daoFactory, converterRepository, null, bindingRepository, null, contentCacheController, Mockito.mock(ProcedureDescriptionSettings.class));
observationCtx = new OmObservationCreatorContext(serviceMetadataRepository, i18NDAORepository, daoFactory, new ProfileHanlderMock(), additionalObservationCreatorRepository, contentCacheController, featureQueryHandler, converterRepository, factoryRepository, geometryHandler, decoderRepository, null, bindingRepository);
observationCtx.setDefaultLanguage("eng");
Session session = null;
try {
session = getSession();
HibernateMetadataCache.init(session);
} finally {
returnSession(session);
}
initDaos();
}
use of org.n52.iceland.i18n.I18NDAORepository in project SOS by 52North.
the class ObservablePropertyDAOTest method save.
protected Map<String, PhenomenonEntity> save(List<AbstractPhenomenon> abstractPhenomenons, Session session) {
I18NDAORepository i18NDAORepository = new I18NDAORepository();
DaoFactory daoFactory = new DaoFactory();
daoFactory.setI18NDAORepository(i18NDAORepository);
ObservablePropertyDAO dao = daoFactory.getObservablePropertyDAO();
Collection<PhenomenonEntity> savedObservableProperties = dao.getOrInsertObservableProperty(abstractPhenomenons, session);
return asMap(savedObservableProperties);
}
Aggregations