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.lang.ArrayUtils;
39 import org.apache.maven.index.NexusIndexer;
40 import org.apache.maven.index.context.IndexingContext;
41 import org.apache.maven.wagon.Wagon;
42 import org.codehaus.plexus.util.FileUtils;
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;
52 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
54 import javax.inject.Inject;
55 import java.io.BufferedReader;
57 import java.io.FileReader;
58 import java.io.IOException;
59 import java.text.ParseException;
60 import java.text.SimpleDateFormat;
61 import java.util.ArrayList;
62 import java.util.Calendar;
63 import java.util.Collection;
64 import java.util.Date;
65 import java.util.Locale;
67 import static org.junit.Assert.*;
70 * AbstractProxyTestCase
74 @RunWith( SpringJUnit4ClassRunner.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 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 );
167 //config.getConfiguration().addManagedRepository( repoConfig );
169 // Setup source repository (using legacy layout)
170 repoLocation = new File( REPOPATH_LEGACY_MANAGED_TARGET );
171 if ( repoLocation.exists() )
173 FileUtils.deleteDirectory( repoLocation );
175 copyDirectoryStructure( new File( REPOPATH_LEGACY_MANAGED ), repoLocation );
177 managedLegacyRepository =
178 createRepository( ID_LEGACY_MANAGED, "Legacy Managed Repository", REPOPATH_LEGACY_MANAGED_TARGET,
181 managedLegacyDir = new File( managedLegacyRepository.getRepoRoot() );
183 repoConfig = managedLegacyRepository.getRepository();
185 //config.getConfiguration().addManagedRepository( repoConfig );
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 = MockControl.createNiceControl( Wagon.class );
207 wagonMock = (Wagon) wagonMockControl.getMock();
209 delegate = (WagonDelegate) plexusSisuBridge.lookup( Wagon.class, "test" );
211 delegate.setDelegate( wagonMock );
213 CacheManager.getInstance().clearAll();
215 log.info( "\n.\\ " + name + "() \\._________________________________________\n" );
219 public void shutdown()
222 NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
224 for ( IndexingContext indexingContext : nexusIndexer.getIndexingContexts().values() )
226 nexusIndexer.removeIndexingContext( indexingContext, false );
231 protected static final ArgumentsMatcher customWagonGetIfNewerMatcher = new ArgumentsMatcher()
234 public boolean matches( Object[] expected, Object[] actual )
236 if ( expected.length < 1 || actual.length < 1 )
240 return MockControl.ARRAY_MATCHER.matches( ArrayUtils.remove( expected, 1 ),
241 ArrayUtils.remove( actual, 1 ) );
244 public String toString( Object[] arguments )
246 return ArrayUtils.toString( arguments );
250 protected static final ArgumentsMatcher customWagonGetMatcher = new ArgumentsMatcher()
253 public boolean matches( Object[] expected, Object[] actual )
255 if ( expected.length == 2 && actual.length == 2 )
257 if ( expected[0] == null && actual[0] == null )
262 if ( expected[0] == null )
264 return actual[0] == null;
267 if ( actual[0] == null )
269 return expected[0] == null;
272 return expected[0].equals( actual[0] );
277 public String toString( Object[] arguments )
279 return ArrayUtils.toString( arguments );
284 protected void assertChecksums( File expectedFile, String expectedSha1Contents, String expectedMd5Contents )
287 File sha1File = new File( expectedFile.getAbsolutePath() + ".sha1" );
288 File md5File = new File( expectedFile.getAbsolutePath() + ".md5" );
290 if ( expectedSha1Contents == null )
292 assertFalse( "SHA1 File should NOT exist: " + sha1File.getPath(), sha1File.exists() );
296 assertTrue( "SHA1 File should exist: " + sha1File.getPath(), sha1File.exists() );
297 String actualSha1Contents = readChecksumFile( sha1File );
298 assertEquals( "SHA1 File contents: " + sha1File.getPath(), expectedSha1Contents, actualSha1Contents );
301 if ( expectedMd5Contents == null )
303 assertFalse( "MD5 File should NOT exist: " + md5File.getPath(), md5File.exists() );
307 assertTrue( "MD5 File should exist: " + md5File.getPath(), md5File.exists() );
308 String actualMd5Contents = readChecksumFile( md5File );
309 assertEquals( "MD5 File contents: " + md5File.getPath(), expectedMd5Contents, actualMd5Contents );
313 protected void assertFileEquals( File expectedFile, File actualFile, File sourceFile )
316 assertNotNull( "Expected File should not be null.", expectedFile );
317 assertNotNull( "Actual File should not be null.", actualFile );
319 assertTrue( "Check actual file exists.", actualFile.exists() );
320 assertEquals( "Check filename path is appropriate.", expectedFile.getCanonicalPath(),
321 actualFile.getCanonicalPath() );
322 assertEquals( "Check file path matches.", expectedFile.getAbsolutePath(), actualFile.getAbsolutePath() );
324 String expectedContents = org.apache.commons.io.FileUtils.readFileToString( sourceFile, null );
325 String actualContents = org.apache.commons.io.FileUtils.readFileToString( actualFile, null );
326 assertEquals( "Check file contents.", expectedContents, actualContents );
329 protected void assertNotDownloaded( File downloadedFile )
331 assertNull( "Found file: " + downloadedFile + "; but was expecting a failure", downloadedFile );
334 @SuppressWarnings( "unchecked" )
335 protected void assertNoTempFiles( File expectedFile )
337 File workingDir = expectedFile.getParentFile();
338 if ( ( workingDir == null ) || !workingDir.isDirectory() )
343 Collection<File> tmpFiles =
344 org.apache.commons.io.FileUtils.listFiles( workingDir, new String[]{ "tmp" }, false );
345 if ( !tmpFiles.isEmpty() )
347 StringBuffer emsg = new StringBuffer();
348 emsg.append( "Found Temp Files in dir: " ).append( workingDir.getPath() );
349 for ( File tfile : tmpFiles )
351 emsg.append( "\n " ).append( tfile.getName() );
353 fail( emsg.toString() );
358 * A faster recursive copy that omits .svn directories.
360 * @param sourceDirectory the source directory to copy
361 * @param destDirectory the target location
362 * @throws java.io.IOException if there is a copying problem
363 * @todo get back into plexus-utils, share with converter module
365 protected void copyDirectoryStructure( File sourceDirectory, File destDirectory )
368 if ( !sourceDirectory.exists() )
370 throw new IOException( "Source directory doesn't exists (" + sourceDirectory.getAbsolutePath() + ")." );
373 File[] files = sourceDirectory.listFiles();
375 String sourcePath = sourceDirectory.getAbsolutePath();
377 for ( int i = 0; i < files.length; i++ )
379 File file = files[i];
381 String dest = file.getAbsolutePath();
383 dest = dest.substring( sourcePath.length() + 1 );
385 File destination = new File( destDirectory, dest );
389 destination = destination.getParentFile();
391 org.apache.commons.io.FileUtils.copyFile( file, new File( destination, file.getName() ), false );
392 // TODO: Change when there is a FileUtils.copyFileToDirectory(file, destination, boolean) option
393 //FileUtils.copyFileToDirectory( file, destination );
395 else if ( file.isDirectory() )
397 if ( !".svn".equals( file.getName() ) )
399 if ( !destination.exists() && !destination.mkdirs() )
401 throw new IOException(
402 "Could not create destination directory '" + destination.getAbsolutePath() + "'." );
405 copyDirectoryStructure( file, destination );
410 throw new IOException( "Unknown file type: " + file.getAbsolutePath() );
415 protected ManagedRepositoryContent createManagedLegacyRepository()
418 return createRepository( "testManagedLegacyRepo", "Test Managed (Legacy) Repository",
419 "src/test/repositories/legacy-managed", "legacy" );
422 protected ManagedRepositoryContent createProxiedLegacyRepository()
425 return createRepository( "testProxiedLegacyRepo", "Test Proxied (Legacy) Repository",
426 "src/test/repositories/legacy-proxied", "legacy" );
429 protected ManagedRepositoryContent createRepository( String id, String name, String path, String layout )
432 ManagedRepository repo = new ManagedRepository();
434 repo.setName( name );
435 repo.setLocation( path );
436 repo.setLayout( layout );
438 ManagedRepositoryContent repoContent =
439 applicationContext.getBean( "managedRepositoryContent#" + layout, ManagedRepositoryContent.class );
440 repoContent.setRepository( repo );
445 * Read the first line from the checksum file, and return it (trimmed).
447 protected String readChecksumFile( File checksumFile )
450 FileReader freader = null;
451 BufferedReader buf = null;
455 freader = new FileReader( checksumFile );
456 buf = new BufferedReader( freader );
457 return buf.readLine();
466 if ( freader != null )
473 protected void saveConnector( String sourceRepoId, String targetRepoId, boolean disabled )
475 saveConnector( sourceRepoId, targetRepoId, ChecksumPolicy.IGNORE, ReleasesPolicy.ALWAYS, SnapshotsPolicy.ALWAYS,
476 CachedFailuresPolicy.NO, disabled );
479 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
480 String snapshotPolicy, String cacheFailuresPolicy, boolean disabled )
482 saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
483 PropagateErrorsDownloadPolicy.QUEUE, disabled );
486 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
487 String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
490 saveConnector( sourceRepoId, targetRepoId, checksumPolicy, releasePolicy, snapshotPolicy, cacheFailuresPolicy,
491 errorPolicy, PropagateErrorsOnUpdateDownloadPolicy.NOT_PRESENT, disabled );
494 protected void saveConnector( String sourceRepoId, String targetRepoId, String checksumPolicy, String releasePolicy,
495 String snapshotPolicy, String cacheFailuresPolicy, String errorPolicy,
496 String errorOnUpdatePolicy, boolean disabled )
498 ProxyConnectorConfiguration connectorConfig = new ProxyConnectorConfiguration();
499 connectorConfig.setSourceRepoId( sourceRepoId );
500 connectorConfig.setTargetRepoId( targetRepoId );
501 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CHECKSUM, checksumPolicy );
502 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_RELEASES, releasePolicy );
503 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_SNAPSHOTS, snapshotPolicy );
504 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_CACHE_FAILURES, cacheFailuresPolicy );
505 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS, errorPolicy );
506 connectorConfig.addPolicy( ProxyConnectorConfiguration.POLICY_PROPAGATE_ERRORS_ON_UPDATE, errorOnUpdatePolicy );
507 connectorConfig.setDisabled( disabled );
509 int count = config.getConfiguration().getProxyConnectors().size();
510 config.getConfiguration().addProxyConnector( connectorConfig );
512 // Proper Triggering ...
513 String prefix = "proxyConnectors.proxyConnector(" + count + ")";
514 config.triggerChange( prefix + ".sourceRepoId", connectorConfig.getSourceRepoId() );
515 config.triggerChange( prefix + ".targetRepoId", connectorConfig.getTargetRepoId() );
516 config.triggerChange( prefix + ".proxyId", connectorConfig.getProxyId() );
517 config.triggerChange( prefix + ".policies.releases", connectorConfig.getPolicy( "releases", "" ) );
518 config.triggerChange( prefix + ".policies.checksum", connectorConfig.getPolicy( "checksum", "" ) );
519 config.triggerChange( prefix + ".policies.snapshots", connectorConfig.getPolicy( "snapshots", "" ) );
520 config.triggerChange( prefix + ".policies.cache-failures", connectorConfig.getPolicy( "cache-failures", "" ) );
521 config.triggerChange( prefix + ".policies.propagate-errors",
522 connectorConfig.getPolicy( "propagate-errors", "" ) );
523 config.triggerChange( prefix + ".policies.propagate-errors-on-update",
524 connectorConfig.getPolicy( "propagate-errors-on-update", "" ) );
527 protected void saveManagedRepositoryConfig( String id, String name, String path, String layout )
529 ManagedRepositoryConfiguration repoConfig = new ManagedRepositoryConfiguration();
531 repoConfig.setId( id );
532 repoConfig.setName( name );
533 repoConfig.setLayout( layout );
535 repoConfig.setLocation( path );
537 int count = config.getConfiguration().getManagedRepositories().size();
538 config.getConfiguration().addManagedRepository( repoConfig );
540 String prefix = "managedRepositories.managedRepository(" + count + ")";
541 config.triggerChange( prefix + ".id", repoConfig.getId() );
542 config.triggerChange( prefix + ".name", repoConfig.getName() );
543 config.triggerChange( prefix + ".location", repoConfig.getLocation() );
544 config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
547 protected void saveRemoteRepositoryConfig( String id, String name, String url, String layout )
549 RemoteRepositoryConfiguration repoConfig = new RemoteRepositoryConfiguration();
551 repoConfig.setId( id );
552 repoConfig.setName( name );
553 repoConfig.setLayout( layout );
554 repoConfig.setUrl( url );
556 int count = config.getConfiguration().getRemoteRepositories().size();
557 config.getConfiguration().addRemoteRepository( repoConfig );
559 String prefix = "remoteRepositories.remoteRepository(" + count + ")";
560 config.triggerChange( prefix + ".id", repoConfig.getId() );
561 config.triggerChange( prefix + ".name", repoConfig.getName() );
562 config.triggerChange( prefix + ".url", repoConfig.getUrl() );
563 config.triggerChange( prefix + ".layout", repoConfig.getLayout() );
566 protected File saveTargetedRepositoryConfig( String id, String originalPath, String targetPath, String layout )
569 File repoLocation = new File( targetPath );
570 FileUtils.deleteDirectory( repoLocation );
571 copyDirectoryStructure( new File( originalPath ), repoLocation );
573 saveRemoteRepositoryConfig( id, "Target Repo-" + id, targetPath, layout );
580 * Copy the specified resource directory from the src/test/repository/managed/ to
581 * the testable directory under target/test-repository/managed/${testName}/
583 * @param resourcePath
584 * @throws IOException
586 protected void setupTestableManagedRepository( String resourcePath )
589 String resourceDir = resourcePath;
591 if ( !resourcePath.endsWith( "/" ) )
593 int idx = resourcePath.lastIndexOf( '/' );
594 resourceDir = resourcePath.substring( 0, idx );
597 File sourceRepoDir = new File( REPOPATH_DEFAULT_MANAGED );
598 File sourceDir = new File( sourceRepoDir, resourceDir );
600 File destRepoDir = managedDefaultDir;
601 File destDir = new File( destRepoDir, resourceDir );
603 // Cleanout destination dirs.
604 if ( destDir.exists() )
606 FileUtils.deleteDirectory( destDir );
609 // Make the destination dir.
612 // Test the source dir.
613 if ( !sourceDir.exists() )
615 // This is just a warning.
617 "[WARN] Skipping setup of testable managed repository, source dir does not exist: " + sourceDir );
622 // Test that the source is a dir.
623 if ( !sourceDir.isDirectory() )
625 fail( "Unable to setup testable managed repository, source is not a directory: " + sourceDir );
628 // Copy directory structure.
629 copyDirectoryStructure( sourceDir, destDir );
633 protected void setManagedNewerThanRemote( File managedFile, File remoteFile )
635 setManagedNewerThanRemote( managedFile, remoteFile, 55000 );
638 protected void setManagedNewerThanRemote( File managedFile, File remoteFile, long time )
640 assertTrue( "Managed File should exist: ", managedFile.exists() );
641 assertTrue( "Remote File should exist: ", remoteFile.exists() );
643 managedFile.setLastModified( remoteFile.lastModified() + time );
645 assertTrue( managedFile.lastModified() > remoteFile.lastModified() );
648 protected void setManagedOlderThanRemote( File managedFile, File remoteFile )
650 setManagedOlderThanRemote( managedFile, remoteFile, 55000 );
653 protected void setManagedOlderThanRemote( File managedFile, File remoteFile, long time )
655 assertTrue( "Managed File should exist: ", managedFile.exists() );
656 assertTrue( "Remote File should exist: ", remoteFile.exists() );
658 managedFile.setLastModified( remoteFile.lastModified() - time );
660 assertTrue( managedFile.lastModified() < remoteFile.lastModified() );
664 protected void assertNotModified( File file, long expectedModificationTime )
666 assertEquals( "File <" + file.getAbsolutePath() + "> not have been modified.", expectedModificationTime,
667 file.lastModified() );
670 protected void assertNotExistsInManagedLegacyRepo( File file )
673 String managedLegacyPath = managedLegacyDir.getCanonicalPath();
674 String testFile = file.getCanonicalPath();
677 "Unit Test Failure: File <" + testFile + "> should be have been defined within the legacy managed path of <"
678 + managedLegacyPath + ">", testFile.startsWith( managedLegacyPath ) );
680 assertFalse( "File < " + testFile + "> should not exist in managed legacy repository.", file.exists() );
683 protected void assertNotExistsInManagedDefaultRepo( File file )
686 String managedDefaultPath = managedDefaultDir.getCanonicalPath();
687 String testFile = file.getCanonicalPath();
689 assertTrue( "Unit Test Failure: File <" + testFile
690 + "> should be have been defined within the managed default path of <" + managedDefaultPath
691 + ">", testFile.startsWith( managedDefaultPath ) );
693 assertFalse( "File < " + testFile + "> should not exist in managed default repository.", file.exists() );
696 protected static Date getFutureDate()
697 throws ParseException
699 Calendar cal = Calendar.getInstance();
700 cal.add( Calendar.YEAR, 1 );
701 return cal.getTime();
704 protected static Date getPastDate()
705 throws ParseException
707 return new SimpleDateFormat( "yyyy-MM-dd", Locale.US ).parse( "2000-01-01" );