ApplicationWsDelegate { public void resynchronize( String applicationName ) { this.logger.finer( String.format( "Resynchronizing application \"%s\"...", applicationName ) ); WebResource path = this.resource .path( UrlConstants.APP ) .path( applicationName ) .path( "resynchronize" ); this.wsClient.createBuilder( path ).post(); this.logger.finer( String.format( "Application \"%s\" has been resynchronized", applicationName ) ); } ApplicationWsDelegate( WebResource resource, WsClient wsClient ); void changeInstanceState( String applicationName, InstanceStatus newStatus, String instancePath ); void setDescription( String applicationName, String newDesc ); void deployAndStartAll( String applicationName, String instancePath ); void stopAll( String applicationName, String instancePath ); void undeployAll( String applicationName, String instancePath ); List<Instance> listChildrenInstances( String applicationName, String instancePath, boolean all ); void addInstance( String applicationName, String parentInstancePath, Instance instance ); void removeInstance( String applicationName, String instancePath ); void resynchronize( String applicationName ); List<Component> listAllComponents( String applicationName ); List<Component> findComponentChildren( String applicationName, String componentName ); List<Component> findComponentAncestors( String applicationName, String componentName ); void bindApplication( String applicationName, String boundTplName, String boundApp ); List<String> listAllCommands( String applicationName );  }
@Test public void testResynchronize_success() throws ApplicationWsException { final Collection<Instance> rootInstances = this.app.getRootInstances(); for(Instance i : rootInstances) i.setStatus( InstanceStatus.DEPLOYED_STARTED ); this.client.getApplicationDelegate().resynchronize( this.app.getName() ); final List<Message> sentMessages = this.msgClient.allSentMessages; Assert.assertEquals( rootInstances.size(), sentMessages.size() ); for( Message message : sentMessages ) Assert.assertTrue( message instanceof MsgCmdResynchronize ); }
@Test public void testResynchronize_nonExistingApplication() { try { this.client.getApplicationDelegate().resynchronize( "I-am-not-an-app" ); Assert.fail( "Expecting exception" ); } catch ( UniformInterfaceException e ) { Assert.assertEquals( 404, e.getResponse().getStatus() ); } }