package com.perforce.p4simulink.test; /** * Copyright (C) 2014 Perforce Software. All rights reserved. * * Please see LICENSE.txt in top-level folder of this distribution. */ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import com.mathworks.cmlink.api.AdapterSupportedFeature; import com.mathworks.cmlink.api.ConfigurationManagementException; import com.mathworks.cmlink.api.FileState; import com.mathworks.cmlink.api.IntegerRevision; import com.mathworks.cmlink.api.Revision; import com.mathworks.cmlink.util.interactor.NullApplicationInteractor; import com.perforce.p4java.client.IClient; import com.perforce.p4java.core.file.IFileSpec; import com.perforce.p4java.exception.P4JavaException; import com.perforce.p4java.impl.generic.core.file.FileSpec; import com.perforce.p4simulink.P4Adapter; import com.perforce.p4simulink.P4CMException; import com.perforce.p4simulink.connection.Config; public class OverrideTests extends P4SimulinkTest { protected Config config; protected P4Adapter p4; protected P4Adapter conflictP4; @Before public void setupOverrideTests() throws P4JavaException { try { config = generateTestConfig(); p4 = (P4Adapter) factory.getAdapterForThisSandboxDir(TESTDIR, new NullApplicationInteractor(), config); p4.setDepotPath("//depot/..."); p4.login(); IClient client = p4.getClient("simulink.ws", true); client.setHostName(""); client.update(); // create a second client for testing conflict detection/resolution Config conflictConfig = generateTestConfig(); conflictConfig.setClient("simulink.ws2"); conflictP4 = (P4Adapter) factory.getAdapterForThisSandboxDir( TESTDIR2, new NullApplicationInteractor(), conflictConfig); conflictP4.setDepotPath("//depot/..."); conflictP4.login(); client = conflictP4.getClient("simulink.ws2", true); client.setHostName(""); client.update(); } catch (Exception e) { e.printStackTrace(); throw new P4JavaException(e); } } @Test public void testIsFeatureSupported() throws ConfigurationManagementException { assertTrue(p4.isFeatureSupported(AdapterSupportedFeature.IS_LATEST)); assertFalse(p4 .isFeatureSupported(AdapterSupportedFeature.SINGLE_FILE_COMMITS_NOT_POSSIBLE)); } @Test public void testMove() throws ConfigurationManagementException, IOException { try { // create some test files String[] filenames = { "/Main/bar.txt" }; Collection<File> files = createAndGenerateFiles(filenames); // add them addAndIgnoreMessages(files, "P4JAVA: Error(s): P4JAVA: No files to submit."); File bar = new File(TESTDIR.getAbsolutePath() + "/Main/bar.txt"); File baz = new File(TESTDIR.getAbsolutePath() + "/Main/baz.txt"); // move one to the other p4.moveFile(bar, baz); p4.submitCurrent(); // ensure we can find the new one, but not the old boolean oldFound = false; boolean newFound = false; List<IFileSpec> specs = p4.getDepotFiles(); for (IFileSpec spec : specs) { String localPath = spec.getLocalPathString(); if (localPath == null || localPath.isEmpty()) { continue; } if (localPath.equalsIgnoreCase(bar.getAbsolutePath())) { oldFound = true; } if (localPath.equalsIgnoreCase(baz.getAbsolutePath())) { newFound = true; } } assertTrue(!oldFound && newFound); } catch (Exception e) { e.printStackTrace(); } } @Test public void testAdd() { try { // create some test files String[] filenames = { TESTDIR.getAbsolutePath() + "/Main/bar.txt", TESTDIR.getAbsolutePath() + "/Main/baz.txt" }; Collection<File> files = createAndGenerateFiles(filenames); // check that they do not currently exist assertFalse(containsFiles(p4.getDepotFiles(), files)); // add them p4.add(files); p4.checkin(files, "Testing add."); // check that they now exist assertTrue(containsFiles(p4.getDepotFiles(), files)); // add already-existing files assertTrue(containsFiles(p4.getDepotFiles(), files)); assertTrue(addAndIgnoreMessages(files, "P4JAVA: Error(s): P4JAVA: No files to submit.")); // add non-existent file files.add(new File(TESTDIR.getAbsolutePath() + "/Homer/Simpson.txt")); assertTrue(addAndIgnoreMessages(files, "Some file(s) could not be transferred from client.")); assertFalse(containsFiles(p4.getDepotFiles(), files)); } catch (Exception e) { e.printStackTrace(); } } private boolean addAndIgnoreMessages(Collection<File> files, String ignore) throws ConfigurationManagementException { boolean noFilesToSubmit = false; try { p4.add(files); p4.checkin(files, "Testing re-add."); } catch (P4CMException e) { noFilesToSubmit = e.getMessage().contains(ignore); } return noFilesToSubmit; } @Test public void testRemove() throws ConfigurationManagementException, IOException { try { // create some test files String[] filenames = { TESTDIR.getAbsolutePath() + "/Main/bar.txt", TESTDIR.getAbsolutePath() + "/Main/baz.txt" }; Collection<File> files = createAndGenerateFiles(filenames); // check that they do not currently exist assertFalse(containsFiles(p4.getDepotFiles(), files)); // add them p4.add(files); p4.checkin(files, "Add files."); // check that they exist assertTrue(containsFiles(p4.getDepotFiles(), files)); // delete them p4.remove(files); p4.submitCurrent(); // check that they no longer exist assertFalse(containsFiles(p4.getDepotFiles(), files)); // re-create, and re-add files files = createAndGenerateFiles(filenames); addAndIgnoreMessages(files, "P4JAVA: Error(s): P4JAVA: No files to submit."); assertTrue(containsFiles(p4.getDepotFiles(), files)); // delete non-existent file files.add(new File(TESTDIR.getAbsolutePath() + "/Main/bar.txt")); boolean notOnClientError = false; try { p4.remove(files); p4.submitCurrent(); } catch (ConfigurationManagementException e) { notOnClientError = e.getMessage().contains( " - file(s) not on client."); } // check that we got a "not on client" error, and that they no // longer exist assertTrue(notOnClientError); assertFalse(containsFiles(p4.getDepotFiles(), files)); } catch (Exception e) { e.printStackTrace(); throw e; } } @Test public void testCheckout() throws ConfigurationManagementException, IOException { try { // create files and add to depot String[] filenames = { "Main/bar.txt", "Main/baz.txt" }; Collection<File> files = createAndGenerateFiles(filenames); // check that they do not currently exist assertFalse(containsFiles(p4.getDepotFiles(), files)); // add them p4.add(files); p4.checkin(files, "Add files."); // check that they exist in the depot assertTrue(containsFiles(p4.getDepotFiles(), files)); // now delete our local copy and verify it is gone for (File file : files) { file.delete(); assertFalse(file.exists()); } // run our checkout p4.checkout(files); // see if our local copy is back (it should be!) for (File file : files) { assertTrue(file.exists()); } // check out files that already exist locally - should be fine p4.checkout(files); // see if our local copy is back (it should be!) for (File file : files) { assertTrue(file.exists()); } // test checking out a file that doesn't exist in the depot Collection<File> moreFiles = new ArrayList<>(); moreFiles .add(new File(TESTDIR.getAbsolutePath() + "/Main/foo.txt")); moreFiles.addAll(files); p4.checkout(moreFiles); // first two files should exist, foo.txt should not for (File file : moreFiles) { if (file.getAbsolutePath().equalsIgnoreCase( TESTDIR.getAbsolutePath() + "/Main/foo.txt")) { assertFalse(file.exists()); } else { assertTrue(file.exists()); } } } catch (Exception e) { e.printStackTrace(); throw e; } } @Test public void testUncheckout() throws Exception { try { // create files and add to depot String[] filenames = { "Main/bar.txt", "Main/baz.txt" }; Collection<File> files = createAndGenerateFiles(filenames); p4.add(files); p4.checkin(files, "Add files."); // get hashes so we can check that they were reverted later HashMap<File, String> hashes = new HashMap<>(); for (File file : files) { String digest = md5sum(file); hashes.put(file, digest); } // open files for edit p4.checkout(files); // edit them for (File file : files) { FileWriter writer = new FileWriter(file); writer.append("This is a modification."); writer.flush(); writer.close(); } // check that hashes differ for (File file : files) { String digest = md5sum(file); assertFalse(hashes.get(file).equals(digest)); } // revert (uncheckout) files p4.uncheckout(files); // check that hashes match again for (File file : files) { assertTrue(hashes.get(file).equalsIgnoreCase(md5sum(file))); } } catch (Exception e) { e.printStackTrace(); throw e; } } private String md5sum(File file) throws Exception { FileInputStream inputStream = new FileInputStream(file); MessageDigest digest = MessageDigest.getInstance("md5"); byte[] bytesBuffer = new byte[1024]; int bytesRead = -1; while ((bytesRead = inputStream.read(bytesBuffer)) != -1) { digest.update(bytesBuffer, 0, bytesRead); } inputStream.close(); return new String(digest.digest()); } @Test public void testCheckinFiles() throws ConfigurationManagementException { try { // create files and add to depot String[] filenames = { "Main/bar.txt", "Main/baz.txt" }; Collection<File> files = createAndGenerateFiles(filenames); p4.add(files); p4.checkin(files, "Add files."); // were they added? Map<File, FileState> haveList = p4.getFileState(files); File f = new File(TESTDIR.getAbsolutePath() + "/" + filenames[0]); assertTrue(haveList.containsKey(f)); f = new File(TESTDIR.getAbsolutePath() + "/" + filenames[1]); assertTrue(haveList.containsKey(f)); assertEquals(2, haveList.size()); // add nonexistent files and ensure they don't actually get added List<File> bogusFiles = new ArrayList<>(); bogusFiles.add(new File(TESTDIR.getAbsolutePath() + "/" + "Main/foo.txt")); bogusFiles.add(new File(TESTDIR.getAbsolutePath() + "/" + "Main/floof.txt")); assertTrue(addAndIgnoreMessages(bogusFiles, "Some file(s) could not be transferred from client.")); // were they added? haveList = p4.getFileState(files); assertTrue(haveList.containsKey(new File(TESTDIR.getAbsolutePath() + "/" + filenames[0]))); assertTrue(haveList.containsKey(new File(TESTDIR.getAbsolutePath() + "/" + filenames[1]))); assertFalse(haveList.containsKey(bogusFiles.get(0))); assertFalse(haveList.containsKey(bogusFiles.get(1))); assertEquals(2, haveList.size()); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testCheckinFile() throws ConfigurationManagementException { try { // create files and add to depot String[] filenames = { "Main/bar.txt" }; List<File> files = (List<File>) createAndGenerateFiles(filenames); p4.add(files); p4.checkin(files.get(0), "Add files."); // were they added? Map<File, FileState> haveList = p4.getFileState(files); File f = new File(TESTDIR.getAbsolutePath() + "/" + filenames[0]); assertTrue(haveList.containsKey(f)); assertEquals(1, haveList.size()); // add nonexistent files and ensure they don't actually get added List<File> bogusFiles = new ArrayList<>(); bogusFiles.add(new File(TESTDIR.getAbsolutePath() + "/" + "Main/foo.txt")); boolean added = true; try { p4.add(bogusFiles); p4.checkin(bogusFiles.get(0), "Single file checkin"); } catch (Exception e) { if (e.getMessage().contains( "Some file(s) could not be transferred from client.")) added = false; } // were they added? haveList = p4.getFileState(files); assertFalse(added); assertTrue(haveList.containsKey(new File(TESTDIR.getAbsolutePath() + "/" + filenames[0]))); assertFalse(haveList.containsKey(bogusFiles.get(0))); assertEquals(1, haveList.size()); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testGetLatest() throws ConfigurationManagementException { try { // the test depot comes with a bunch sample files, so check for // them, sync and check again List<File> files = new ArrayList<>(); files.add(new File(TESTDIR.getAbsolutePath() + "/Main/file-31.txt")); files.add(new File(TESTDIR.getAbsolutePath() + "/Main/file-1.txt")); files.add(new File(TESTDIR.getAbsolutePath() + "/Main/bar.txt")); for (File file : files) { assertFalse(file.exists()); } // do the sync p4.getLatest(); // re-check assertTrue(files.get(0).exists()); assertTrue(files.get(1).exists()); assertFalse(files.get(2).exists()); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testIsLatest() throws ConfigurationManagementException { try { // sync files and ensure all are at the latest revision p4.getLatest(); Map<File, Boolean> latest = p4 .isLatest(Collections.singletonList(new File(TESTDIR .getAbsolutePath() + "/Main"))); for (File file : latest.keySet()) { assertTrue(latest.get(file)); } // edit a file and commit the change List<File> file = new ArrayList<>(); file.add(new File(TESTDIR.getAbsolutePath() + "/Main/file-1.txt")); p4.checkout(file); FileWriter writer = new FileWriter(file.get(0)); writer.append("Adding some content.\n"); writer.close(); p4.checkin(file, "Checking in edit"); // force checkout of the previous revision IFileSpec spec = new FileSpec(file.get(0).getAbsolutePath()); int revisionNumber = 1; spec.setEndRevision(revisionNumber); spec.setStartToRev(revisionNumber); spec.setWorkRev(revisionNumber); spec.setStartFromRev(revisionNumber); spec.setEndFromRev(revisionNumber); spec.setStartToRev(revisionNumber); spec.setEndToRev(revisionNumber); spec.setStartRevision(revisionNumber); spec.setBaseRev(revisionNumber); p4.checkoutBySpec(Collections.singletonList(spec)); // edit a file locally File file2 = new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt"); p4.checkout(Collections.singletonList(file2)); writer = new FileWriter(file2); writer.append("Editing!\n"); writer.close(); // ensure all are latest except the ones we edited latest = p4.isLatest(Collections.singletonList(new File(TESTDIR .getAbsolutePath() + "/Main"))); for (File f : latest.keySet()) { String path = f.getAbsolutePath(); if (path.endsWith("/file-1.txt") || path.endsWith("/file-2.txt")) { assertFalse(latest.get(f)); } else { assertTrue(latest.get(f)); } } } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testUpdate() throws ConfigurationManagementException { try { // sync the depot p4.getLatest(); // force checkout of the previous revision File file = new File(TESTDIR.getAbsolutePath() + "/Main/file-9.txt"); int currentRev = getCurrentRevision(file); int revisionNumber = 1; List<IFileSpec> specs = (List<IFileSpec>) p4.toSpec(file); IFileSpec spec = specs.get(0); spec.setEndRevision(revisionNumber); spec.setStartToRev(revisionNumber); spec.setWorkRev(revisionNumber); spec.setStartFromRev(revisionNumber); spec.setEndFromRev(revisionNumber); spec.setStartToRev(revisionNumber); spec.setEndToRev(revisionNumber); spec.setStartRevision(revisionNumber); spec.setBaseRev(revisionNumber); p4.checkoutBySpec(Collections.singletonList(spec)); // ensure revision is accurate assertEquals(revisionNumber, getCurrentRevision(file)); // now call update on that file p4.update(file); // check revision assertEquals(currentRev, getCurrentRevision(file)); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } private int getCurrentRevision(File file) { try { Map<File, FileState> states = p4.getFileState(Collections .singletonList(file)); if (states.containsKey(file)) { String revision = states.get(file).getRevision() .getStringRepresentation(); if (revision.contains("/")) { revision = revision.replace( revision.substring(revision.indexOf("/")), ""); } return Integer.parseInt(revision); } } catch (Exception e) { } return -1; } @Test public void testGetRevision() throws ConfigurationManagementException { try { // sync current depot p4.getLatest(); // build a revision map to check out revision 1 of all files List<File> root = Collections.singletonList(new File(p4.getClient() .getRoot())); Map<File, FileState> states = p4.getFileState(root); Map<File, Revision> revisions = new HashMap<>(); for (File file : states.keySet()) { revisions.put(file, new IntegerRevision(1)); } // call the getRevision function to get revision 1 of all files p4.getRevision(revisions); // ensure all files are now revision 1 Map<File, FileState> newStates = p4.getFileState(root); for (File file : newStates.keySet()) { assertEquals(1, getCurrentRevision(file)); } } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test @Ignore public void testGetStateForAllKnownFilesRecursively() throws ConfigurationManagementException { // already tested in BasicTests class } @Test public void testExport() throws ConfigurationManagementException { try { // choose an existing file, edit it and commit p4.getLatest(); File file = new File(TESTDIR.getAbsolutePath() + "/Main/file-9.txt"); List<File> fileAsList = Collections.singletonList(file); int originalRev = getCurrentRevision(file); String hash = md5sum(file); p4.checkout(fileAsList); FileWriter writer = new FileWriter(file); writer.append("Appended data"); writer.close(); p4.checkin(fileAsList, "Appending data"); // now export our previous version to a new file File newFile = new File(TESTDIR.getAbsolutePath() + "/testfile.txt"); Map<File, Revision> fromMap = new HashMap<>(); Map<File, File> toMap = new HashMap<>(); fromMap.put(file, new IntegerRevision(originalRev)); toMap.put(file, newFile); p4.export(fromMap, toMap); // check that the hashes of the unmodified original and the one we // just exported match assertEquals(hash, md5sum(newFile)); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testAddTagRecursively() throws ConfigurationManagementException { p4.addTagRecursively(TESTDIR, "recursive", "Adding recursive tag"); Collection<String> tags = p4.getTags(TESTDIR); assertTrue(tags.contains("recursive")); tags = p4.getTags(new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt")); assertTrue(tags.contains("recursive")); assertFalse(tags.contains("tag1")); } @Test public void testAddTag() throws ConfigurationManagementException { File file = new File(TESTDIR.getAbsolutePath() + "/Main/file-23.txt"); List<File> files = new ArrayList<>(); files.add(file); p4.addTag(files, "tag1", "Adding tag1"); Collection<String> tags = p4.getTags(file); assertTrue(tags.contains("tag1")); // NOTE: Also tested in BasicTest class } @Test public void testDoTagsNeedComments() throws ConfigurationManagementException { assertFalse(p4.doTagsNeedComments()); } @Test public void testCanCommitEmpty() throws ConfigurationManagementException { assertFalse(p4.canCommitEmpty()); } @Test @Ignore public void testGetTags() throws ConfigurationManagementException { // tested via addTags and addTagsRecursively above } @Test public void testListRevisions() throws ConfigurationManagementException { p4.getLatest(); List<Revision> revisions = (List<Revision>) p4.listRevisions(new File( TESTDIR + "/Main/file-22.txt")); assertEquals("3", revisions.get(0).getStringRepresentation()); assertEquals("2", revisions.get(1).getStringRepresentation()); assertEquals("1", revisions.get(2).getStringRepresentation()); Map<String, String> revisionInfo = revisions.get(0).getRevisionInfo(); assertEquals("jenkins", revisionInfo.get("User")); assertEquals("Delta: 7", revisionInfo.get("Description")); } @Test public void testIsStored() throws ConfigurationManagementException { try { p4.getLatest(); Map<File, Boolean> stored = p4.isStored(Collections .singletonList(TESTDIR)); assertTrue(stored.containsKey(new File(TESTDIR.getAbsolutePath() + "/Main/file-22.txt"))); assertFalse(stored.containsKey(new File(TESTDIR.getAbsolutePath() + "/Main/file-222.txt"))); // add a new file Collection<File> files = createAndGenerateFiles(new String[] { "Main/foo.txt" }); p4.add(files); p4.checkin(files, "Adding files"); File file = new File(TESTDIR.getAbsolutePath() + "/Main/foo.txt"); stored = p4.isStored(Collections.singletonList(file)); assertTrue(stored.containsKey(file)); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testRemoveTagByFiles() throws ConfigurationManagementException { p4.getLatest(); p4.addTagRecursively(TESTDIR, "recursive", "Adding recursive tag"); Collection<String> tags = p4.getTags(TESTDIR); assertTrue(tags.contains("recursive")); tags = p4.getTags(new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt")); assertTrue(tags.contains("recursive")); assertFalse(tags.contains("tag1")); // remove tag from file-2.txt p4.removeTag( Collections.singletonList(new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt")), "recursive", "Removing recursive tag"); tags = p4.getTags(new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt")); assertFalse(tags.contains("recursive")); } @Test public void testRemoveTagByName() throws ConfigurationManagementException { p4.getLatest(); p4.addTagRecursively(TESTDIR, "recursive", "Adding recursive tag"); Collection<String> tags = p4.getTags(TESTDIR); assertTrue(tags.contains("recursive")); tags = p4 .getTags(new File(TESTDIR.getAbsolutePath() + "/Main/TPI-83/")); assertTrue(tags.contains("recursive")); assertFalse(tags.contains("tag1")); p4.removeTag("recursive", "Removing recursive", TESTDIR); tags = p4.getTags(new File(TESTDIR.getAbsolutePath() + "/Main/file-2.txt")); assertFalse(tags.contains("recursive")); } @Test public void testGetRevisionCausingConflict() throws ConfigurationManagementException { try { // sync both workspaces p4.getLatest(); conflictP4.getLatest(); // edit files in both, and submit in the first workspace File file1 = new File(TESTDIR.getAbsolutePath() + "/Main/file-3.txt"); File file2 = new File(TESTDIR2.getAbsolutePath() + "/Main/file-3.txt"); // save the current revision number int revision = getCurrentRevision(file1); List<File> firstWs = Collections.singletonList(file1); List<File> conflictWs = Collections.singletonList(file2); p4.checkout(firstWs); conflictP4.checkout(conflictWs); appendToFile(file1, "Some string"); appendToFile(file2, "Some other string"); p4.checkin(firstWs, "Checking in first WS."); // we now have a conflict on this file in the second workspace Revision conflicted = conflictP4.getRevisionCausingConflict(file2); assertEquals(revision, Integer.parseInt(conflicted.getStringRepresentation())); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } private void appendToFile(File file, String append) throws IOException { FileWriter writer = new FileWriter(file); writer.append(append); writer.close(); } @Test public void testResolveConflict() throws ConfigurationManagementException { try { // sync both workspaces p4.getLatest(); conflictP4.getLatest(); // edit files in both, and submit in the first workspace File file1 = new File(TESTDIR.getAbsolutePath() + "/Main/file-3.txt"); File file2 = new File(TESTDIR2.getAbsolutePath() + "/Main/file-3.txt"); // save the current revision number int revision = getCurrentRevision(file1); List<File> firstWs = Collections.singletonList(file1); List<File> conflictWs = Collections.singletonList(file2); p4.checkout(firstWs); conflictP4.checkout(conflictWs); appendToFile(file1, "Some string"); appendToFile(file2, "Some other string"); p4.checkin(firstWs, "Checking in first WS."); p4.submitCurrent(); // we now have a conflict on this file in the second workspace conflictP4.getFileState(conflictWs); Revision conflicted = conflictP4.getRevisionCausingConflict(file2); assertEquals(revision, Integer.parseInt(conflicted.getStringRepresentation())); // conflict upon submit attempt try { conflictP4.submitCurrent(); } catch (Exception e) { assertTrue(e.getMessage().contains( "use 'resolve' to merge files")); } appendToFile(file2, "Some string"); conflictP4.resolveConflict(file2); conflictP4.submitCurrent(); p4.getLatest(); int rev = getCurrentRevision(file1); assertEquals(revision + 2, rev); } catch (Exception e) { e.printStackTrace(); throw new ConfigurationManagementException(e); } } @Test public void testGetForbiddenFilenames() throws ConfigurationManagementException { assertTrue(isForbidden(".p4config")); assertTrue(isForbidden(".p4ignore")); assertTrue(isForbidden(".p4rc")); } private boolean isForbidden(String filename) { for (String regex : p4.getForbiddenFileNames()) { if (filename.matches(regex)) { return true; } } return false; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 11899 | Paul Allen | Inprogress development - moved work to branch | ||
#1 | 11898 | Paul Allen |
Populate -o //guest/perforce_software/p4sl/main/... //guest/paul_allen/p4sl/.... |
||
//guest/perforce_software/p4sl/main/src/test/java/com/perforce/p4simulink/test/OverrideTests.java | |||||
#6 | 11681 | Paul Allen |
Fixes to unit tests. - Fixed paths for testMove in OverrideTests - Removed adding of target before a move. - Closing of resources; writer - Added missing serialisation ID - removed unused variables. |
||
#5 | 11672 | Paul Allen |
Tidy up formatting and imports. No functional change. |
||
#4 | 11661 | Paul Allen |
Finishing up unit tests. Transferred from p4://perforce.perforce.com:1666@985194 |
||
#3 | 11660 | Paul Allen |
Add more unit tests. Transferred from p4://perforce.perforce.com:1666@984334 |
||
#2 | 11658 | Paul Allen |
Additional unit/functional tests. Transferred from p4://perforce.perforce.com:1666@980860 |
||
#1 | 11654 | Paul Allen |
Additional unit tests for @Override methods, refactored test classes. Transferred from p4://perforce.perforce.com:1666@976891 |