@@ -0,0 +1,2232 @@
+/*%0A * Hibernate, Relational Persistence for Idiomatic Java%0A *%0A * JBoss, Home of Professional Open Source%0A * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors%0A * as indicated by the @authors tag. All rights reserved.%0A * See the copyright.txt in the distribution for a%0A * full listing of individual contributors.%0A *%0A * This copyrighted material is made available to anyone wishing to use,%0A * modify, copy, or redistribute it subject to the terms and conditions%0A * of the GNU Lesser General Public License, v. 2.1.%0A * This program is distributed in the hope that it will be useful, but WITHOUT A%0A * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A%0A * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.%0A * You should have received a copy of the GNU Lesser General Public License,%0A * v.2.1 along with this distribution; if not, write to the Free Software%0A * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,%0A * MA  02110-1301, USA.%0A */%0Apackage org.hibernate.ogm.test.utils;%0A%0Aimport org.infinispan.Cache;%0A%0Aimport org.hibernate.Session;%0Aimport org.hibernate.SessionFactoryObserver;%0Aimport org.hibernate.impl.SessionFactoryImpl;%0Aimport org.hibernate.ogm.metadata.GridMetadataManager;%0Aimport org.hibernate.ogm.metadata.GridMetadataManagerHelper;%0A%0A/**%0A * @author Emmanuel Bernard %3Cemmanuel@hibernate.org%3E%0A */%0Apublic class TestHelper %7B%0A%09public static Cache getEntityCache(Session session) %7B%0A%09%09final SessionFactoryObserver observer = getObserver( session );%0A%09%09return ( ( GridMetadataManager ) observer ).getCacheContainer().getCache( GridMetadataManagerHelper.ENTITY_CACHE );%0A%09%7D%0A%0A%09public static Cache getAssociationCache(Session session) %7B%0A%09%09final SessionFactoryObserver observer = getObserver( session );%0A%09%09return ( ( GridMetadataManager ) observer ).getCacheContainer().getCache( GridMetadataManagerHelper.PROPERTY_CACHE );%0A%09%7D%0A%0A%09private static SessionFactoryObserver getObserver(Session session) %7B%0A%09%09final SessionFactoryObserver observer = ( ( SessionFactoryImpl ) session.getSessionFactory() ).getFactoryObserver();%0A%09%09if (observer == null) %7B%0A%09%09%09throw new RuntimeException( %22Wrong OGM configuration: observer not set%22 );%0A%09%09%7D%0A%09%09return observer;%0A%09%7D%0A%7D%0A

Add test helper to retrieve entity and association cache