package com.perforce.maven.scm.provider.p4.manager; import java.io.File; import org.junit.Assert; import org.junit.Test; import com.perforce.maven.scm.provider.p4.AbstractPlexusTestCase; import com.perforce.maven.scm.provider.p4.P4ScmTestUtils; import com.perforce.maven.scm.provider.p4.repository.P4ScmProviderRepository; import com.perforce.maven.scm.provider.p4.util.P4ScmUrl; import com.perforce.maven.scm.provider.p4.util.P4Utils; import com.perforce.p4java.client.IClient; import com.perforce.p4java.exception.ConnectionException; public class P4ClientManagerTest extends AbstractPlexusTestCase { @Test public void testCreateClientManager() throws Exception { P4ScmTestUtils.initRepo(); P4ClientManager clientManager = (P4ClientManager) this.lookup( P4ClientManager.ROLE ); P4ScmUrl p4Url = P4ScmUrl.parse( P4ScmTestUtils.getScmUrl() ); P4ScmProviderRepository repo = new P4ScmProviderRepository( p4Url.getProtocol(), p4Url.getHost(), p4Url.getPort(), p4Url.getPath(), p4Url.getUsername(), p4Url.getPassword() ); IClient client = clientManager.getClient( repo, new File( getBuildDirectory(), "client" ) ); IClient client2 = clientManager.getClient( repo, new File( getBuildDirectory(), "client" ) ); Assert.assertSame( client, client2 ); // force a stale client client.getServer().disconnect(); P4Utils.getSettings().setCheckStaledConnection( true ); client = clientManager.getClient( repo, new File( getBuildDirectory(), "client" ) ); P4Utils.getSettings().setCheckStaledConnection( false );//return back to default // got another client Assert.assertNotSame( client, client2 ); try { client2.getServer().getUser( null ); Assert.fail( "Stale connection expected" ); } catch ( ConnectionException e ) { } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 9705 | dantran |
- add apache snapshot repo for maven-scm-test-1.10-SNAPSHOT - add settings'checkStaledConnection for optimization purpose |
||
#4 | 9590 | dantran |
- add option to fail tag when it already exist - add P4ScmUrl parser test - cleanup |
||
#3 | 9534 | dantran | add ClientManager test | ||
#2 | 9533 | dantran | source format | ||
#1 | 9519 | dantran | folder rename to match with its artifactId | ||
//guest/dantran/p4maven/com.perforce.maven/src/test/java/com/perforce/maven/scm/provider/p4/manager/P4ClientManagerTest.java | |||||
#8 | 9441 | dantran | discover existing client, so that we dont need pass in this name via system property during release:prepare | ||
#7 | 9424 | dantran | add list and status TCK | ||
#6 | 9423 | dantran | get all test to use the same setup, handle checkout with tag, need to revisit how we handle ScmVersion | ||
#5 | 9250 | dantran | caching client across mutiple commands | ||
#4 | 9243 | dantran | isolate P4JAVA IClient creation problem | ||
#3 | 9236 | dantran | back to 2014.6.1-SNAPSHOT | ||
#2 | 9234 | dantran | test to makesure only on client view return | ||
#1 | 9233 | dantran | initial implementation of all the needed manager to cache Iclient and Iserver instances |