Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.App


  public void initTestObjects() throws Exception {
    given(brjs).automaticallyFindsBundlerPlugins()
      .and(brjs).automaticallyFindsMinifierPlugins()
      .and(brjs).hasBeenCreated();
   
    App app = brjs.app("app1");
    aspect = app.aspect("default");
    bladeset = app.bladeset("bs");
    blade = bladeset.blade("b1");
    workbench = blade.workbench();
    response = new StringBuffer();
    userLib = app.jsLib("userLib");
   
    given(aspect).hasClass("appns/Class1")
      .and(aspect).indexPageRefersTo("appns.Class1");
  }
View Full Code Here


  }
 
  public List<StylesheetRequest> getOrderedStylesheets(boolean isDev, Map<String, String> tagAttributes, BundleSet bundleSet, Locale locale, String version) throws MalformedTokenException, ContentProcessingException, IOException
  {
    try {
      App app = bundleSet.getBundlableNode().app();
      String theme = getTheme(tagAttributes);
      List<String> alternateThemes = getAlternateThemes(tagAttributes);
      List<String> contentPaths = (isDev) ? cssContentPlugin.getValidDevContentPaths(bundleSet, locale) : cssContentPlugin.getValidProdContentPaths(bundleSet, locale);
      List<StylesheetRequest> stylesheetRequests = new ArrayList<>();
     
View Full Code Here

  }

  @Override
  public void onEventEmitted(Event event, Node node)
  {
    App app = (App) node;
   
    try
    {
      if (isAppServerRunning()) {
        logger.debug(Messages.NEW_APP_LOG_MSG, app.getName());
        app.file(BRJSApplicationServer.DEPLOY_APP_FILENAME).createNewFile();
      } else {
        logger.debug(Messages.NEW_APP_APPSERVER_NOT_RUNNING_MSG, app.getName());
      }
    }
    catch(Exception ex)
    {
      throw new RuntimeException(ex);
View Full Code Here

  }
 
  @Test
  public void templateCanBeInstalledWithoutTransformations() throws Exception
  {
    App app = brjs.app("app");
    assertFalse("app dir does not exist", app.dirExists());
   
    TemplateUtility.installTemplate(brjs.app("app"), "app", new HashMap<String, String>());
   
    assertTrue("app dir exists", app.dirExists());
   
    assertTrue("root dir exists", app.file("root-@dir").exists());
    assertTrue("root dir is a directory", app.file("root-@dir").isDirectory());
    assertTrue("root text file exists", app.file("root-@dir/root-text-file.txt").exists());
    assertEquals("root text file has correct contents", "this is the root text file (in root @dir)", fileUtil.readFileToString(app.file("root-@dir/root-text-file.txt")));
    assertTrue("root binary file exists", app.file("root-@dir/root-binary-file.bin").exists());
    assertEquals("root binary file has correct contents", "this is the root binary file (in root @dir)", fileUtil.readFileToString(app.file("root-@dir/root-binary-file.bin")));
    assertFalse("hidden file does not exist", app.file("root-@dir/.unix-hidden-file.txt").exists());
   
    assertTrue("child dir exists", app.file("root-@dir/child-@dir").exists());
    assertTrue("child dir is a directory", app.file("root-@dir/child-@dir").isDirectory());
    assertTrue("child text file exists", app.file("root-@dir/child-@dir/child-text-file.txt").exists());
    assertEquals("child text file has correct contents", "this is the child text file (in child @dir)", fileUtil.readFileToString(app.file("root-@dir/child-@dir/child-text-file.txt")));
    assertTrue("child binary file exists", app.file("root-@dir/child-@dir/child-binary-file.bin").exists());
    assertEquals("child binary file has correct contents", "this is the child binary file (in child @dir)", fileUtil.readFileToString(app.file("root-@dir/child-@dir/child-binary-file.bin")));
  }
View Full Code Here

    String appName = parsedArgs.getString(Parameters.APP_NAME);
    String targetDirPath = parsedArgs.getString(Parameters.TARGET_DIR);
    boolean warExport = parsedArgs.getBoolean("war");
    boolean hasExplicitExportDirArg = (targetDirPath != null);
   
    App app = brjs.app(appName);
   
    File targetDir = brjs.storageDir("built-apps");
    File appExportDir;
    File warExportFile;
   
    if (hasExplicitExportDirArg)
    {
      targetDir = new File(targetDirPath);
      if (!targetDir.isDirectory())
      {
        targetDir = brjs.file("sdk/" + targetDirPath);
      }
      appExportDir = targetDir;
      warExportFile = new File(targetDir, appName+".war");     
    }
    else {
      appExportDir = new File(targetDir, appName);
      warExportFile = new File(targetDir, appName+".war");
     
      if (warExport && warExportFile.exists()) {
        boolean deleted = FileUtils.deleteQuietly(warExportFile);
        if (!deleted) {
          File oldWarExportFile = warExportFile;
          warExportFile = new File(targetDir, appName+"_"+getBuiltAppTimestamp()+".war");
          brjs.logger(this.getClass()).warn( Messages.UNABLE_TO_DELETE_BULIT_APP_EXCEPTION, RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), oldWarExportFile), RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), warExportFile));
        }
      } else if (!warExport && appExportDir.exists()){
        boolean deleted = FileUtils.deleteQuietly(appExportDir);     
        if (!deleted) {
          File oldAppExportDir = appExportDir;
          appExportDir = new File(targetDir, appName+"_"+getBuiltAppTimestamp());
          brjs.logger(this.getClass()).warn( Messages.UNABLE_TO_DELETE_BULIT_APP_EXCEPTION, RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), oldAppExportDir), RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), appExportDir));
        }
      }
      targetDir.mkdirs();
    }
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(!targetDir.isDirectory()) throw new DirectoryDoesNotExistCommandException(targetDirPath, this);
   
    try {
      if (warExport) {
        if(warExportFile.exists()) throw new DirectoryAlreadyExistsCommandException(warExportFile.getPath(), this);
        app.buildWar(warExportFile);
        logger.println(Messages.APP_BUILT_CONSOLE_MSG, appName, warExportFile.getCanonicalPath());
      } else {
        if (hasExplicitExportDirArg) {
          if (appExportDir.listFiles().length > 0) throw new DirectoryNotEmptyCommandException(appExportDir.getPath(), this);               
        } else {
          appExportDir.mkdir();     
        }
        app.build(appExportDir);
        logger.println(Messages.APP_BUILT_CONSOLE_MSG, appName, appExportDir.getCanonicalPath());
      }
    }
    catch (ModelOperationException | IOException e) {
      throw new CommandOperationException(e);
View Full Code Here

  }
 
  @Test
  public void fileNamesAndContentsCanBeModifiedWhenInstallingTemplate() throws Exception
  {
    App app = brjs.app("app");
    Map<String, String> transformations = new HashMap<>();
   
    transformations.put("dir", "folder");
    TemplateUtility.installTemplate(brjs.app("app"), "app", transformations);
   
    assertTrue("app folder exists", app.dirExists());
   
    assertTrue("root folder exists", app.file("root-folder").exists());
    assertTrue("root folder is a directory", app.file("root-folder").isDirectory());
    assertTrue("root text file exists", app.file("root-folder/root-text-file.txt").exists());
    assertEquals("root text file has correct contents", "this is the root text file (in root folder)", fileUtil.readFileToString(app.file("root-folder/root-text-file.txt")));
    assertTrue("root binary file exists", app.file("root-folder/root-binary-file.bin").exists());
    assertEquals("root binary file has correct contents", "this is the root binary file (in root @dir)", fileUtil.readFileToString(app.file("root-folder/root-binary-file.bin")));
    assertFalse("hidden file does not exist", app.file("root-dir/.unix-hidden-file.txt").exists());
   
    assertTrue("child folder exists", app.file("root-folder/child-folder").exists());
    assertTrue("child folder is a directory", app.file("root-folder/child-folder").isDirectory());
    assertTrue("child text file exists", app.file("root-folder/child-folder/child-text-file.txt").exists());
    assertEquals("child text file has correct contents", "this is the child text file (in child folder)", fileUtil.readFileToString(app.file("root-folder/child-folder/child-text-file.txt")));
    assertTrue("child binary file exists", app.file("root-folder/child-folder/child-binary-file.bin").exists());
    assertEquals("child binary file has correct contents", "this is the child binary file (in child @dir)", fileUtil.readFileToString(app.file("root-folder/child-folder/child-binary-file.bin")));
  }
View Full Code Here

      .and(brjs).hasBeenCreated()
      .and(brjs).usesProductionTemplates()
      .and(brjs).usedForServletModel();
   
    // generate the app structure
    App app = brjs.app("app");
    Aspect aspect = app.defaultAspect();
    Bladeset bs = app.bladeset("bs");
    Blade b1 = bs.blade("b1");
    Workbench workbench = b1.workbench();
   
    given(app).hasBeenPopulated()
      .and(aspect).hasClass("appns/Class1")
View Full Code Here

  @Override
  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("target-app-name");
    String bladesetName = parsedArgs.getString("new-bladeset-name");
   
    App app = brjs.app(appName);
    Bladeset bladeset = app.bladeset(bladesetName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(bladeset.dirExists()) throw new NodeAlreadyExistsException(bladeset, this);
   
    try {
      bladeset.populate();
    }
View Full Code Here

  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString(Parameters.APP_NAME);
    String bladesetName = parsedArgs.getString(Parameters.BLADESET_NAME);
    String bladeName = parsedArgs.getString(Parameters.BLADE_NAME);
   
    App app = brjs.app(appName);
    Bladeset bladeset = getBladeset(app, bladesetName);
    Blade blade = bladeset.blade(bladeName);
   
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
    if(!bladeset.dirExists()) throw new NodeDoesNotExistException(bladeset, this);
    if(blade.dirExists()) throw new NodeAlreadyExistsException(blade, this);
   
    try {
      blade.populate();
View Full Code Here

 
    //TODO: have to create brjs first should remove when moved over to core
    given(brjs).hasBeenCreated();
   
    given(brjs).hasCommandPlugins(new TestServerCommand());
      App app = brjs.app("myapp");
      app.aspect("myaspect");
      Bladeset bladeset = app.bladeset("mybladeset");
      bladeset.blade("myblade");
      new File(brjs.dir(), "sdk");
     
    testRunnerConfWithoutBrowsersDefined =
        "jsTestDriverJar: pathToJsTestDriver.jar\n" +
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.App

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.