Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modified apps folder search to look for apps instead of brjs-apps. #1417

Merged
merged 26 commits into from
Jun 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
003d320
Modified apps folder search to look for apps instead of brjs-apps.
ioanalianabalas Jun 3, 2015
88b98a4
Fixed merge issues.
ioanalianabalas Jun 4, 2015
f6f81cf
Removed brjs-apps folder and moved app.txt back into apps.
ioanalianabalas Jun 8, 2015
5020413
removing some unused fields in FileTestCommander
Jun 15, 2015
ed40b70
hardening the code that recreates the 'bundles' directory
Jun 15, 2015
4ea4e88
Added scenario for when the apps folder does not exist.
ioanalianabalas Jun 15, 2015
fc3330c
checking if bundle file exists rather than using the return code of
Jun 15, 2015
033c759
improving exception thrown when new bundle files cant be created
Jun 15, 2015
e20f475
logging when we attempt to create the empty bundle files and increasing
Jun 15, 2015
500c326
Fixed merge issues.
ioanalianabalas Jun 15, 2015
44aed9e
Fixed bug in checking whether 2 files partain to the same location.
ioanalianabalas Jun 15, 2015
d224ff4
ValidAppDirFileFilter only detects a valid app based on the existence…
ioanalianabalas Jun 15, 2015
8388d26
removing the repated attempt to create an empty bundle file
Jun 15, 2015
ca8be24
fixing bug in our 'deleteDirectoryFromBottomUp' code
Jun 15, 2015
b52a185
Added app.conf for the navigation tests.
ioanalianabalas Jun 16, 2015
bac25ba
Fixed failing app server tests.
ioanalianabalas Jun 16, 2015
7a6f37a
Merge branch 'bundle-file-writing-improvements-1426' into use-apps-fo…
ioanalianabalas Jun 16, 2015
ea9cc35
Fixed failing tests by adding missing app.conf file.
ioanalianabalas Jun 16, 2015
8082e6f
only logging discovered apps once they are first used
Jun 17, 2015
3e05530
adding an extra node discovery event test
Jun 17, 2015
d0c5e14
Merge branch 'develop' into use-apps-folder-for-brjs-apps-1408
Jun 17, 2015
345ae85
minor change to test
Jun 17, 2015
ab7c572
making sure apps aren't created inside of sdk/apps dir
Jun 17, 2015
4528f0d
removing System.err.println that shouldnt have been committed
Jun 17, 2015
a4a58b0
passing the 'sdk' into BRJS spec test constructor to match what happens
Jun 17, 2015
5cb4806
renaming 'testSdkDirectory' since it's badly named
Jun 17, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public void stopServer() throws Exception {
}

@After
public void deleteCreatedBrjsAppsDirFromTemp() throws IOException {
public void deleteCreatedAppsDirFromTemp() throws IOException {
if (secondaryTempFolder != null) FileUtils.deleteQuietly(secondaryTempFolder);
}

@Test @Ignore //TODO: this test is unreliable - fix it
public void fileWatcherDetectsChangesWhenBrjsAppsAtTheSameLevelAsSdk() throws Exception {
public void fileWatcherDetectsChangesWhenAppsAtTheSameLevelAsSdk() throws Exception {
given(brjs).hasBeenAuthenticallyCreatedWithFileWatcherThread();
App app = brjs.app("app1");
Aspect aspect = app.defaultAspect();
Expand All @@ -72,7 +72,7 @@ public void fileWatcherDetectsChangesWhenBrjsAppsAtTheSameLevelAsSdk() throws Ex
}

@Test @Ignore //TODO: this test is unreliable - fix it
public void fileWatcherPollsFolderBrjsAppsAtTheSameLevelAsSdk() throws Throwable {
public void fileWatcherPollsFolderAppsAtTheSameLevelAsSdk() throws Throwable {
given(brjs).hasBeenAuthenticallyCreatedWithFilePollingThread();
App app = brjs.app("app1");
Aspect aspect = app.defaultAspect();
Expand Down Expand Up @@ -148,10 +148,10 @@ public void exceptionIsThrownIfFileObserverValueIsInvalid() throws Throwable {
}

@Test @Ignore
public void fileWatcherDetectsChangesWhenBrjsAppsAtAnotherLevelThanTheSdk() throws Exception {
public void fileWatcherDetectsChangesWhenAppsAtAnotherLevelThanTheSdk() throws Exception {
secondaryTempFolder = org.bladerunnerjs.utility.FileUtils.createTemporaryDirectory(BRJSTest.class);
given(secondaryTempFolder).containsFolder("brjs-apps")
.and(brjs).hasBeenAuthenticallyCreatedWithFileWatcherThreadAndWorkingDir(new File(secondaryTempFolder, "brjs-apps"));
given(secondaryTempFolder).containsFolder("apps")
.and(brjs).hasBeenAuthenticallyCreatedWithFileWatcherThreadAndWorkingDir(new File(secondaryTempFolder, "apps"));
App app = brjs.app("app1");
Aspect aspect = app.defaultAspect();
given(app).hasBeenCreated()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class FileModificationRegistryThreadSafetyTest

@Before
public void setup() throws Exception {
testSdkDirectory = BRJSTestModelFactory.createTestSdkDirectory();
testSdkDirectory = BRJSTestModelFactory.createRootTestDir();
fileInRoot = new File(testSdkDirectory, "some-file.txt");
dirInRoot = new File(testSdkDirectory, "some-dir");
fileInChildDir = new File(dirInRoot, "nested-file.txt");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,25 +181,25 @@ public void fileVersionIsIncrementedForDeletedFilesInASubDirDir() throws Excepti
public void fileVersionIsIncrementedForDirsInASeperateAppsDirectory() throws Exception {
brjs.close();
secondaryTempFolder = org.bladerunnerjs.utility.FileUtils.createTemporaryDirectory(BRJSTest.class);
File brjsAppsDir = new File(secondaryTempFolder, "brjs-apps");
brjsAppsDir.mkdir();
File appsDir = new File(secondaryTempFolder, "apps");
appsDir.mkdir();

given(brjs).hasBeenCreatedWithWorkingDir(secondaryTempFolder);
modificationRegistry = brjs.getFileModificationRegistry();
fileObserver = fileObserverFactory.createObserver(brjs);
brjsDir = brjs.dir().getUnderlyingFile();

File dir1 = new File(brjsAppsDir, "dir1");
File dir1 = new File(appsDir, "dir1");
File file = new File(dir1, "someFile.txt");
file.getParentFile().mkdirs();
fileObserver.start();
long oldFileVersion = modificationRegistry.getFileVersion(file);
long oldDir1Version = modificationRegistry.getFileVersion(dir1);
long oldDir2Version = modificationRegistry.getFileVersion(brjsAppsDir);
long oldDir2Version = modificationRegistry.getFileVersion(appsDir);
file.createNewFile();
assertVersionIncreased(oldFileVersion, file);
assertVersionIncreased(oldDir1Version, dir1);
assertVersionIncreased(oldDir2Version, brjsAppsDir);
assertVersionIncreased(oldDir2Version, appsDir);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void main(String[] args) throws Exception {

@Before
public void initTestObjects() throws Exception {
testSdkDirectory = new File("../brjs-sdk/sdk/").getAbsoluteFile();
testRootDirectory = new File("../brjs-sdk/sdk/").getAbsoluteFile();
System.out.print("BRJS initialization: ");
long startTime = new Date().getTime();
given(brjs).hasBeenAuthenticallyCreated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void initTestObjects() throws Exception {
.and(brjs).hasContentPlugins(new MockContentPlugin())
.and(brjs).hasBeenCreated()
.and(brjs).localeSwitcherHasContents("locale-forwarder.js")
.and(brjs).containsFolder("brjs-apps")
.and(brjs).containsFolder("apps")
.and(brjs).containsFolder("sdk/system-applications");
brjs.bladerunnerConf().setJettyPort(appServerPort);
brjs.bladerunnerConf().write();
Expand Down Expand Up @@ -104,6 +104,8 @@ public void appIsDeployedWhenAppServerStarts() throws Exception
then(appServer).requestCanBeMadeFor("/app1")
.and(appServer).requestIs302Redirected("/","/dashboard")
.and(logging).infoMessageReceived(SERVER_STARTING_LOG_MSG, "BladeRunnerJS")
.and(logging).infoMessageReceived(BRJS.Messages.NO_APPS_DISCOVERED, "system")
.and(logging).infoMessageReceived(BRJS.Messages.APPS_DISCOVERED, "User", "app1")
.and(logging).infoMessageReceived(SERVER_STARTED_LOG_MESSAGE, appServerPort)
.and(logging).debugMessageReceived(DEPLOYING_APP_MSG, "app1");
}
Expand Down Expand Up @@ -216,6 +218,9 @@ public void otherServletsCanBeAddedWithRootMapping() throws Exception
.and(templates).templateGroupCreated()
.and(templates.template("app")).containsFile("fileForApp.txt")
.and(app1).hasBeenPopulated("default")
.and(app1).containsFileWithContents("app.conf", "localeCookieName: BRJS.LOCALE\n"
+ "locales: en\n"
+ "requirePrefix: app1")
.and(appServer).started()
.and(appServer).appHasServlet(app1, helloWorldServlet, "/servlet/hello/*");
then(appServer).requestForUrlReturns("/app1/servlet/hello", "Hello World!");
Expand All @@ -228,6 +233,9 @@ public void otherServletsCanBeAddedWithExtensionMapping() throws Exception
.and(templates).templateGroupCreated()
.and(templates.template("app")).containsFile("fileForApp.txt")
.and(app1).hasBeenPopulated("default")
.and(app1).containsFileWithContents("app.conf", "localeCookieName: BRJS.LOCALE\n"
+ "locales: en\n"
+ "requirePrefix: app1")
.and(appServer).started()
.and(appServer).appHasServlet(app1, helloWorldServlet, "*.mock");
then(appServer).requestForUrlReturns("/app1/hello.mock", "Hello World!");
Expand All @@ -248,7 +256,7 @@ public void newAppsAreAutomaticallyHostedWhenRunningCreateAppCommandFromADiffere
@Test
public void newAppsAreAutomaticallyHostedWhenRunningCreateAppCommandFromADifferentModelInstanceAndOnlyAppsDirectoryExists() throws Exception
{
given(brjs).doesNotContainFolder("brjs-apps")
given(brjs).doesNotContainFolder("apps")
.and(brjs).containsFolder("apps")
.and(brjs).hasBeenAuthenticallyCreated();
/*and*/ secondBrjsProcess.close(); secondBrjsProcess = createNonTestModel();
Expand Down Expand Up @@ -301,7 +309,7 @@ public void fileWatcherThreadDoesntThrowAnExceptionWhenAFileExistsInAppsDir() th
{
given(brjs).hasBeenAuthenticallyCreatedWithFileWatcherThread()
.and(templates).templateGroupCreated()
.and(brjs).containsFile("brjs-apps/file.txt")
.and(brjs).containsFile("apps/file.txt")
.and(brjs.applicationServer(appServerPort)).started();
when(secondBrjsProcess).runCommand("create-app", "app1", "blah")
.and(app1Conf).localesUpdatedTo("en", "de");
Expand All @@ -311,6 +319,9 @@ public void fileWatcherThreadDoesntThrowAnExceptionWhenAFileExistsInAppsDir() th
@Test
public void errorCode500IsThrownIfBadFileIsRequired() throws Exception {
given(app1.defaultAspect()).indexPageRequires("appns/App")
.and(app1).containsFileWithContents("app.conf", "localeCookieName: BRJS.LOCALE\n"
+ "locales: en\n"
+ "requirePrefix: app1")
.and(app1.defaultAspect()).classFileHasContent("appns/App", "require('badFile')")
.and(appServer).started();
then(appServer).requestForUrlContains("/app1/v/dev/js/dev/combined/bundle.js", "Error 500");
Expand All @@ -319,6 +330,9 @@ public void errorCode500IsThrownIfBadFileIsRequired() throws Exception {
@Test
public void errorCode400IsThrownIfTheRequestIsMalformed() throws Exception {
given(app1.defaultAspect()).indexPageHasContent("")
.and(app1).containsFileWithContents("app.conf", "localeCookieName: BRJS.LOCALE\n"
+ "locales: en\n"
+ "requirePrefix: app1")
.and(appServer).started();
then(appServer).requestForUrlContains("/app1/v/dev/js/malformed-request", "Error 400");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public void initTestObjects() throws Exception {
BladeWorkbench workbench = b1.workbench();

given(app).hasBeenPopulated("default")
.and(app).containsFileWithContents("app.conf", "localeCookieName: BRJS.LOCALE\n"
+ "locales: en\n"
+ "requirePrefix: appns")
.and(aspect).hasClass("appns/Class1")
.and(aspect).indexPageRefersTo("appns.Class1")
.and(b1).hasClass("appns/bs/b1/Class")
Expand Down
Loading