Esempio n. 1
0
 @Before
 public void initTestObjects() throws Exception {
   pluginLocator.pluginCommands.add(new JsDocCommand());
   given(brjs).hasBeenCreated();
   app = brjs.app("app");
   appLib = app.jsLib("lib");
   jsdocOutputDir = app.storageDir("jsdoc-toolkit");
 }
Esempio n. 2
0
 @Before
 public void initTestObjects() throws Exception {
   given(brjs).hasBeenCreated();
   app = brjs.app("app1");
   aspectTemplate = brjs.template("aspect");
   aspect = app.aspect("default");
   badAspect = app.aspect("!#*");
 }
Esempio n. 3
0
 @Before
 public void initTestObjects() throws Exception {
   given(brjs)
       .automaticallyFindsBundlers()
       .and(brjs)
       .automaticallyFindsMinifiers()
       .and(brjs)
       .hasBeenCreated();
   app = brjs.app("app1");
   aspect = app.aspect("default");
   bladeset = app.bladeset("bs");
   blade = bladeset.blade("b1");
 }
Esempio n. 4
0
 @Before
 public void initTestObjects() throws Exception {
   given(brjs)
       .automaticallyFindsBundlerPlugins()
       .and(brjs)
       .automaticallyFindsMinifierPlugins()
       .and(brjs)
       .hasBeenCreated();
   app = brjs.app("app1");
   aspectTemplate = brjs.sdkTemplateGroup("default").template("aspect");
   aspect = app.aspect("default");
   badAspect = app.aspect("!#*");
   defaultBladeset = app.defaultBladeset();
   bladeInDefaultBladeset = defaultBladeset.blade("b1");
 }
Esempio n. 5
0
 @Test
 public void bundleCanBeGeneratedForABladeInADefaultBladesetThatAlsoHasADefaultAspect()
     throws Exception {
   given(bladeInDefaultBladeset)
       .hasClasses("Class1")
       .and(app.defaultAspect())
       .indexPageHasContent("")
       .and(bladeInDefaultBladeset.workbench())
       .indexPageRequires("appns/b1/Class1");
   when(bladeInDefaultBladeset.workbench())
       .requestReceivedInDev("js/dev/combined/bundle.js", response);
   then(response).containsCommonJsClasses("appns/b1/Class1");
 }
Esempio n. 6
0
 @Before
 public void initTestObjects() throws Exception {
   given(brjs)
       .automaticallyFindsAssetLocationPlugins()
       .and(brjs)
       .automaticallyFindsAssetPlugins()
       .and(brjs)
       .automaticallyFindsContentPlugins()
       .and(brjs)
       .hasTagHandlerPlugins(
           new MockTagHandler("tagToken", "dev replacement", "prod replacement", false),
           new MockTagHandler("localeToken", "", "", true))
       .and(brjs)
       .hasContentPlugins(new MockContentPlugin())
       .and(brjs)
       .hasContentPlugins(new AppMetadataContentPlugin())
       .and(brjs)
       .hasBeenCreated();
   app = brjs.app("app1");
   defaultAspect = app.aspect("default");
   alternateAspect = app.aspect("alternate");
   workbench = app.bladeset("bs").blade("b1").workbench();
 }
Esempio n. 7
0
 @Test
 public void multipleAspectsAreDiscoveredWhenThereAreOtherDirectories() throws Exception {
   given(app)
       .hasBeenCreated()
       .and(app)
       .hasDir("a-folder")
       .and(app)
       .hasDir("another-aspect")
       .and(app)
       .hasDir("default-aspect")
       .and(app)
       .hasDir("aspect1-aspect")
       .and(app)
       .hasDir("aspect2-aspect")
       .and(app)
       .hasDir("some-other-folder");
   /* then */ assertEquals(
       Arrays.asList(
           app.aspect("default"),
           app.aspect("another"),
           app.aspect("aspect1"),
           app.aspect("aspect2")),
       app.aspects());
 }
  @Override
  protected void doCommand(JSAPResult parsedArgs)
      throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("app-name");
    String disclaimer = "/*\n* " + parsedArgs.getString("disclaimer") + "\n*/\n\n";
    App app = brjs.app(appName);

    if (!app.dirExists())
      throw new CommandArgumentsException("Could not find application '" + appName + "'", this);

    File destinationZipLocation =
        new File(brjs.storageDir("exported-app").getAbsolutePath() + "/" + appName + ".zip");

    try {
      File temporaryExportDir = FileUtility.createTemporaryDirectory(appName);

      IOFileFilter excludeUserLibraryTestsFilter = createExcludeUserLibsTestsFilter(appName);
      NotFileFilter brjsJarFilter =
          new NotFileFilter(
              new AndFileFilter(new PrefixFileFilter("brjs-"), new SuffixFileFilter(".jar")));
      IOFileFilter combinedFilter =
          new AndFileFilter(new ExcludeDirFileFilter("js-test-driver", "bundles"), brjsJarFilter);

      combinedFilter = new AndFileFilter(combinedFilter, excludeUserLibraryTestsFilter);

      createResourcesFromSdkTemplate(app.dir(), temporaryExportDir, combinedFilter);
      includeDisclaimerInDirectoryClasses(new File(temporaryExportDir, "libs"), disclaimer);
      FileUtility.zipFolder(temporaryExportDir, destinationZipLocation, false);
    } catch (Exception e) {
      throw new CommandOperationException(
          "Could not create application zip for application '" + appName + "'", e);
    }

    logger.info("Successfully exported application '" + appName + "'");
    logger.info(" " + destinationZipLocation.getAbsolutePath());
  }
Esempio n. 9
0
 @Test
 public void defaultAspectCanHaveItsOwnDirectory() throws Exception {
   given(app).hasBeenCreated().and(app).containsFile("default-aspect/index.html");
   then(app.defaultAspect()).dirExists().and(app.defaultAspect()).hasFile("index.html");
 }
Esempio n. 10
0
 @Test
 public void defaultAspectIsCorrectlyIdentified() throws Exception {
   given(app).hasBeenCreated().and(app).containsFile("index.html");
   then(app.defaultAspect()).dirExists().and(app.defaultAspect()).hasFile("index.html");
 }
Esempio n. 11
0
 @Test
 public void aspectsCannotHaveTheSameFormatAsLanguageAndCountryLocale() throws Exception {
   then((NamedNode) app.aspect("my_AS")).nameIsInvalid();
 }