@Test public void testShutdownApplication_success() throws Exception { TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); this.managerWrapper.addManagedApplication( new ManagedApplication( app )); Assert.assertEquals( Status.OK.getStatusCode(), this.resource.shutdownApplication( app.getName()).getStatus()); }
@Override public Response shutdownApplication( String applicationName ) { this.logger.fine( "Request: shutdown application " + applicationName + "." ); Response result = Response.ok().build(); try { ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { result = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { this.manager.instancesMngr().undeployAll( ma, null ); } } catch( Exception e ) { result = handleError( Status.FORBIDDEN, new RestError( REST_MNGMT_APP_SHUTDOWN_ERROR, e ), lang( this.manager )).build(); } return result; }
ManagementResource implements IManagementResource { @Override public Response shutdownApplication( String applicationName ) { this.logger.fine( "Request: shutdown application " + applicationName + "." ); Response result = Response.ok().build(); try { ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { result = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { this.manager.instancesMngr().undeployAll( ma, null ); } } catch( Exception e ) { result = handleError( Status.FORBIDDEN, new RestError( REST_MNGMT_APP_SHUTDOWN_ERROR, e ), lang( this.manager )).build(); } return result; } }
ManagementResource implements IManagementResource { @Override public Response shutdownApplication( String applicationName ) { this.logger.fine( "Request: shutdown application " + applicationName + "." ); Response result = Response.ok().build(); try { ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { result = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { this.manager.instancesMngr().undeployAll( ma, null ); } } catch( Exception e ) { result = handleError( Status.FORBIDDEN, new RestError( REST_MNGMT_APP_SHUTDOWN_ERROR, e ), lang( this.manager )).build(); } return result; } ManagementResource( Manager manager ); }
ManagementResource implements IManagementResource { @Override public Response shutdownApplication( String applicationName ) { this.logger.fine( "Request: shutdown application " + applicationName + "." ); Response result = Response.ok().build(); try { ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { result = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { this.manager.instancesMngr().undeployAll( ma, null ); } } catch( Exception e ) { result = handleError( Status.FORBIDDEN, new RestError( REST_MNGMT_APP_SHUTDOWN_ERROR, e ), lang( this.manager )).build(); } return result; } ManagementResource( Manager manager ); void setMavenResolver( MavenResolver mavenResolver ); @Override Response loadUploadedZippedApplicationTemplate( InputStream uploadedInputStream, FormDataContentDisposition fileDetail ); @Override Response loadZippedApplicationTemplate( String url ); @Override Response loadUnzippedApplicationTemplate( String localFilePath ); @Override List<ApplicationTemplate> listApplicationTemplates( String exactName, String exactQualifier, String tag ); @Override List<ApplicationTemplate> listApplicationTemplates(); @Override Response deleteApplicationTemplate( String tplName, String tplVersion ); @Override Response createApplication( Application app ); @Override List<Application> listApplications( String exactName ); @Override List<Application> listApplications(); @Override Response deleteApplication( String applicationName ); @Override Response shutdownApplication( String applicationName ); @Override Response setImage(
			final String name,
			final String qualifier,
			final InputStream image,
			final FormDataContentDisposition fileDetail); }
ManagementResource implements IManagementResource { @Override public Response shutdownApplication( String applicationName ) { this.logger.fine( "Request: shutdown application " + applicationName + "." ); Response result = Response.ok().build(); try { ManagedApplication ma = this.manager.applicationMngr().findManagedApplicationByName( applicationName ); if( ma == null ) { result = handleError( Status.NOT_FOUND, new RestError( REST_INEXISTING, application( applicationName )), lang( this.manager )).build(); } else { this.manager.instancesMngr().undeployAll( ma, null ); } } catch( Exception e ) { result = handleError( Status.FORBIDDEN, new RestError( REST_MNGMT_APP_SHUTDOWN_ERROR, e ), lang( this.manager )).build(); } return result; } ManagementResource( Manager manager ); void setMavenResolver( MavenResolver mavenResolver ); @Override Response loadUploadedZippedApplicationTemplate( InputStream uploadedInputStream, FormDataContentDisposition fileDetail ); @Override Response loadZippedApplicationTemplate( String url ); @Override Response loadUnzippedApplicationTemplate( String localFilePath ); @Override List<ApplicationTemplate> listApplicationTemplates( String exactName, String exactQualifier, String tag ); @Override List<ApplicationTemplate> listApplicationTemplates(); @Override Response deleteApplicationTemplate( String tplName, String tplVersion ); @Override Response createApplication( Application app ); @Override List<Application> listApplications( String exactName ); @Override List<Application> listApplications(); @Override Response deleteApplication( String applicationName ); @Override Response shutdownApplication( String applicationName ); @Override Response setImage(
			final String name,
			final String qualifier,
			final InputStream image,
			final FormDataContentDisposition fileDetail); static final long MAX_IMAGE_SIZE; }