/** * Test the basic SVNClient.fileContent functionality. * @throws Throwable */ public void testBasicCatStream() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // modify A/mu File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true)); pw.print("some text"); pw.close(); // get the content from the repository ByteArrayOutputStream baos = new ByteArrayOutputStream(); client.streamFileContent(thisTest.getWCPath() + "/A/mu", null, null, 100, baos); byte[] content = baos.toByteArray(); byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes(); // the content should be the same assertTrue("content changed", Arrays.equals(content, testContent)); }
/** * Test the basic SVNClient.fileContent functionality. * @throws Throwable */ public void testBasicCat() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // modify A/mu File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true)); pw.print("some text"); pw.close(); // get the content from the repository byte[] content = client.fileContent(thisTest.getWCPath()+"/A/mu", null); byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes(); // the content should be the same assertTrue("content changed", Arrays.equals(content, testContent)); }
/** * Test the basic SVNClient.fileContent functionality. * @throws Throwable */ public void testBasicCat() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // modify A/mu File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter pw = new PrintWriter(new FileOutputStream(mu, true)); pw.print("some text"); pw.close(); // get the content from the repository byte[] content = client.fileContent(thisTest.getWCPath()+"/A/mu", null); byte[] testContent = thisTest.getWc().getItemContent("A/mu").getBytes(); // the content should be the same assertTrue("content changed", Arrays.equals(content, testContent)); }
/** * Test the basic SVNClient.list functionality. * @throws Throwable */ public void testBasicLs() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // list the repository root dir DirEntry[] entries = client.list(thisTest.getWCPath(), null, false); thisTest.getWc().check(entries, "", false); // list directory A entries = client.list(thisTest.getWCPath() + "/A", null, false); thisTest.getWc().check(entries, "A", false); // list directory A in BASE revision entries = client.list(thisTest.getWCPath() + "/A", Revision.BASE, false); thisTest.getWc().check(entries, "A", false); // list file A/mu entries = client.list(thisTest.getWCPath() + "/A/mu", null, false); thisTest.getWc().check(entries, "A/mu"); }
/** * Test the basic SVNClient.list functionality. * @throws Throwable */ public void testBasicLs() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // list the repository root dir DirEntry[] entries = client.list(thisTest.getWCPath(), null, false); thisTest.getWc().check(entries, "", false); // list directory A entries = client.list(thisTest.getWCPath() + "/A", null, false); thisTest.getWc().check(entries, "A", false); // list directory A in BASE revision entries = client.list(thisTest.getWCPath() + "/A", Revision.BASE, false); thisTest.getWc().check(entries, "A", false); // list file A/mu entries = client.list(thisTest.getWCPath() + "/A/mu", null, false); thisTest.getWc().check(entries, "A/mu"); }
/** * test the basic SVNClient.isAdminDirectory functionality * @throws Throwable * @since 1.2 */ public void testBasicIsAdminDirectory() throws Throwable { // build the test setup OneTest thisTest = new OneTest(); Notify2 notify = new Notify2() { public void onNotify(NotifyInformation info) { client.isAdminDirectory(".svn"); } }; client.notification2(notify); // update the test assertEquals("wrong revision number from update", client.update(thisTest.getWCPath(), null, true), 1); }
/** * test the basic SVNClient.isAdminDirectory functionality * @throws Throwable * @since 1.2 */ public void testBasicIsAdminDirectory() throws Throwable { // build the test setup OneTest thisTest = new OneTest(); Notify2 notify = new Notify2() { public void onNotify(NotifyInformation info) { client.isAdminDirectory(".svn"); } }; client.notification2(notify); // update the test assertEquals("wrong revision number from update", client.update(thisTest.getWCPath(), null, true), 1); }
/** * Test the {@link SVNClientInterface.diffSummarize()} API. * @since 1.5 */ public void testDiffSummarize() throws SubversionException, IOException { OneTest thisTest = new OneTest(false); DiffSummaries summaries = new DiffSummaries(); // Perform a recursive diff summary, ignoring ancestry. client.diffSummarize(thisTest.getUrl(), new Revision.Number(0), thisTest.getUrl(), Revision.HEAD, Depth.infinity, null, false, summaries); assertExpectedDiffSummaries(summaries); summaries.clear(); // Perform a recursive diff summary with a peg revision, // ignoring ancestry. client.diffSummarize(thisTest.getUrl(), Revision.HEAD, new Revision.Number(0), Revision.HEAD, Depth.infinity, null, false, summaries); assertExpectedDiffSummaries(summaries); }
/** * Test the basic SVNClient.info functionality. * @throws Throwable */ public void testBasicInfo() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // get the item information and test it Info info = client.info(thisTest.getWCPath()+"/A/mu"); assertEquals("wrong revision from info", 1, info.getLastChangedRevision()); assertEquals("wrong schedule kind from info", ScheduleKind.normal, info.getSchedule()); assertEquals("wrong node kind from info", NodeKind.file, info.getNodeKind()); }
/** * Test the basic SVNClient.status functionality. * @throws Throwable */ public void testBasicStatus() throws Throwable { // build the test setup OneTest thisTest = new OneTest(); // check the status of the working copy thisTest.checkStatus(); // Test status of non-existent file File fileC = new File(thisTest.getWorkingCopy() + "/A", "foo.c"); Status s = client.singleStatus(fileToSVNPath(fileC, false), false); if (s != null) fail("File foo.c should not return a status."); }
/** * Test the basic SVNClient.info functionality. * @throws Throwable */ public void testBasicInfo() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); // get the item information and test it Info info = client.info(thisTest.getWCPath()+"/A/mu"); assertEquals("wrong revision from info", 1, info.getLastChangedRevision()); assertEquals("wrong schedule kind from info", ScheduleKind.normal, info.getSchedule()); assertEquals("wrong node kind from info", NodeKind.file, info.getNodeKind()); }
/** * Test the basic SVNClient.status functionality. * @throws Throwable */ public void testBasicStatus() throws Throwable { // build the test setup OneTest thisTest = new OneTest(); // check the status of the working copy thisTest.checkStatus(); // Test status of non-existent file File fileC = new File(thisTest.getWorkingCopy() + "/A", "foo.c"); Status s = client.singleStatus(fileToSVNPath(fileC, false), false); if (s != null) fail("File foo.c should not return a status."); }
/** * Test the basic SVNClient.cleanup functionality. * Without a way to force a lock, this test just verifies * the method can be called succesfully. * @throws Throwable */ public void testBasicCleanup() throws Throwable { // create a test working copy OneTest thisTest = new OneTest(); // run cleanup client.cleanup(thisTest.getWCPath()); }
/** * Copy the working copy and the expected working copy layout for tests * which need multiple working copy * @param append append to the working copy name of the original * @return second test object. * @throws Exception */ protected OneTest copy(String append) throws SubversionException, IOException { return new OneTest(this, append); }
/** * Test the basic SVNClient.getVersionInfo functionality. * @throws Throwable * @since 1.2 */ public void testBasicVersionInfo() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); assertEquals("wrong version info", "1", client.getVersionInfo(thisTest.getWCPath(), null, false)); }
/** * Test the basic SVNClient.getVersionInfo functionality. * @throws Throwable * @since 1.2 */ public void testBasicVersionInfo() throws Throwable { // create the working copy OneTest thisTest = new OneTest(); assertEquals("wrong version info", "1", client.getVersionInfo(thisTest.getWCPath(), null, false)); }
/** * Test the basic SVNAdmin.create functionality * @throws SubversionException */ public void testCreate() throws SubversionException, IOException { OneTest thisTest = new OneTest(false); assertTrue("repository exists", thisTest.getRepository().exists()); }
public void testSetRevProp() throws SubversionException, IOException { OneTest thisTest = new OneTest(false); admin.setRevProp(thisTest.getRepositoryPath(), Revision.getInstance(0), "svn:log", "Initial repository creation", false, false); } }
/** * Copy the working copy and the expected working copy layout for tests * which need multiple working copy * @param append append to the working copy name of the original * @return second test object. * @throws Exception */ protected OneTest copy(String append) throws SubversionException, IOException { return new OneTest(this, append); }
/** * Test the basic SVNAdmin.create functionality * @throws SubversionException */ public void testCreate() throws SubversionException, IOException { OneTest thisTest = new OneTest(false); assertTrue("repository exists", thisTest.getRepository().exists()); }