ManagementResource implements IManagementResource { @Override public List<Application> listApplications( String exactName ) { if( exactName != null ) this.logger.fine( "Request: list/find the application named " + exactName + "." ); else this.logger.fine( "Request: list all the applications." ); List<Application> result = new ArrayList<> (); for( ManagedApplication ma : this.manager.applicationMngr().getManagedApplications()) { if( exactName == null || exactName.equals( ma.getName())) result.add( ma.getApplication()); } 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; }
@Test public void testListApplications() throws Exception { List<Application> apps = this.resource.listApplications(); Assert.assertNotNull( apps ); Assert.assertEquals( 0, apps.size()); TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); this.managerWrapper.addManagedApplication( new ManagedApplication( app )); apps = this.resource.listApplications(); Assert.assertNotNull( apps ); Assert.assertEquals( 1, apps.size()); Application receivedApp = apps.get( 0 ); Assert.assertEquals( app.getName(), receivedApp.getName()); Assert.assertEquals( app.getDescription(), receivedApp.getDescription()); apps = this.resource.listApplications( "filter" ); Assert.assertNotNull( apps ); Assert.assertEquals( 0, apps.size()); apps = this.resource.listApplications( app.getName()); Assert.assertNotNull( apps ); Assert.assertEquals( 1, apps.size()); receivedApp = apps.get( 0 ); Assert.assertEquals( app.getName(), receivedApp.getName()); Assert.assertEquals( app.getDescription(), receivedApp.getDescription()); apps = this.resource.listApplications( app.getName() + "0" ); Assert.assertNotNull( apps ); Assert.assertEquals( 0, apps.size()); }