public void addAndUpdateAndDelete()
throws Exception
{
mockAuditListener.clearEvents();
int initialSize = networkProxyAdmin.getNetworkProxies().size();
NetworkProxy networkProxy = getNetworkProxyTest( "foo" );
networkProxyAdmin.addNetworkProxy( networkProxy, getFakeAuditInformation() );
assertEquals( initialSize + 1, networkProxyAdmin.getNetworkProxies().size() );
networkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
assertNotNull( networkProxy );
assertEquals( getNetworkProxyTest( "foo" ).getId(), networkProxy.getId() );
assertEquals( getNetworkProxyTest( "foo" ).getHost(), networkProxy.getHost() );
assertEquals( getNetworkProxyTest( "foo" ).getPassword(), networkProxy.getPassword() );
assertEquals( getNetworkProxyTest( "foo" ).getPort(), networkProxy.getPort() );
assertEquals( getNetworkProxyTest( "foo" ).getUsername(), networkProxy.getUsername() );
assertEquals( getNetworkProxyTest( "foo" ).getProtocol(), networkProxy.getProtocol() );
networkProxy.setHost( "https://toto.com" );
networkProxy.setPassword( "newpasswd" );
networkProxy.setPort( 9191 );
networkProxy.setProtocol( "http" );
networkProxy.setUsername( "newusername" );
networkProxyAdmin.updateNetworkProxy( networkProxy, getFakeAuditInformation() );
NetworkProxy updatedNetworkProxy = networkProxyAdmin.getNetworkProxy( "foo" );
assertNotNull( updatedNetworkProxy );
assertEquals( networkProxy.getId(), updatedNetworkProxy.getId() );
assertEquals( networkProxy.getHost(), updatedNetworkProxy.getHost() );
assertEquals( networkProxy.getPassword(), updatedNetworkProxy.getPassword() );
assertEquals( networkProxy.getPort(), updatedNetworkProxy.getPort() );
assertEquals( networkProxy.getUsername(), updatedNetworkProxy.getUsername() );
assertEquals( networkProxy.getProtocol(), updatedNetworkProxy.getProtocol() );
networkProxyAdmin.deleteNetworkProxy( "foo", getFakeAuditInformation() );
assertEquals( 3, mockAuditListener.getAuditEvents().size() );