1 package org.apache.archiva.proxy;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import net.sf.ehcache.CacheManager;
23 import org.apache.archiva.admin.model.beans.ManagedRepository;
24 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
25 import org.apache.archiva.admin.repository.managed.DefaultManagedRepositoryAdmin;
26 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
27 import org.apache.archiva.configuration.ArchivaConfiguration;
28 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
29 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
30 import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
31 import org.apache.archiva.policies.CachedFailuresPolicy;
32 import org.apache.archiva.policies.ChecksumPolicy;
33 import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
34 import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
35 import org.apache.archiva.policies.ReleasesPolicy;
36 import org.apache.archiva.policies.SnapshotsPolicy;
37 import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
38 import org.apache.archiva.repository.ManagedRepositoryContent;
39 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
40 import org.apache.commons.io.FileUtils;
41 import org.apache.maven.index.NexusIndexer;
42 import org.apache.maven.index.context.IndexingContext;
43 import org.apache.maven.wagon.Wagon;
44 import org.easymock.EasyMock;
45 import org.easymock.IMocksControl;
46 import org.junit.After;
47 import org.junit.Before;
48 import org.junit.runner.RunWith;
49 import org.slf4j.Logger;
50 import org.slf4j.LoggerFactory;
51 import org.springframework.context.ApplicationContext;
52 import org.springframework.test.context.ContextConfiguration;
54 import javax.inject.Inject;
55 import java.io.BufferedReader;
57 import java.io.FileReader;
58 import java.io.IOException;
59 import java.nio.charset.Charset;
60 import java.text.ParseException;
61 import java.text.SimpleDateFormat;
62 import java.util.ArrayList;
63 import java.util.Calendar;
64 import java.util.Collection;
65 import java.util.Date;
66 import java.util.Locale;
68 import static org.junit.Assert.*;
71 * AbstractProxyTestCase
73 @RunWith ( ArchivaSpringJUnit4ClassRunner.class )
74 @ContextConfiguration ( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
75 public abstract class AbstractProxyTestCase
78 protected ApplicationContext applicationContext;
80 protected static final String ID_LEGACY_PROXIED = "legacy-proxied";
82 protected static final String ID_PROXIED1 = "proxied1";
84 protected static final String ID_PROXIED1_TARGET = "proxied1-target";
86 protected static final String ID_PROXIED2 = "proxied2";
88 protected static final String ID_PROXIED2_TARGET = "proxied2-target";
90 protected static final String ID_DEFAULT_MANAGED = "default-managed-repository";
92 protected static final String ID_LEGACY_MANAGED = "legacy-managed-repository";
94 protected static final String REPOPATH_PROXIED_LEGACY = "src/test/repositories/legacy-proxied";
96 protected static final String REPOPATH_PROXIED1 = "src/test/repositories/proxied1";
98 protected static final String REPOPATH_PROXIED1_TARGET = "target/test-repository/proxied1";
100 protected static final String REPOPATH_PROXIED2 = "src/test/repositories/proxied2";
102 protected static final String REPOPATH_PROXIED2_TARGET = "target/test-repository/proxied2";
104 protected static final String REPOPATH_DEFAULT_MANAGED = "src/test/repositories/managed";
106 // protected static final String REPOPATH_DEFAULT_MANAGED_TARGET = "target/test-repository/managed";
108 protected static final String REPOPATH_LEGACY_MANAGED = "src/test/repositories/legacy-managed";
110 protected static final String REPOPATH_LEGACY_MANAGED_TARGET = "target/test-repository/legacy-managed";
112 protected IMocksControl wagonMockControl;
114 protected Wagon wagonMock;
117 protected RepositoryProxyConnectors proxyHandler;
119 protected ManagedRepositoryContent managedDefaultRepository;
121 protected File managedDefaultDir;
123 protected ManagedRepositoryContent managedLegacyRepository;
125 protected File managedLegacyDir;
127 protected MockConfiguration config;
129 protected Logger log = LoggerFactory.getLogger( getClass() );
131 WagonDelegate delegate;
134 protected ManagedRepositoryAdmin managedRepositoryAdmin;
137 protected PlexusSisuBridge plexusSisuBridge;
144 (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
146 config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
147 config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
148 config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
150 // Setup source repository (using default layout)
151 String name = getClass().getSimpleName();
152 String repoPath = "target/test-repository/managed/" + name;
153 File repoLocation = new File( repoPath );
155 managedDefaultRepository =
156 createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
158 managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() );
160 ManagedRepository repoConfig = managedDefaultRepository.getRepository();
162 ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
163 ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
165 applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
167 // to prevent windauze file leaking
168 removeMavenIndexes();
170 // Setup source repository (using legacy layout)
171 repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET );
172 if ( repoLocation.exists() )
174 FileUtils.deleteDirectory( repoLocation );
176 copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation );
178 managedLegacyRepository =
179 createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
182 managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
184 repoConfig = managedLegacyRepository.getRepository();
186 applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
188 // Setup target (proxied to) repository.
189 saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
190 new File( REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
192 // Setup target (proxied to) repository.
193 saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
194 new File( REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
196 // Setup target (proxied to) repository using legacy layout.
197 saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository",
198 new File( REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
200 // Setup the proxy handler.
201 //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
203 proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
205 // Setup the wagon mock.
206 wagonMockControl = EasyMock.createNiceControl( );
207 wagonMock = wagonMockControl.createMock( Wagon.class );
209 delegate = (WagonDelegate) applicationContext.getBean( "wagon#test", Wagon.class );
211 delegate.setDelegate( wagonMock );
213 CacheManager.getInstance().clearAll();
215 log.info( "\n.\\ {}() \\._________________________________________\n", name );
219 public void shutdown()
222 removeMavenIndexes();
226 protected void removeMavenIndexes()
229 NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
231 for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
233 nexusIndexer.removeIndexingContext( indexingContext, false );
238 protected static final ArgumentsMatcher customWagonGetIfNewerMatcher = new ArgumentsMatcher()
241 public boolean matches( Object[] expected, Object[] actual )
243 if ( expected.length < 1 || actual.length < 1 )
247 return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ),
248 ArrayUtils.remove( actual, 1 ) );
251 public String toString( Object[] arguments )
253 return ArrayUtils.toString( arguments );
257 protected static final ArgumentsMatcher customWagonGetMatcher = new ArgumentsMatcher()
260 public boolean matches( Object[] expected, Object[] actual )
262 if ( expected.length == 2 && actual.length == 2 )
264 if ( expected[0] == null && actual[0] == null )
269 if ( expected[0] == null )
271 return actual[0] == null;
274 if ( actual[0] == null )
276 return expected[0] == null;
279 return expected[0].equals( actual[0] );
284 public String toString( Object[] arguments )
286 return ArrayUtils.toString( arguments );
291 protected void assertChecksums( File expectedFile, String expectedSha1Contents, String expectedMd5Contents )
294 File sha1File = new File( expectedFile.getAbsolutePath() + ".sha1" );
295 File md5File = new File( expectedFile.getAbsolutePath() + ".md5" );
297 if ( expectedSha1Contents == null )
299 assertFalse( "SHA1 File should NOT exist: " + sha1File.getPath(), sha1File.exists() );
303 assertTrue( "SHA1 File should exist: " + sha1File.getPath(), sha1File.exists() );
304 String actualSha1Contents = readChecksumFile( sha1File );
305 assertEquals( "SHA1 File contents: " + sha1File.getPath(), expectedSha1Contents, actualSha1Contents );
308 if ( expectedMd5Contents == null )
310 assertFalse( "MD5 File should NOT exist: " + md5File.getPath(), md5File.exists() );
314 assertTrue( "MD5 File should exist: " + md5File.getPath(), md5File.exists() );
315 String actualMd5Contents = readChecksumFile( md5File );
316 assertEquals( "MD5 File contents: " + md5File.getPath(), expectedMd5Contents, actualMd5Contents );
320 protected void assertFileEquals( File expectedFile, File actualFile, File sourceFile )
323 assertNotNull( "Expected File should not be null.", expectedFile );
324 assertNotNull( "Actual File should not be null.", actualFile );
326 assertTrue( "Check actual file exists.", actualFile.exists() );
327 assertEquals( "Check filename path is appropriate.", expectedFile.getCanonicalPath(),
328 actualFile.getCanonicalPath() );
329 assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), actualFile.getAbsolutePath() );
331 String expectedContents =
332 org.apache.commons.io.FileUtils.readFileToString( sourceFile, Charset.defaultCharset() );
333 String actualContents =
334 org.apache.commons.io.FileUtils.readFileToString( actualFile, Charset.defaultCharset() );
335 assertEquals( "Check file contents.", expectedContents, actualContents );
338 protected void assertNotDownloaded( File downloadedFile )
340 assertNull( "Found file: " + downloadedFile + "; but was expecting a failure", downloadedFile );
343 @SuppressWarnings ( "unchecked" )
344 protected void assertNoTempFiles( File expectedFile )
346 File workingDir = expectedFile.getParentFile();
347 if ( ( workingDir == null ) || !workingDir.isDirectory() )
352 Collection<File> tmpFiles =
353 org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{ "tmp" }, false );
354 if ( !tmpFiles.isEmpty() )
356 StringBuilder emsg = new StringBuilder();
357 emsg.append( "Found Temp Files in dir: " ).append( workingDir.getPath() );
358 for ( File tfile : tmpFiles )
360 emsg.append( "\n " ).append( tfile.getName() );
362 fail( emsg.toString() );
367 * A faster recursive copy that omits .svn directories.
369 * @param sourceDirectory the source directory to copy
370 * @param destDirectory the target location
371 * @throws java.io.IOException if there is a copying problem
372 * @todo get back into plexus-utils, share with converter module
374 protected void copyDirectoryStructure( File sourceDirectory, File destDirectory )
377 if ( !sourceDirectory.exists() )
379 throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." );
382 File[] files = sourceDirectory.listFiles();
384 String sourcePath = sourceDirectory.getAbsolutePath();
386 for ( int i = 0; i < files.length; i++ )
388 File file = files[i];
390 String dest = file.getAbsolutePath();
392 dest = dest.substring( sourcePath.length() + 1 );
394 File destination = new File( destDirectory, dest );
398 destination = destination.getParentFile();
400 org.apache.commons.io.FileUtils.copyFile( file, new File( destination, file.getName() ), false );
401 // TODO: Change when there is a FileUtils.copyFileToDirectory(file, destination, boolean) option
402 //FileUtils.copyFileToDirectory( file, destination );
404 else if ( file.isDirectory() )
406 if ( !".svn".equals( file.getName() ) )
408 if ( !destination.exists() && !destination.mkdirs() )
410 throw new IOException(
411 "Could not create destination directory '" + destination.getAbsolutePath() + "'." );
414 copyDirectoryStructure( file, destination );
419 throw new IOException( "Unknown file type: " + file.getAbsolutePath() );
424 protected ManagedRepositoryContent createManagedLegacyRepository()
427 return createRepository( "testManagedLegacyRepo", "Test Managed (Legacy) Repository",
428 "src/test/repositories/legacy-managed", "legacy" );
431 protected ManagedRepositoryContent createProxiedLegacyRepository()
434 return createRepository( "testProxiedLegacyRepo", "Test Proxied (Legacy) Repository",
435 "src/test/repositories/legacy-proxied", "legacy" );
438 protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
441 ManagedRepository repo = new ManagedRepository();
443 repo.setName( name );
444 repo.setLocation( path );
445 repo.setLayout( layout );
447 ManagedRepositoryContent repoContent =
448 applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
449 repoContent.setRepository( repo );
454 * Read the first line from the checksum file, and return it (trimmed).
456 protected String readChecksumFile( File checksumFile )
459 FileReader freader = null;
460 BufferedReader buf = null;
464 freader = new FileReader( checksumFile );
465 buf = new BufferedReader( freader );
466 return buf.readLine();
475 if ( freader != null )
482 protected void saveConnector( String sourceRepoId, String targetRepoId, boolean disabled )
484 saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS,
485 CachedFailuresPolicy.NO, disabled );
488 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
489 String snapshotPolicy, String cacheFailuresPolicy, boolean disabled )
491 saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
492 PropagateErrorsDownloadPolicy.QUEUE, disabled );
495 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
496 String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
499 saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
500 errorPolicy, PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT, disabled );
503 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
504 String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
505 String errorOnUpdatePolicy, boolean disabled )
507 ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration();
508 connectorConfig.setSourceRepoId( sourceRepoId );
509 connectorConfig.setTargetRepoId( targetRepoId );
510 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, checksumPolicy );
511 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, releasePolicy );
512 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, snapshotPolicy );
513 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, cacheFailuresPolicy );
514 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS, errorPolicy );
515 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS_ON_UPDATE, errorOnUpdatePolicy );
516 connectorConfig.setDisabled( disabled );
518 int count = config.getConfiguration().getProxyConnectors().size();
519 config.getConfiguration().addProxyConnector( connectorConfig );
521 // Proper Triggering ...
522 String prefix = "proxyConnectors.proxyConnector(" + count + ")";
523 config.triggerChange( prefix + ".sourceRepoId", connectorConfig.getSourceRepoId() );
524 config.triggerChange( prefix + ".targetRepoId", connectorConfig.getTargetRepoId() );
525 config.triggerChange( prefix + ".proxyId", connectorConfig.getProxyId() );
526 config.triggerChange( prefix + ".policies.releases", connectorConfig.getPolicy( "releases", "" ) );
527 config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) );
528 config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) );
529 config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
530 config.triggerChange( prefix + ".policies.propagate-errors",
531 connectorConfig.getPolicy( "propagate-errors", "" ) );
532 config.triggerChange( prefix + ".policies.propagate-errors-on-update",
533 connectorConfig.getPolicy( "propagate-errors-on-update", "" ) );
536 protected void saveManagedRepositoryConfig( String id, String name, String path, String layout )
538 ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
540 repoConfig.setId( id );
541 repoConfig.setName( name );
542 repoConfig.setLayout( layout );
544 repoConfig.setLocation( path );
546 int count = config.getConfiguration().getManagedRepositories().size();
547 config.getConfiguration().addManagedRepository( repoConfig );
549 String prefix = "managedRepositories.managedRepository(" + count + ")";
550 config.triggerChange( prefix + ".id", repoConfig.getId() );
551 config.triggerChange( prefix + ".name", repoConfig.getName() );
552 config.triggerChange( prefix + ".location", repoConfig.getLocation() );
553 config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
556 protected void saveRemoteRepositoryConfig( String id, String name, String url, String layout )
558 RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
560 repoConfig.setId( id );
561 repoConfig.setName( name );
562 repoConfig.setLayout( layout );
563 repoConfig.setUrl( url );
565 int count = config.getConfiguration().getRemoteRepositories().size();
566 config.getConfiguration().addRemoteRepository( repoConfig );
568 String prefix = "remoteRepositories.remoteRepository(" + count + ")";
569 config.triggerChange( prefix + ".id", repoConfig.getId() );
570 config.triggerChange( prefix + ".name", repoConfig.getName() );
571 config.triggerChange( prefix + ".url", repoConfig.getUrl() );
572 config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
575 protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )
578 File repoLocation = new File( targetPath );
579 FileUtils.deleteDirectory( repoLocation );
580 copyDirectoryStructure( new File( originalPath ), repoLocation );
582 saveRemoteRepositoryConfig( id, "Target Repo-" + id, targetPath, layout );
589 * Copy the specified resource directory from the src/test/repository/managed/ to
590 * the testable directory under target/test-repository/managed/${testName}/
592 * @param resourcePath
593 * @throws IOException
595 protected void setupTestableManagedRepository( String resourcePath )
598 String resourceDir = resourcePath;
600 if ( !resourcePath.endsWith( "/" ) )
602 int idx = resourcePath.lastIndexOf( '/' );
603 resourceDir = resourcePath.substring( 0, idx );
606 File sourceRepoDir = new File( REPOPATH_DEFAULT_MANAGED );
607 File sourceDir = new File( sourceRepoDir, resourceDir );
609 File destRepoDir = managedDefaultDir;
610 File destDir = new File( destRepoDir, resourceDir );
612 // Cleanout destination dirs.
613 if ( destDir.exists() )
615 FileUtils.deleteDirectory( destDir );
618 // Make the destination dir.
621 // Test the source dir.
622 if ( !sourceDir.exists() )
624 // This is just a warning.
626 "[WARN] Skipping setup of testable managed repository, source dir does not exist: " + sourceDir );
631 // Test that the source is a dir.
632 if ( !sourceDir.isDirectory() )
634 fail( "Unable to setup testable managed repository, source is not a directory: " + sourceDir );
637 // Copy directory structure.
638 copyDirectoryStructure( sourceDir, destDir );
642 protected void setManagedNewerThanRemote( File managedFile, File remoteFile )
644 setManagedNewerThanRemote( managedFile, remoteFile, 55000 );
647 protected void setManagedNewerThanRemote( File managedFile, File remoteFile, long time )
649 assertTrue( "Managed File should exist: ", managedFile.exists() );
650 assertTrue( "Remote File should exist: ", remoteFile.exists() );
652 managedFile.setLastModified( remoteFile.lastModified() + time );
654 assertTrue( managedFile.lastModified() > remoteFile.lastModified() );
657 protected void setManagedOlderThanRemote( File managedFile, File remoteFile )
659 setManagedOlderThanRemote( managedFile, remoteFile, 55000 );
662 protected void setManagedOlderThanRemote( File managedFile, File remoteFile, long time )
664 assertTrue( "Managed File should exist: ", managedFile.exists() );
665 assertTrue( "Remote File should exist: ", remoteFile.exists() );
667 managedFile.setLastModified( remoteFile.lastModified() - time );
669 assertTrue( managedFile.lastModified() < remoteFile.lastModified() );
673 protected void assertNotModified( File file, long expectedModificationTime )
675 assertEquals( "File <" + file.getAbsolutePath() + "> not have been modified.", expectedModificationTime,
676 file.lastModified() );
679 protected void assertNotExistsInManagedLegacyRepo( File file )
682 String managedLegacyPath = managedLegacyDir.getCanonicalPath();
683 String testFile = file.getCanonicalPath();
686 "Unit Test Failure: File <" + testFile + "> should be have been defined within the legacy managed path of <"
687 + managedLegacyPath + ">", testFile.startsWith( managedLegacyPath ) );
689 assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() );
692 protected void assertNotExistsInManagedDefaultRepo( File file )
695 String managedDefaultPath = managedDefaultDir.getCanonicalPath();
696 String testFile = file.getCanonicalPath();
698 assertTrue( "Unit Test Failure: File <" + testFile
699 + "> should be have been defined within the managed default path of <" + managedDefaultPath
700 + ">", testFile.startsWith( managedDefaultPath ) );
702 assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() );
705 protected static Date getFutureDate()
706 throws ParseException
708 Calendar cal = Calendar.getInstance();
709 cal.add( Calendar.YEAR, 1 );
710 return cal.getTime();
713 protected static Date getPastDate()
714 throws ParseException
716 return new SimpleDateFormat( "yyyy-MM-dd", Locale.US ).parse( "2000-01-01" );