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.repository.ManagedRepositoryContent;
38 import org.apache.commons.io.FileUtils;
39 import org.apache.commons.lang.ArrayUtils;
40 import org.apache.maven.index.NexusIndexer;
41 import org.apache.maven.index.context.IndexingContext;
42 import org.apache.maven.wagon.Wagon;
43 import org.easymock.ArgumentsMatcher;
44 import org.easymock.MockControl;
45 import org.junit.After;
46 import org.junit.Before;
47 import org.junit.runner.RunWith;
48 import org.slf4j.Logger;
49 import org.slf4j.LoggerFactory;
50 import org.springframework.context.ApplicationContext;
51 import org.springframework.test.context.ContextConfiguration;
53 import javax.inject.Inject;
54 import java.io.BufferedReader;
56 import java.io.FileReader;
57 import java.io.IOException;
58 import java.text.ParseException;
59 import java.text.SimpleDateFormat;
60 import java.util.ArrayList;
61 import java.util.Calendar;
62 import java.util.Collection;
63 import java.util.Date;
64 import java.util.Locale;
65 import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
67 import static org.junit.Assert.*;
70 * AbstractProxyTestCase
74 @RunWith( ArchivaSpringJUnit4ClassRunner.class )
75 @ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath:/spring-context.xml" } )
76 public abstract class AbstractProxyTestCase
79 protected ApplicationContext applicationContext;
81 protected static final String ID_LEGACY_PROXIED = "legacy-proxied";
83 protected static final String ID_PROXIED1 = "proxied1";
85 protected static final String ID_PROXIED1_TARGET = "proxied1-target";
87 protected static final String ID_PROXIED2 = "proxied2";
89 protected static final String ID_PROXIED2_TARGET = "proxied2-target";
91 protected static final String ID_DEFAULT_MANAGED = "default-managed-repository";
93 protected static final String ID_LEGACY_MANAGED = "legacy-managed-repository";
95 protected static final String REPOPATH_PROXIED_LEGACY = "src/test/repositories/legacy-proxied";
97 protected static final String REPOPATH_PROXIED1 = "src/test/repositories/proxied1";
99 protected static final String REPOPATH_PROXIED1_TARGET = "target/test-repository/proxied1";
101 protected static final String REPOPATH_PROXIED2 = "src/test/repositories/proxied2";
103 protected static final String REPOPATH_PROXIED2_TARGET = "target/test-repository/proxied2";
105 protected static final String REPOPATH_DEFAULT_MANAGED = "src/test/repositories/managed";
107 // protected static final String REPOPATH_DEFAULT_MANAGED_TARGET = "target/test-repository/managed";
109 protected static final String REPOPATH_LEGACY_MANAGED = "src/test/repositories/legacy-managed";
111 protected static final String REPOPATH_LEGACY_MANAGED_TARGET = "target/test-repository/legacy-managed";
113 protected MockControl wagonMockControl;
115 protected Wagon wagonMock;
118 protected RepositoryProxyConnectors proxyHandler;
120 protected ManagedRepositoryContent managedDefaultRepository;
122 protected File managedDefaultDir;
124 protected ManagedRepositoryContent managedLegacyRepository;
126 protected File managedLegacyDir;
128 protected MockConfiguration config;
130 protected Logger log = LoggerFactory.getLogger( getClass() );
132 WagonDelegate delegate;
135 protected ManagedRepositoryAdmin managedRepositoryAdmin;
138 protected PlexusSisuBridge plexusSisuBridge;
145 (MockConfiguration) applicationContext.getBean( "archivaConfiguration#mock", ArchivaConfiguration.class );
147 config.getConfiguration().setManagedRepositories( new ArrayList<ManagedRepositoryConfiguration>() );
148 config.getConfiguration().setRemoteRepositories( new ArrayList<RemoteRepositoryConfiguration>() );
149 config.getConfiguration().setProxyConnectors( new ArrayList<ProxyConnectorConfiguration>() );
151 // Setup source repository (using default layout)
152 String name = getClass().getSimpleName();
153 String repoPath = "target/test-repository/managed/" + name;
154 File repoLocation = new File( repoPath );
156 managedDefaultRepository =
157 createRepository( ID_DEFAULT_MANAGED, "Default Managed Repository", repoPath, "default" );
159 managedDefaultDir = new File( managedDefaultRepository.getRepoRoot() );
161 ManagedRepository repoConfig = managedDefaultRepository.getRepository();
163 ( (DefaultManagedRepositoryAdmin) applicationContext.getBean(
164 ManagedRepositoryAdmin.class ) ).setArchivaConfiguration( config );
166 applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
168 // to prevent windauze file leaking
169 removeMavenIndexes();
171 // Setup source repository (using legacy layout)
172 repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET );
173 if ( repoLocation.exists() )
175 FileUtils.deleteDirectory( repoLocation );
177 copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation );
179 managedLegacyRepository =
180 createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
183 managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
185 repoConfig = managedLegacyRepository.getRepository();
187 //config.getConfiguration().addManagedRepository( repoConfig );
188 applicationContext.getBean( ManagedRepositoryAdmin.class ).addManagedRepository( repoConfig, false, null );
190 // Setup target (proxied to) repository.
191 saveRemoteRepositoryConfig( ID_PROXIED1, "Proxied Repository 1",
192 new File( REPOPATH_PROXIED1 ).toURL().toExternalForm(), "default" );
194 // Setup target (proxied to) repository.
195 saveRemoteRepositoryConfig( ID_PROXIED2, "Proxied Repository 2",
196 new File( REPOPATH_PROXIED2 ).toURL().toExternalForm(), "default" );
198 // Setup target (proxied to) repository using legacy layout.
199 saveRemoteRepositoryConfig( ID_LEGACY_PROXIED, "Proxied Legacy Repository",
200 new File( REPOPATH_PROXIED_LEGACY ).toURL().toExternalForm(), "legacy" );
202 // Setup the proxy handler.
203 //proxyHandler = applicationContext.getBean (RepositoryProxyConnectors) lookup( RepositoryProxyConnectors.class.getName() );
205 proxyHandler = applicationContext.getBean( "repositoryProxyConnectors#test", RepositoryProxyConnectors.class );
207 // Setup the wagon mock.
208 wagonMockControl = MockControl.createNiceControl( Wagon.class );
209 wagonMock = (Wagon) wagonMockControl.getMock();
211 delegate = (WagonDelegate) applicationContext.getBean( "wagon#test", Wagon.class );
213 delegate.setDelegate( wagonMock );
215 CacheManager.getInstance().clearAll();
217 log.info( "\n.\\ " + name + "() \\._________________________________________\n" );
221 public void shutdown()
224 removeMavenIndexes();
228 protected void removeMavenIndexes()
231 NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
233 for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
235 nexusIndexer.removeIndexingContext( indexingContext, false );
240 protected static final ArgumentsMatcher customWagonGetIfNewerMatcher = new ArgumentsMatcher()
243 public boolean matches( Object[] expected, Object[] actual )
245 if ( expected.length < 1 || actual.length < 1 )
249 return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ),
250 ArrayUtils.remove( actual, 1 ) );
253 public String toString( Object[] arguments )
255 return ArrayUtils.toString( arguments );
259 protected static final ArgumentsMatcher customWagonGetMatcher = new ArgumentsMatcher()
262 public boolean matches( Object[] expected, Object[] actual )
264 if ( expected.length == 2 && actual.length == 2 )
266 if ( expected[0] == null && actual[0] == null )
271 if ( expected[0] == null )
273 return actual[0] == null;
276 if ( actual[0] == null )
278 return expected[0] == null;
281 return expected[0].equals( actual[0] );
286 public String toString( Object[] arguments )
288 return ArrayUtils.toString( arguments );
293 protected void assertChecksums( File expectedFile, String expectedSha1Contents, String expectedMd5Contents )
296 File sha1File = new File( expectedFile.getAbsolutePath() + ".sha1" );
297 File md5File = new File( expectedFile.getAbsolutePath() + ".md5" );
299 if ( expectedSha1Contents == null )
301 assertFalse( "SHA1 File should NOT exist: " + sha1File.getPath(), sha1File.exists() );
305 assertTrue( "SHA1 File should exist: " + sha1File.getPath(), sha1File.exists() );
306 String actualSha1Contents = readChecksumFile( sha1File );
307 assertEquals( "SHA1 File contents: " + sha1File.getPath(), expectedSha1Contents, actualSha1Contents );
310 if ( expectedMd5Contents == null )
312 assertFalse( "MD5 File should NOT exist: " + md5File.getPath(), md5File.exists() );
316 assertTrue( "MD5 File should exist: " + md5File.getPath(), md5File.exists() );
317 String actualMd5Contents = readChecksumFile( md5File );
318 assertEquals( "MD5 File contents: " + md5File.getPath(), expectedMd5Contents, actualMd5Contents );
322 protected void assertFileEquals( File expectedFile, File actualFile, File sourceFile )
325 assertNotNull( "Expected File should not be null.", expectedFile );
326 assertNotNull( "Actual File should not be null.", actualFile );
328 assertTrue( "Check actual file exists.", actualFile.exists() );
329 assertEquals( "Check filename path is appropriate.", expectedFile.getCanonicalPath(),
330 actualFile.getCanonicalPath() );
331 assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), actualFile.getAbsolutePath() );
333 String expectedContents = org.apache.commons.io.FileUtils.readFileToString( sourceFile, null );
334 String actualContents = org.apache.commons.io.FileUtils.readFileToString( actualFile, null );
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 StringBuffer emsg = new StringBuffer();
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" );