/** * 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 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)); }
File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter muWriter = new PrintWriter(new FileOutputStream(mu, true)); muWriter.print("appended mu text"); File lambda = new File(thisTest.getWorkingCopy(), "A/B/lambda"); lambda.delete(); thisTest.getWc().setItemTextStatus("A/B/lambda", Status.Kind.missing);
new CopySource(new File(thisTest.getWorkingCopy(), "A/B/E/" + fileName).getPath(), firstRevision, pegRevision); new File(thisTest.getWorkingCopy(), "A/B/F").getPath(), null, true, false, null); wcSource[0] = new CopySource(new File(thisTest.getWorkingCopy(), "A/B").getPath(), Revision.WORKING, Revision.WORKING); client.commitMessageHandler(null);
File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter muWriter = new PrintWriter(new FileOutputStream(mu, true)); muWriter.print("appended mu text"); File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho"); PrintWriter rhoWriter = new PrintWriter(new FileOutputStream(rho, true));
File adminLock = new File(thisTest.getWorkingCopy(),"A/B/" + getAdminDirectoryName() + "/lock"); PrintWriter pw = new PrintWriter(new FileOutputStream(adminLock)); adminLock = new File(thisTest.getWorkingCopy(),"A/D/G/" + getAdminDirectoryName() + "/lock"); pw = new PrintWriter(new FileOutputStream(adminLock)); adminLock = new File(thisTest.getWorkingCopy(),"A/C/" + getAdminDirectoryName() + "/lock"); pw = new PrintWriter(new FileOutputStream(adminLock));
File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter muWriter = new PrintWriter(new FileOutputStream(mu, true)); muWriter.print("appended mu text"); File rho = new File(thisTest.getWorkingCopy(), "A/D/G/rho"); PrintWriter rhoWriter = new PrintWriter(new FileOutputStream(rho, true));
srcPaths[i] = new File(thisTest.getWorkingCopy(), "A/B/E/" + fileName).getPath(); new File(thisTest.getWorkingCopy(), "A/B/F").getPath(), null, false, true, false, null);
File mu = new File(thisTest.getWorkingCopy(), "A/mu"); PrintWriter muWriter = new PrintWriter(new FileOutputStream(mu, true)); muWriter.print("appended mu text"); File lambda = new File(thisTest.getWorkingCopy(), "A/B/lambda"); lambda.delete(); thisTest.getWc().setItemTextStatus("A/B/lambda", Status.Kind.missing);
File dir = new File(thisTest.getWorkingCopy(), "dir"); dir.mkdir();
srcPaths[i] = new File(thisTest.getWorkingCopy(), "A/B/E/" + fileName).getPath(); new File(thisTest.getWorkingCopy(), "A/B/F").getPath(), null, false, true, false, null);
/** * Append the text <code>toAppend</code> to the WC file at * <code>path</code>, and update the expected WC state * accordingly. * * @param thisTest The test whose expected WC to tweak. * @param path The working copy-relative path to change. * @param toAppend The text to append to <code>path</code>. * @param rev The expected revision number for thisTest's WC. * @return The file created during the setup. * @since 1.5 */ private File appendText(OneTest thisTest, String path, String toAppend, int rev) throws FileNotFoundException { File f = new File(thisTest.getWorkingCopy(), path); PrintWriter writer = new PrintWriter(new FileOutputStream(f, true)); writer.print(toAppend); writer.close(); if (rev > 0) { WC wc = thisTest.getWc(); wc.setItemWorkingCopyRevision(path, rev); wc.setItemContent(path, wc.getItemContent(path) + toAppend); } addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(), path, NodeKind.file, CommitItemStateFlags.TextMods); return f; }
/** * Test the basis SVNClient.add functionality with files that * should be ignored. * @throws Throwable */ public void testBasicAddIgnores() throws Throwable { // create working copy OneTest thisTest = new OneTest(); // create dir File dir = new File(thisTest.getWorkingCopy(), "dir"); dir.mkdir(); // create dir/foo.c File fileC = new File(dir, "foo.c"); new FileOutputStream(fileC).close(); // create dir/foo.o (should be ignored) File fileO = new File(dir, "foo.o"); new FileOutputStream(fileO).close(); // add dir client.add(dir.getAbsolutePath(), true); thisTest.getWc().addItem("dir", null); thisTest.getWc().setItemTextStatus("dir",Status.Kind.added); thisTest.getWc().addItem("dir/foo.c", ""); thisTest.getWc().setItemTextStatus("dir/foo.c",Status.Kind.added); thisTest.getWc().addItem("dir/foo.o", ""); thisTest.getWc().setItemTextStatus("dir/foo.o",Status.Kind.ignored); thisTest.getWc().setItemNodeKind("dir/foo.o", NodeKind.unknown); // test the working copy status thisTest.checkStatus(); }
/** * Append the text <code>toAppend</code> to the WC file at * <code>path</code>, and update the expected WC state * accordingly. * * @param thisTest The test whose expected WC to tweak. * @param path The working copy-relative path to change. * @param toAppend The text to append to <code>path</code>. * @param rev The expected revision number for thisTest's WC. * @return The file created during the setup. * @since 1.5 */ private File appendText(OneTest thisTest, String path, String toAppend, int rev) throws FileNotFoundException { File f = new File(thisTest.getWorkingCopy(), path); PrintWriter writer = new PrintWriter(new FileOutputStream(f, true)); writer.print(toAppend); writer.close(); if (rev > 0) { WC wc = thisTest.getWc(); wc.setItemWorkingCopyRevision(path, rev); wc.setItemContent(path, wc.getItemContent(path) + toAppend); } addExpectedCommitItem(thisTest.getWCPath(), thisTest.getUrl(), path, NodeKind.file, CommitItemStateFlags.TextMods); return f; }
File dir = new File(thisTest.getWorkingCopy(), "dir"); dir.mkdir();
/** * Test the basis SVNClient.add functionality with files that * should be ignored. * @throws Throwable */ public void testBasicAddIgnores() throws Throwable { // create working copy OneTest thisTest = new OneTest(); // create dir File dir = new File(thisTest.getWorkingCopy(), "dir"); dir.mkdir(); // create dir/foo.c File fileC = new File(dir, "foo.c"); new FileOutputStream(fileC).close(); // create dir/foo.o (should be ignored) File fileO = new File(dir, "foo.o"); new FileOutputStream(fileO).close(); // add dir client.add(dir.getAbsolutePath(), true); thisTest.getWc().addItem("dir", null); thisTest.getWc().setItemTextStatus("dir",Status.Kind.added); thisTest.getWc().addItem("dir/foo.c", ""); thisTest.getWc().setItemTextStatus("dir/foo.c",Status.Kind.added); thisTest.getWc().addItem("dir/foo.o", ""); thisTest.getWc().setItemTextStatus("dir/foo.o",Status.Kind.ignored); thisTest.getWc().setItemNodeKind("dir/foo.o", NodeKind.unknown); // test the working copy status thisTest.checkStatus(); }
/** * 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.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.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."); }