Package org.drools.repository

Examples of org.drools.repository.ModuleItem


    }

    @Test
    public void testRemovePackage() throws SerializationException {
        initSession();
        ModuleItem packageItem = mock(ModuleItem.class);
        when(this.rulesRepository.loadModuleByUUID("uuid")).thenReturn(packageItem);
        this.repositoryPackageOperations.removeModule("uuid");
        verify(packageItem).remove();
        verify(rulesRepository).save();
    }
View Full Code Here


    @Test
    public void testRenamePackage() throws SerializationException {
        initSession();
       
        ModuleItem mockModule = Mockito.mock( ModuleItem.class );
        when( rulesRepository.loadModuleByUUID( "old" )).thenReturn( mockModule );

        AssetItemIterator assetIterator = mock( AssetItemIterator.class );
        when( mockModule.listAssetsByFormat( Mockito.anyString(),
                                             Mockito.anyString(),
                                             Mockito.anyString() ) ).thenReturn( assetIterator );
       
        this.repositoryPackageOperations.renameModule( "old",
                                                        "new" );
View Full Code Here

    }

    @Test
    public void testCreatePackage() {
        initSession();
        ModuleItem packageItem = mock(ModuleItem.class);
        when(packageItem.getUUID()).thenReturn("uuid");
        when(this.rulesRepository.createModule("name",
                "description",
                "package",
                new String[]{"workspace"},
                "Initial")).thenReturn(packageItem);
View Full Code Here

    }

    @Test
    public void testSubCreatePackage() throws SerializationException {
        initSession();
        ModuleItem packageItem = mock(ModuleItem.class);
        when(packageItem.getUUID()).thenReturn("uuid");
        when(this.rulesRepository.createSubModule("name",
                "description",
                "parentNode")).thenReturn(packageItem);
        assertEquals(this.repositoryPackageOperations.createSubModule("name",
                "description",
View Full Code Here

    }

    @Test
    public void testLoadPackageConfigWithDependencies() {
        ModuleItem packageItem = mock(ModuleItem.class);
        when(this.rulesRepository.loadGlobalArea()).thenReturn(packageItem);
        prepareMockForPackageConfigDataFactory(packageItem);
        assertNotNull(this.repositoryPackageOperations.loadModule(packageItem).getDependencies());
    }
View Full Code Here

    @Test
    public void testSavePackageArhived() throws SerializationException {
        RepositoryModuleOperations localRepositoryPackageOperations = initSpyingOnRealRepositoryPackageOperations();

        Module packageConfigData = createPackageConfigData(false);
        ModuleItem packageItem = mock(ModuleItem.class);
        Calendar calendar = GregorianCalendar.getInstance();
        when(packageItem.getLastModified()).thenReturn(calendar);
        initDroolsHeaderCheck(packageItem);
        when(packageItem.isArchived()).thenReturn(true);
        when(this.rulesRepository.loadModule(packageConfigData.getName())).thenReturn(packageItem);
        doNothing().when(localRepositoryPackageOperations).updateCategoryRules(packageConfigData,
                packageItem);
        doNothing().when(localRepositoryPackageOperations).handleUnarchivedForSaveModule(packageConfigData,
                packageItem,
View Full Code Here

    public void testSavePackageUnarhived() throws SerializationException {
        RepositoryModuleOperations localRepositoryPackageOperations = initSpyingOnRealRepositoryPackageOperations();

        Module packageConfigData = createPackageConfigData(true);

        ModuleItem packageItem = mock(ModuleItem.class);
        initDroolsHeaderCheck(packageItem);
        when(packageItem.isArchived()).thenReturn(false);
        when(this.rulesRepository.loadModule(packageConfigData.getName())).thenReturn(packageItem);
        doNothing().when(localRepositoryPackageOperations).updateCategoryRules(packageConfigData,
                packageItem);
        doNothing().when(localRepositoryPackageOperations).handleArchivedForSaveModule(packageConfigData,
                packageItem);
View Full Code Here

    public void testValidatePackageConfiguration() throws SerializationException {
        RepositoryModuleOperations localRepositoryPackageOperations = initSpyingOnRealRepositoryPackageOperations();

        Module packageConfigData = createPackageConfigData(true);

        ModuleItem packageItem = mock(ModuleItem.class);
        initDroolsHeaderCheck(packageItem);
        when(packageItem.isArchived()).thenReturn(false);
        when(this.rulesRepository.loadModule(packageConfigData.getName())).thenReturn(packageItem);
        doNothing().when(localRepositoryPackageOperations).updateCategoryRules(packageConfigData,
                packageItem);
        doNothing().when(localRepositoryPackageOperations).handleArchivedForSaveModule(packageConfigData,
                packageItem);
View Full Code Here

        initSession();
        final String packageName = "packageName";
        final String snapshotName = "snapshotName";
        final String comment = "comment";

        ModuleItem packageItem = mock(ModuleItem.class);
        when(packageItem.getFormat()).thenReturn("package");
        AssetItemIterator assetIterator = mock(AssetItemIterator.class);
        when(packageItem.listAssetsWithVersionsSpecifiedByDependenciesByFormat(AssetFormats.PROPERTIES, AssetFormats.CONFIGURATION)).thenReturn(assetIterator);
        when(this.rulesRepository.containsSnapshot(packageName,
                snapshotName)).thenReturn(true);
        when(this.rulesRepository.loadModuleSnapshot(packageName,
                snapshotName)).thenReturn(packageItem);
        this.repositoryPackageOperations.createModuleSnapshot(packageName,
View Full Code Here

        initSession();
        final String packageName = "packageName";
        final String snapshotName = "snapshotName";
        final String comment = "comment";

        ModuleItem packageItem = mock(ModuleItem.class);
        when(this.rulesRepository.loadModuleSnapshot(packageName,
                snapshotName)).thenReturn(packageItem);
        this.repositoryPackageOperations.createModuleSnapshot(packageName,
                snapshotName,
                false,
View Full Code Here

TOP

Related Classes of org.drools.repository.ModuleItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.