@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; }
@Override protected StagedModel addStagedModel( Group group, Map<String, List<StagedModel>> dependentStagedModelsMap) throws Exception { List<StagedModel> vocabularyDependentStagedModels = dependentStagedModelsMap.get(AssetVocabulary.class.getSimpleName()); AssetVocabulary vocabulary = (AssetVocabulary) vocabularyDependentStagedModels.get(0); List<StagedModel> categoryDependentStagedModels = dependentStagedModelsMap.get(AssetCategory.class.getSimpleName()); AssetCategory category = (AssetCategory) categoryDependentStagedModels.get(0); return AssetTestUtil.addCategory( group.getGroupId(), vocabulary.getVocabularyId(), category.getCategoryId()); }
@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; }