@Override protected Map<String, List<StagedModel>> addDependentStagedModelsMap(Group group) throws Exception { Map<String, List<StagedModel>> dependentStagedModelsMap = new HashMap<>(); AssetVocabulary vocabulary = AssetTestUtil.addVocabulary(group.getGroupId()); addDependentStagedModel(dependentStagedModelsMap, AssetVocabulary.class, vocabulary); AssetCategory category = AssetTestUtil.addCategory(group.getGroupId(), vocabulary.getVocabularyId()); addDependentStagedModel(dependentStagedModelsMap, AssetCategory.class, category); return dependentStagedModelsMap; }
@Before public void setUp() throws Exception { _assetCategoryPersistence = AssetCategoryUtil.getPersistence(); _sessionFactoryInvocationHandler = new SessionFactoryInvocationHandler( ReflectionTestUtil.getFieldValue(_assetCategoryPersistence, "_sessionFactory")); ReflectionTestUtil.setFieldValue( _assetCategoryPersistence, "_sessionFactory", ProxyUtil.newProxyInstance( SessionFactory.class.getClassLoader(), new Class<?>[] {SessionFactory.class}, _sessionFactoryInvocationHandler)); _assetCategoryPersistence.setRebuildTreeEnabled(false); _nestedSetsTreeManager = new PersistenceNestedSetsTreeManager<AssetCategory>( (BasePersistenceImpl<?>) _assetCategoryPersistence, "AssetCategory", "AssetCategory", AssetCategoryImpl.class, "categoryId", "groupId", "leftCategoryId", "rightCategoryId"); _group = GroupTestUtil.addGroup(); _assetVocabulary = AssetTestUtil.addVocabulary(_group.getGroupId()); _assetCategories = new AssetCategory[9]; for (int i = 0; i < 9; i++) { _assetCategories[i] = AssetTestUtil.addCategory(_group.getGroupId(), _assetVocabulary.getVocabularyId()); } PropsValues.SPRING_HIBERNATE_SESSION_DELEGATED = false; }