@Test( expected = ManagementWsException.class ) public void createApplication_IOException() throws Exception { this.client.getManagementDelegate().createApplication( "app", null, null ); }
public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; }
ManagementWsDelegate { public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; } }
ManagementWsDelegate { public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; } ManagementWsDelegate( WebResource resource, WsClient wsClient ); }
ManagementWsDelegate { public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; } ManagementWsDelegate( WebResource resource, WsClient wsClient ); void uploadZippedApplicationTemplate( File applicationFile ); void loadUnzippedApplicationTemplate( String localFilePath ); void loadZippedApplicationTemplate( String url ); List<ApplicationTemplate> listApplicationTemplates( String exactName, String exactQualifier ); List<ApplicationTemplate> listApplicationTemplates(); void deleteApplicationTemplate( String templateName, String templateQualifier ); Application createApplication( String applicationName, String templateName, String templateQualifier ); List<Application> listApplications( String exactName ); List<Application> listApplications(); void shutdownApplication( String applicationName ); void deleteApplication( String applicationName ); }
ManagementWsDelegate { public Application createApplication( String applicationName, String templateName, String templateQualifier ) throws ManagementWsException { this.logger.finer( "Creating application " + applicationName + " from " + templateName + " - " + templateQualifier + "..." ); ApplicationTemplate tpl = new ApplicationTemplate( templateName ).version( templateQualifier ); Application app = new Application( applicationName, tpl ); WebResource path = this.resource.path( UrlConstants.APPLICATIONS ); ClientResponse response = this.wsClient.createBuilder( path ) .type( MediaType.APPLICATION_JSON ) .post( ClientResponse.class, app ); if( Family.SUCCESSFUL != response.getStatusInfo().getFamily()) throw new ManagementWsException( response.getStatusInfo().getStatusCode(), "" ); Application result = response.getEntity( Application.class ); return result; } ManagementWsDelegate( WebResource resource, WsClient wsClient ); void uploadZippedApplicationTemplate( File applicationFile ); void loadUnzippedApplicationTemplate( String localFilePath ); void loadZippedApplicationTemplate( String url ); List<ApplicationTemplate> listApplicationTemplates( String exactName, String exactQualifier ); List<ApplicationTemplate> listApplicationTemplates(); void deleteApplicationTemplate( String templateName, String templateQualifier ); Application createApplication( String applicationName, String templateName, String templateQualifier ); List<Application> listApplications( String exactName ); List<Application> listApplications(); void shutdownApplication( String applicationName ); void deleteApplication( String applicationName );  }