throw new IOException( "An application name cannot be empty." ); Application app = new Application( name, tpl ).description( description ); if( ! app.getName().matches( ParsingConstants.PATTERN_APP_NAME )) throw new IOException( "Application names cannot contain invalid characters. Letters, digits, dots, underscores, brackets, spaces and the minus symbol are allowed." );
throw new AlreadyExistingException( desc.getName()); Application app = new Application( desc.getName(), tpl ).description( desc.getDescription()); File targetDirectory = ConfigurationUtils.findApplicationDirectory( app.getName(), configurationDirectory ); app.setDirectory( targetDirectory );
@Test public void testChain() { Application app = new Application( new ApplicationTemplate()).name( "ins" ).description( "desc" ); Assert.assertEquals( "ins", app.getName()); Assert.assertEquals( "desc", app.getDescription()); }
private void saveAndCompare( ApplicationDescriptor desc ) throws Exception { File f = this.folder.newFile(); ApplicationTemplate tpl = new ApplicationTemplate( desc.getTemplateName()).version( desc.getTemplateVersion()); Application app = new Application( desc.getName(), tpl ).description( desc.getDescription()); ApplicationDescriptor.save( f, app ); ApplicationDescriptor desc2 = ApplicationDescriptor.load( f ); Assert.assertEquals( desc.getDescription(), desc2.getDescription()); Assert.assertEquals( desc.getName(), desc2.getName()); Assert.assertEquals( desc.getTemplateName(), desc2.getTemplateName()); Assert.assertEquals( desc.getTemplateVersion(), desc2.getTemplateVersion()); } }