Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.App$Messages


    final TextProvider textProvider = DefaultTextProvider.INSTANCE;
    Map<String, Messages> fieldMap = new HashMap<String, Messages>();
    Map<Severity, List<String>> severityMap = new EnumMap<Severity, List<String>>(Severity.class);

    public Messages forField(String fieldName) {
        Messages forField = fieldMap.get(fieldName);
        if (forField == null) {
            forField = new MessagesImpl();
            fieldMap.put(fieldName, forField);
        }
        return forField;
View Full Code Here


import org.apache.struts2.Messages;

public class MessagesTest extends TestCase {

    public void testForField() {
        Messages messages = new MessagesImpl();
        Messages fieldMessages = messages.forField("foo");
        fieldMessages.addError("foo");
        assertFalse(fieldMessages.getErrors().isEmpty());
        assertTrue(messages.hasErrors());
    }
View Full Code Here

        assertTrue(messages.hasErrors());
    }

    public void testHasMessagesForSeverity() {
        for (Messages.Severity severity : Messages.Severity.values()) {
            Messages messages = new MessagesImpl();
            messages.add(severity, "foo");

            assertFalse(messages.isEmpty(severity));

            for (Messages.Severity other : Messages.Severity.values())
                if (other != severity)
                    assertTrue(messages.isEmpty(other));
        }
    }
View Full Code Here

import org.apache.struts2.Messages;

public class MessagesTest extends TestCase {

    public void testForField() {
        Messages messages = new MessagesImpl();
        Messages fieldMessages = messages.forField("foo");
        fieldMessages.addError("foo");
        assertFalse(fieldMessages.getErrors().isEmpty());
        assertTrue(messages.hasErrors());
    }
View Full Code Here

        assertTrue(messages.hasErrors());
    }

    public void testHasMessagesForSeverity() {
        for (Messages.Severity severity : Messages.Severity.values()) {
            Messages messages = new MessagesImpl();
            messages.add(severity, "foo");

            assertFalse(messages.isEmpty(severity));

            for (Messages.Severity other : Messages.Severity.values())
                if (other != severity)
                    assertTrue(messages.isEmpty(other));
        }
    }
View Full Code Here

    final TextProvider textProvider = DefaultTextProvider.INSTANCE;
    Map<String, Messages> fieldMap = new HashMap<String, Messages>();
    Map<Severity, List<String>> severityMap = new EnumMap<Severity, List<String>>(Severity.class);

    public Messages forField(String fieldName) {
        Messages forField = fieldMap.get(fieldName);
        if (forField == null) {
            forField = new MessagesImpl();
            fieldMap.put(fieldName, forField);
        }
        return forField;
View Full Code Here

        } catch (IllegalArgumentException ex) {
           String exceptionMsg = String.format(Messages.INVALID_LIB_TYPE_MESSAGE, libraryType, StringUtils.join(SupportedLibraryType.values(), ", ") );
           throw new CommandArgumentsException(exceptionMsg, this);
        }
   
    App app = brjs.app(appName);
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
   
    JsLib library = app.appJsLib(libraryName);
    if (library.dirExists()) throw new NodeAlreadyExistsException(library, this);
   
    switch ( createLibraryType ) {
      case br:
        break;
View Full Code Here

 
  @Override
  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("new-app-name");
    String requirePrefix = parsedArgs.getString("require-prefix");
    App app = brjs.app(appName);
   
    if(app.dirExists()) throw new NodeAlreadyExistsException(app, this);
   
    try {
      NameValidator.assertValidDirectoryName(app);
      requirePrefix = (requirePrefix == null) ? NameValidator.generateRequirePrefixFromApp(app) : requirePrefix;
     
      app.populate(requirePrefix);
      logger.println(Messages.APP_CREATED_CONSOLE_MSG, appName);
      logger.println(" " + app.dir().getPath());
     
      app.deploy();
      logger.println(Messages.APP_DEPLOYED_CONSOLE_MSG, appName);
    }
    catch(InvalidNameException e) {
      throw new CommandArgumentsException(e, this);
    }
    catch(ModelUpdateException | TemplateInstallationException e) {
      throw new CommandOperationException("Cannot create application '" + app.dir().getPath() + "'", e);
    }
    return 0;
  }
View Full Code Here

    String appZipName = parsedArgs.getString("app-zip");
    String newAppName = parsedArgs.getString("new-app-name");
    String newAppNamespace = parsedArgs.getString("new-app-require-prefix");
   
    File appZip = (new File(appZipName).exists()) ? new File(appZipName) : new File(brjs.file("sdk"), appZipName);
    App app = brjs.app(newAppName);
   
    if(!appZip.exists()) throw new CommandArgumentsException("Couldn't find zip file at '" + appZipName + "'.", this);
    if(app.dirExists()) throw new NodeAlreadyExistsException(app, this);
   
    try
    {
      NameValidator.assertValidDirectoryName(app);
      NameValidator.assertValidRootPackageName(app, newAppNamespace);
     
      NodeImporter.importAppFromZip(new ZipFile(appZip), app, newAppNamespace);
     
      app.deploy();
     
      logger.println("Successfully imported '" + new File(appZipName).getName() + "' as new application '" + newAppName + "'");
      logger.println(" " + app.dir().getAbsolutePath());
    }
    catch(InvalidDirectoryNameException | InvalidRootPackageNameException e) {
      throw new CommandArgumentsException("Failed to import application from zip '" + appZipName + "'.", e, this);
    }
    catch (Exception e)
View Full Code Here

    return loadedClasses;
  }

  public File getCompiledClassDir(BRJS brjs, File testDir) throws IOException
  {
    App app = brjs.locateAncestorNodeOfClass(testDir, App.class);
    String relativePath = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), testDir);
   
    return new File(getClassesRoot(testDir), relativePath + "/test-integration/webdriver/tests");
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.App$Messages

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.