Changeset 1277

Show
Ignore:
Timestamp:
03/07/10 12:57:25 (5 months ago)
Author:
dreisch
Message:

-fixed #1106

Location:
ide/trunk/src
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • ide/trunk/src/org/korsakow/domain/command/AdjustToAbsolutePathsCommand.java

    r1233 r1277  
    8888                } 
    8989                for (IVideo video : subtitleMap.keySet()) { 
    90                         String path = pathMap.get(video); 
     90                        String path = subtitleMap.get(video); 
    9191                        video.setSubtitles(path); 
    9292                        UoW.getCurrent().registerDirty(video); 
  • ide/trunk/src/org/korsakow/domain/command/AdjustToRelativePathsCommand.java

    r1233 r1277  
    116116                } 
    117117                for (IVideo video : subtitleMap.keySet()) { 
    118                         String path = pathMap.get(video); 
     118                        String path = subtitleMap.get(video); 
    119119                        video.setSubtitles(path); 
    120120                        UoW.getCurrent().registerDirty(video); 
  • ide/trunk/src/org/korsakow/domain/command/FindSubtitlesCommand.java

    r1233 r1277  
    6767                for (IMedia medium : media) 
    6868                { 
    69                         if (ResourceType.forId(medium.getType()) == ResourceType.VIDEO) 
     69                        if (ResourceType.forId(medium.getType()) != ResourceType.VIDEO) 
    7070                                continue; 
    7171                        IVideo video = (IVideo)medium; 
  • ide/trunk/src/resources/build

    r1274 r1277  
    1 #Sat Mar 06 15:52:00 EST 2010 
    2 build.number=145 
     1#Sun Mar 07 11:44:26 EST 2010 
     2build.number=149 
    33version.number=5.0.4 
    44release.number=19.0 
  • ide/trunk/src/test/org/korsakow/AllTests.java

    r1230 r1277  
    1414                suite.addTest(test.org.korsakow.dom.AllTests.suite()); 
    1515                suite.addTest(test.org.korsakow.domain.AllTests.suite()); 
     16                suite.addTest(test.org.korsakow.command.AllTests.suite()); 
    1617                suite.addTest(test.org.korsakow.export.AllTests.suite()); 
    1718                suite.addTest(test.org.korsakow.k3.AllTests.suite()); 
  • ide/trunk/src/test/org/korsakow/command/TestAdjustToAbsolutePathsCommand.java

    r1047 r1277  
    88 
    99import org.dsrg.soenea.uow.UoW; 
     10import org.korsakow.domain.ProjectFactory; 
    1011import org.korsakow.domain.command.AdjustToAbsolutePathsCommand; 
    11 import org.korsakow.domain.command.AdjustToRelativePathsCommand; 
    1212import org.korsakow.domain.command.Request; 
    1313import org.korsakow.domain.command.Response; 
    1414import org.korsakow.domain.interf.IMedia; 
    1515import org.korsakow.domain.interf.IProject; 
     16import org.korsakow.domain.interf.IVideo; 
    1617import org.korsakow.ide.DataRegistry; 
    1718 
     
    2627                super(TestAdjustToAbsolutePathsCommand.class.getCanonicalName()); 
    2728        } 
     29        @Override 
    2830        public void setUp() throws Exception 
    2931        { 
     
    8688                } 
    8789        } 
     90        public void testSubtitlesWithInitialFilenameAbsoluteSuccess() throws Exception 
     91        { 
     92                IProject project = ProjectFactory.createNew(); 
     93                IVideo video = DOFactory.createVideo(DOFactory.getEmptyPNGFile(parentDir)); 
     94                File subtitleFile = File.createTempFile("subtitle", ".txt", parentDir); 
     95                video.setSubtitles(subtitleFile.getAbsolutePath()); 
     96                 
     97                UoW.getCurrent().commit(); 
     98                UoW.newCurrent(); 
     99                 
     100                final String basePath = dataFile.getParentFile().getAbsolutePath(); 
     101                 
     102                Request request = new Request(); 
     103                request.set("id", project.getId()); 
     104                Response response = new Response(); 
     105                new AdjustToAbsolutePathsCommand(request, response).execute(); 
     106                Collection<IMedia> actualMedia = (Collection<IMedia>)response.get("media"); 
     107                IVideo actualVideo = (IVideo)actualMedia.iterator().next(); 
     108                Assert.assertEquals(subtitleFile.getAbsolutePath(), actualVideo.getSubtitles()); 
     109        } 
     110        public void testSubtitlesWithInitialFilenameRelativeSuccess() throws Exception 
     111        { 
     112                IProject project = ProjectFactory.createNew(); 
     113                IVideo video = DOFactory.createVideo(DOFactory.getEmptyPNGFile(parentDir)); 
     114                File subtitleFile = File.createTempFile("subtitle", ".txt", parentDir); 
     115                final String basePath = dataFile.getParentFile().getAbsolutePath(); 
     116                video.setSubtitles(subtitleFile.getAbsolutePath().substring(basePath.length()+1)); 
     117                 
     118                UoW.getCurrent().commit(); 
     119                UoW.newCurrent(); 
     120                 
     121                 
     122                Request request = new Request(); 
     123                request.set("id", project.getId()); 
     124                Response response = new Response(); 
     125                new AdjustToAbsolutePathsCommand(request, response).execute(); 
     126                Collection<IMedia> actualMedia = (Collection<IMedia>)response.get("media"); 
     127                IVideo actualVideo = (IVideo)actualMedia.iterator().next(); 
     128                 
     129                Assert.assertEquals(subtitleFile.getAbsolutePath(), actualVideo.getSubtitles()); 
     130        } 
    88131} 
  • ide/trunk/src/test/org/korsakow/command/TestAdjustToRelativePathsCommand.java

    r1120 r1277  
    77import junit.framework.Assert; 
    88 
    9 import org.dsrg.soenea.domain.interf.IDomainObject; 
    109import org.dsrg.soenea.uow.UoW; 
    11 import org.korsakow.domain.ImageFactory; 
    12 import org.korsakow.domain.InterfaceFactory; 
    1310import org.korsakow.domain.ProjectFactory; 
    14 import org.korsakow.domain.SnuFactory; 
    15 import org.korsakow.domain.SoundFactory; 
    16 import org.korsakow.domain.VideoFactory; 
    1711import org.korsakow.domain.command.AdjustToRelativePathsCommand; 
    18 import org.korsakow.domain.command.DeleteImageCommand; 
    19 import org.korsakow.domain.command.DeleteSoundCommand; 
    20 import org.korsakow.domain.command.DeleteVideoCommand; 
    21 import org.korsakow.domain.command.RemoveReferencesToResourceCommand; 
    2212import org.korsakow.domain.command.Request; 
    2313import org.korsakow.domain.command.Response; 
    24 import org.korsakow.domain.interf.IImage; 
    25 import org.korsakow.domain.interf.IInterface; 
    2614import org.korsakow.domain.interf.IMedia; 
    2715import org.korsakow.domain.interf.IProject; 
    28 import org.korsakow.domain.interf.IResource; 
    29 import org.korsakow.domain.interf.ISnu; 
    30 import org.korsakow.domain.interf.ISound; 
     16import org.korsakow.domain.interf.IVideo; 
    3117import org.korsakow.ide.DataRegistry; 
    3218import org.korsakow.ide.util.FileUtil; 
     
    4228                super(TestAdjustToRelativePathsCommand.class.getCanonicalName()); 
    4329        } 
     30        @Override 
    4431        public void setUp() throws Exception 
    4532        { 
     
    138125                } 
    139126        } 
     127        public void testSubtitlesWithInitialFilenameAbsoluteSuccess() throws Exception 
     128        { 
     129                IProject project = ProjectFactory.createNew(); 
     130                IVideo video = DOFactory.createVideo(DOFactory.getEmptyPNGFile(parentDir)); 
     131                File subtitleFile = File.createTempFile("subtitle", ".txt", parentDir); 
     132                video.setSubtitles(subtitleFile.getAbsolutePath()); 
     133                 
     134                UoW.getCurrent().commit(); 
     135                UoW.newCurrent(); 
     136                 
     137                final String basePath = dataFile.getParentFile().getAbsolutePath(); 
     138                 
     139                Request request = new Request(); 
     140                request.set("id", project.getId()); 
     141                request.set("basePath", basePath); 
     142                Response response = new Response(); 
     143                new AdjustToRelativePathsCommand(request, response).execute(); 
     144                Collection<IMedia> actualMedia = (Collection<IMedia>)response.get("media"); 
     145                IVideo actualVideo = (IVideo)actualMedia.iterator().next(); 
     146                 
     147                Assert.assertEquals(Boolean.TRUE, response.getBoolean("status")); 
     148                Assert.assertEquals(subtitleFile.getAbsolutePath(), basePath + File.separator + actualVideo.getSubtitles()); 
     149        } 
     150        public void testSubtitlesWithInitialFilenameRelativeSuccess() throws Exception 
     151        { 
     152                IProject project = ProjectFactory.createNew(); 
     153                IVideo video = DOFactory.createVideo(DOFactory.getEmptyPNGFile(parentDir)); 
     154                File subtitleFile = File.createTempFile("subtitle", ".txt", parentDir); 
     155                final String basePath = dataFile.getParentFile().getAbsolutePath(); 
     156                video.setSubtitles(subtitleFile.getAbsolutePath().substring(basePath.length()+1)); 
     157                 
     158                UoW.getCurrent().commit(); 
     159                UoW.newCurrent(); 
     160                 
     161                 
     162                Request request = new Request(); 
     163                request.set("id", project.getId()); 
     164                request.set("basePath", basePath); 
     165                Response response = new Response(); 
     166                new AdjustToRelativePathsCommand(request, response).execute(); 
     167                Collection<IMedia> actualMedia = (Collection<IMedia>)response.get("media"); 
     168                IVideo actualVideo = (IVideo)actualMedia.iterator().next(); 
     169                 
     170                Assert.assertEquals(Boolean.TRUE, response.getBoolean("status")); 
     171                Assert.assertEquals(subtitleFile.getAbsolutePath(), basePath + File.separator + actualVideo.getSubtitles()); 
     172        } 
    140173} 
  • ide/trunk/src/test/org/korsakow/command/TestFrontController.java

    r1060 r1277  
    22 
    33import java.io.File; 
     4 
     5import junit.framework.Assert; 
     6import junit.framework.TestCase; 
    47 
    58import org.dsrg.soenea.domain.command.CommandException; 
     
    811import org.korsakow.domain.command.AbstractCommand; 
    912import org.korsakow.domain.command.Helper; 
    10 import org.korsakow.domain.command.ICommand; 
    1113import org.korsakow.ide.DataRegistry; 
    1214import org.korsakow.ide.util.DomUtil; 
    1315 
    1416import test.util.DomainTestUtil; 
    15  
    16 import junit.framework.Assert; 
    17 import junit.framework.TestCase; 
    1817 
    1918public class TestFrontController extends TestCase { 
     
    4645 
    4746                public void execute() throws CommandException { 
    48                         DomUtil.appendTextNode(DataRegistry.getDocument(), DataRegistry.getDocument(), "commandNode", "commandValue"); 
     47                        DomUtil.appendTextNode(DataRegistry.getDocument(), DataRegistry.getDocument().getDocumentElement(), "commandNode", "commandValue"); 
    4948                         
    5049                        throw new CommandException(); 
  • ide/trunk/src/test/org/korsakow/command/TestInsertCommand.java

    r1147 r1277  
    22 
    33import java.util.ArrayList; 
     4import java.util.Collections; 
    45import java.util.List; 
    56 
     
    1213import org.korsakow.domain.TextFactory; 
    1314import org.korsakow.domain.VideoFactory; 
    14 import org.korsakow.domain.command.ICommand; 
    1515import org.korsakow.domain.command.InsertImageCommand; 
    1616import org.korsakow.domain.command.InsertInterfaceCommand; 
     
    2020import org.korsakow.domain.command.InsertTextCommand; 
    2121import org.korsakow.domain.command.InsertVideoCommand; 
    22 import org.korsakow.domain.command.InsertWidgetCommand; 
    2322import org.korsakow.domain.command.Request; 
    2423import org.korsakow.domain.command.Response; 
     
    156155                request.set(UpdateSnuCommand.STARTER, obj.getStarter()); 
    157156                ViewHelper.addRulesToRequest(request, obj.getRules()); 
     157                ViewHelper.addEventsToRequest(request, Collections.EMPTY_LIST); 
    158158                InsertSnuCommand command = new InsertSnuCommand(request, response); 
    159159                command.execute(); 
  • ide/trunk/src/test/util/DOFactory.java

    r1233 r1277  
    154154        public static IProject createDefaultTestProject(File parentDir) throws Exception 
    155155        { 
    156                 DataRegistry.initialize(DataRegistry.createDefaultDocument(), parentDir); 
     156                DataRegistry.initialize(DataRegistry.createDefaultDocument(), DataRegistry.getFile()); 
    157157                IProject project = NewProjectCommand.newProject(DataRegistry.getFile()); 
    158158                project.setName("Default Test Project");