@ -2,6 +2,7 @@ package com.fr.design;
import com.fr.design.env.DesignerWorkspaceInfo ;
import com.fr.design.env.DesignerWorkspaceType ;
import com.fr.design.env.LocalDesignerWorkspaceInfo ;
import com.fr.design.env.RemoteDesignerWorkspaceInfo ;
import com.fr.env.CheckServiceDialog ;
import com.fr.invoke.Reflect ;
@ -58,7 +59,7 @@ public class EnvChangeEntranceTest {
}
@Test
public void testUpdateSelect Env ( ) {
public void testUpdateNotRememberPwd Env ( ) {
DesignerEnvManager manager = new DesignerEnvManager ( ) ;
@ -71,16 +72,32 @@ public class EnvChangeEntranceTest {
manager . putEnv ( "test1" , RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "password" , "" , "" , true ) ) ) ;
manager . putEnv ( "test2" , RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "password" , "" , "" , false ) ) ) ;
manager . putEnv ( "test3" , LocalDesignerWorkspaceInfo . create ( "name" , "path" ) ) ;
Reflect . on ( entrance ) . call ( "updateSelectEnv" , "test1" ) ;
Reflect . on ( entrance ) . call ( "updateSelectEnv" , "test2" ) ;
Reflect . on ( entrance ) . call ( "updateNotRememberPwdEnv" ) ;
Assert . assertEquals ( manager . getWorkspaceInfo ( "test1" ) . getConnection ( ) , RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "password" , "" , "" , true ) ) . getConnection ( ) ) ;
Assert . assertEquals ( manager . getWorkspaceInfo ( "test2" ) . getConnection ( ) , RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "" , "" , "" , false ) ) . getConnection ( ) ) ;
Assert . assertEquals ( manager . getWorkspaceInfo ( "test3" ) . getName ( ) , "name" ) ;
Assert . assertEquals ( manager . getWorkspaceInfo ( "test3" ) . getPath ( ) , "path" ) ;
PowerMock . verifyAll ( ) ;
}
@Test
public void testIsNotRememberPwd ( ) {
EnvChangeEntrance entrance = EnvChangeEntrance . getInstance ( ) ;
DesignerWorkspaceInfo info1 = RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "password" , "" , "" , true ) ) ;
DesignerWorkspaceInfo info2 = RemoteDesignerWorkspaceInfo . create ( new WorkspaceConnectionInfo ( "url" , "userName" , "111" , "" , "" , false ) ) ;
DesignerWorkspaceInfo info3 = LocalDesignerWorkspaceInfo . create ( "name" , "path" ) ;
DesignerWorkspaceInfo info4 = null ;
Assert . assertFalse ( ( boolean ) Reflect . on ( entrance ) . call ( "isNotRememberPwd" , info1 ) . get ( ) ) ;
Assert . assertTrue ( ( boolean ) Reflect . on ( entrance ) . call ( "isNotRememberPwd" , info2 ) . get ( ) ) ;
Assert . assertFalse ( ( boolean ) Reflect . on ( entrance ) . call ( "isNotRememberPwd" , info3 ) . get ( ) ) ;
Assert . assertFalse ( ( boolean ) Reflect . on ( entrance ) . call ( "isNotRememberPwd" , info4 ) . get ( ) ) ;
}
}