Changeset 1277
- Timestamp:
- 03/07/10 12:57:25 (5 months ago)
- Location:
- ide/trunk/src
- Files:
-
- 10 modified
-
org/korsakow/domain/command/AdjustToAbsolutePathsCommand.java (modified) (1 diff)
-
org/korsakow/domain/command/AdjustToRelativePathsCommand.java (modified) (1 diff)
-
org/korsakow/domain/command/FindSubtitlesCommand.java (modified) (1 diff)
-
resources/build (modified) (1 diff)
-
test/org/korsakow/AllTests.java (modified) (1 diff)
-
test/org/korsakow/command/TestAdjustToAbsolutePathsCommand.java (modified) (3 diffs)
-
test/org/korsakow/command/TestAdjustToRelativePathsCommand.java (modified) (3 diffs)
-
test/org/korsakow/command/TestFrontController.java (modified) (3 diffs)
-
test/org/korsakow/command/TestInsertCommand.java (modified) (4 diffs)
-
test/util/DOFactory.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ide/trunk/src/org/korsakow/domain/command/AdjustToAbsolutePathsCommand.java
r1233 r1277 88 88 } 89 89 for (IVideo video : subtitleMap.keySet()) { 90 String path = pathMap.get(video);90 String path = subtitleMap.get(video); 91 91 video.setSubtitles(path); 92 92 UoW.getCurrent().registerDirty(video); -
ide/trunk/src/org/korsakow/domain/command/AdjustToRelativePathsCommand.java
r1233 r1277 116 116 } 117 117 for (IVideo video : subtitleMap.keySet()) { 118 String path = pathMap.get(video);118 String path = subtitleMap.get(video); 119 119 video.setSubtitles(path); 120 120 UoW.getCurrent().registerDirty(video); -
ide/trunk/src/org/korsakow/domain/command/FindSubtitlesCommand.java
r1233 r1277 67 67 for (IMedia medium : media) 68 68 { 69 if (ResourceType.forId(medium.getType()) == ResourceType.VIDEO)69 if (ResourceType.forId(medium.getType()) != ResourceType.VIDEO) 70 70 continue; 71 71 IVideo video = (IVideo)medium; -
ide/trunk/src/resources/build
r1274 r1277 1 #S at Mar 06 15:52:00EST 20102 build.number=14 51 #Sun Mar 07 11:44:26 EST 2010 2 build.number=149 3 3 version.number=5.0.4 4 4 release.number=19.0 -
ide/trunk/src/test/org/korsakow/AllTests.java
r1230 r1277 14 14 suite.addTest(test.org.korsakow.dom.AllTests.suite()); 15 15 suite.addTest(test.org.korsakow.domain.AllTests.suite()); 16 suite.addTest(test.org.korsakow.command.AllTests.suite()); 16 17 suite.addTest(test.org.korsakow.export.AllTests.suite()); 17 18 suite.addTest(test.org.korsakow.k3.AllTests.suite()); -
ide/trunk/src/test/org/korsakow/command/TestAdjustToAbsolutePathsCommand.java
r1047 r1277 8 8 9 9 import org.dsrg.soenea.uow.UoW; 10 import org.korsakow.domain.ProjectFactory; 10 11 import org.korsakow.domain.command.AdjustToAbsolutePathsCommand; 11 import org.korsakow.domain.command.AdjustToRelativePathsCommand;12 12 import org.korsakow.domain.command.Request; 13 13 import org.korsakow.domain.command.Response; 14 14 import org.korsakow.domain.interf.IMedia; 15 15 import org.korsakow.domain.interf.IProject; 16 import org.korsakow.domain.interf.IVideo; 16 17 import org.korsakow.ide.DataRegistry; 17 18 … … 26 27 super(TestAdjustToAbsolutePathsCommand.class.getCanonicalName()); 27 28 } 29 @Override 28 30 public void setUp() throws Exception 29 31 { … … 86 88 } 87 89 } 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 } 88 131 } -
ide/trunk/src/test/org/korsakow/command/TestAdjustToRelativePathsCommand.java
r1120 r1277 7 7 import junit.framework.Assert; 8 8 9 import org.dsrg.soenea.domain.interf.IDomainObject;10 9 import org.dsrg.soenea.uow.UoW; 11 import org.korsakow.domain.ImageFactory;12 import org.korsakow.domain.InterfaceFactory;13 10 import org.korsakow.domain.ProjectFactory; 14 import org.korsakow.domain.SnuFactory;15 import org.korsakow.domain.SoundFactory;16 import org.korsakow.domain.VideoFactory;17 11 import 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;22 12 import org.korsakow.domain.command.Request; 23 13 import org.korsakow.domain.command.Response; 24 import org.korsakow.domain.interf.IImage;25 import org.korsakow.domain.interf.IInterface;26 14 import org.korsakow.domain.interf.IMedia; 27 15 import 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; 16 import org.korsakow.domain.interf.IVideo; 31 17 import org.korsakow.ide.DataRegistry; 32 18 import org.korsakow.ide.util.FileUtil; … … 42 28 super(TestAdjustToRelativePathsCommand.class.getCanonicalName()); 43 29 } 30 @Override 44 31 public void setUp() throws Exception 45 32 { … … 138 125 } 139 126 } 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 } 140 173 } -
ide/trunk/src/test/org/korsakow/command/TestFrontController.java
r1060 r1277 2 2 3 3 import java.io.File; 4 5 import junit.framework.Assert; 6 import junit.framework.TestCase; 4 7 5 8 import org.dsrg.soenea.domain.command.CommandException; … … 8 11 import org.korsakow.domain.command.AbstractCommand; 9 12 import org.korsakow.domain.command.Helper; 10 import org.korsakow.domain.command.ICommand;11 13 import org.korsakow.ide.DataRegistry; 12 14 import org.korsakow.ide.util.DomUtil; 13 15 14 16 import test.util.DomainTestUtil; 15 16 import junit.framework.Assert;17 import junit.framework.TestCase;18 17 19 18 public class TestFrontController extends TestCase { … … 46 45 47 46 public void execute() throws CommandException { 48 DomUtil.appendTextNode(DataRegistry.getDocument(), DataRegistry.getDocument() , "commandNode", "commandValue");47 DomUtil.appendTextNode(DataRegistry.getDocument(), DataRegistry.getDocument().getDocumentElement(), "commandNode", "commandValue"); 49 48 50 49 throw new CommandException(); -
ide/trunk/src/test/org/korsakow/command/TestInsertCommand.java
r1147 r1277 2 2 3 3 import java.util.ArrayList; 4 import java.util.Collections; 4 5 import java.util.List; 5 6 … … 12 13 import org.korsakow.domain.TextFactory; 13 14 import org.korsakow.domain.VideoFactory; 14 import org.korsakow.domain.command.ICommand;15 15 import org.korsakow.domain.command.InsertImageCommand; 16 16 import org.korsakow.domain.command.InsertInterfaceCommand; … … 20 20 import org.korsakow.domain.command.InsertTextCommand; 21 21 import org.korsakow.domain.command.InsertVideoCommand; 22 import org.korsakow.domain.command.InsertWidgetCommand;23 22 import org.korsakow.domain.command.Request; 24 23 import org.korsakow.domain.command.Response; … … 156 155 request.set(UpdateSnuCommand.STARTER, obj.getStarter()); 157 156 ViewHelper.addRulesToRequest(request, obj.getRules()); 157 ViewHelper.addEventsToRequest(request, Collections.EMPTY_LIST); 158 158 InsertSnuCommand command = new InsertSnuCommand(request, response); 159 159 command.execute(); -
ide/trunk/src/test/util/DOFactory.java
r1233 r1277 154 154 public static IProject createDefaultTestProject(File parentDir) throws Exception 155 155 { 156 DataRegistry.initialize(DataRegistry.createDefaultDocument(), parentDir);156 DataRegistry.initialize(DataRegistry.createDefaultDocument(), DataRegistry.getFile()); 157 157 IProject project = NewProjectCommand.newProject(DataRegistry.getFile()); 158 158 project.setName("Default Test Project");
