Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f25169b
Merge pull request #665 from naver/release/3.5.2
songeunwoo Sep 29, 2020
094e019
Fix case unintended reset of followers at login
donggyu04 Oct 8, 2020
c565dbc
Move cache of recently used agents to distribution map
donggyu04 Oct 8, 2020
63b6711
Rename cache
donggyu04 Oct 13, 2020
d21e1e6
Make the modified file distribution handler to be loaded first
donggyu04 Oct 15, 2020
319feb4
Add .gitattributes
donggyu04 Oct 16, 2020
6f96eb6
Merge pull request #673 from naver/feature/add-gitattributes
songeunwoo Oct 16, 2020
4d37b16
Make the H2 console optionally available
donggyu04 Oct 16, 2020
ae9715c
Merge pull request #672 from naver/feature/move-file-dist-handler-to-…
songeunwoo Oct 19, 2020
b95687b
Merge pull request #668 from naver/feature/move-recent-agent-cache-to…
songeunwoo Oct 19, 2020
0a95a77
Merge pull request #675 from naver/feature/make-h2-console-optionally…
songeunwoo Oct 19, 2020
5ef4511
Prevent lazy initialize exception in spring security authentication o…
donggyu04 Oct 8, 2020
cae2f52
Fix failed unit test
donggyu04 Oct 22, 2020
aba46f5
Merge pull request #669 from naver/bugfix/prevent-lazy-initialize-exc…
imbyungjun Oct 27, 2020
92109fb
Support UTC
donggyu04 Oct 19, 2020
d9926d3
Rename column
donggyu04 Oct 22, 2020
0e50ccd
Use vuejs-datepicker
donggyu04 Oct 27, 2020
2618488
Prevent NEP if start console is failed
donggyu04 Oct 28, 2020
fd40a3c
Escape response body in result console
donggyu04 Oct 28, 2020
67c0250
Merge pull request #682 from naver/bugfix/escape-response-body-in-res…
songeunwoo Oct 28, 2020
9eb50e5
Merge pull request #676 from naver/feature/make-to-use-utc
songeunwoo Oct 29, 2020
b1e7ccf
Reduce range of global css
donggyu04 Oct 29, 2020
b2ed870
Merge pull request #683 from naver/feature/reduce-range-of-global-css
imbyungjun Oct 29, 2020
1f41a99
Add abnormal testing status category
donggyu04 Oct 30, 2020
5bda279
Prevent test start button flickering
donggyu04 Oct 29, 2020
4adea12
Fix unstoppable abnormal test
donggyu04 Oct 30, 2020
cd9a664
Merge pull request #685 from naver/feature/prevent-test-start-button-…
songeunwoo Nov 4, 2020
3af9ea8
Merge pull request #684 from naver/bugfix/unstoppable-abnormal-test
songeunwoo Nov 4, 2020
2268bf7
Add identity information to perftest related log
donggyu04 Nov 2, 2020
a5a3a4a
Merge pull request #686 from naver/feature/enhance-logging
songeunwoo Nov 5, 2020
4396235
Remove @Index from entity
donggyu04 Oct 22, 2020
0a68ea2
Use try-with-resource
donggyu04 Oct 22, 2020
6bfcd86
Change deprecated method
donggyu04 Oct 22, 2020
454dbaa
Remove unnecessary code
donggyu04 Oct 22, 2020
64e4444
Use lambda expression
donggyu04 Oct 23, 2020
8a9419d
Use constructor based dependency injection
donggyu04 Oct 23, 2020
81b8c17
Fix ambiguous code
donggyu04 Oct 23, 2020
64614de
Use double quotes in build.gradle
donggyu04 Oct 28, 2020
b7fff69
Append final keyword to unmodifiable variables
donggyu04 Nov 2, 2020
a12cb2f
Attach @SuppressWarnings
donggyu04 Nov 3, 2020
986c0ec
Remove pre-sized array
donggyu04 Nov 4, 2020
8153da1
Simplify code
donggyu04 Nov 4, 2020
8a07f3d
Merge pull request #679 from naver/feature/clean-up-code
songeunwoo Nov 5, 2020
143bac6
Fix agent updating doesn't work
donggyu04 Nov 10, 2020
2828889
Merge pull request #688 from naver/bugfix/fix-agent-updating-does-not…
imbyungjun Nov 11, 2020
6078bb6
Add bintray gradle configuration
donggyu04 Nov 4, 2020
20a3798
Merge pull request #687 from naver/feature/publish-to-bintray
songeunwoo Nov 20, 2020
ab7fbe8
Check property existence in bintray gradle configuration
donggyu04 Nov 23, 2020
b881228
Merge pull request #691 from naver/feature/fix-bintray-gradle-configu…
songeunwoo Nov 23, 2020
83efc62
Remove embedded maven
donggyu04 Nov 11, 2020
73c935a
Support groovy gradle project script
donggyu04 Nov 16, 2020
4161f3c
Update docker file to install Maven and Gradle
donggyu04 Nov 24, 2020
37c7147
Merge pull request #689 from naver/feature/support-gradle-groovy
songeunwoo Nov 27, 2020
a8823d4
Bump version up to 3.5.3
donggyu04 Nov 27, 2020
9ebf7d8
Update RELEASE-NOTE.md
donggyu04 Nov 27, 2020
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
Prev Previous commit
Next Next commit
Support groovy gradle project script
  • Loading branch information
donggyu04 committed Nov 26, 2020
commit 73c935aed1fd6ec47b4e467d91175e3ba94b01b7
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public interface CacheConstants {
String CACHE_USER_ENTITY = "org.ngrinder.model.User";

String LOCAL_CACHE_GITHUB_SCRIPTS = "github_scripts";
String LOCAL_CACHE_GITHUB_IS_MAVEN_GROOVY = "github_is_maven_groovy";
String LOCAL_CACHE_GITHUB_GROOVY_PROJECT_SCRIPT_TYPE = "github_groovy_project_script_type";

int REGION_CACHE_TIME_TO_LIVE_SECONDS = 20;
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public CacheConfigHolder cacheConfigMap() {
cm.addLocalCache(LOCAL_CACHE_RIGHT_PANEL_ENTRIES, 1 * DAY, 1);
cm.addLocalCache(LOCAL_CACHE_LEFT_PANEL_ENTRIES, 1 * DAY, 1);
cm.addLocalCache(LOCAL_CACHE_CURRENT_PERFTEST_STATISTICS, 5, 1);
cm.addLocalCache(LOCAL_CACHE_GITHUB_IS_MAVEN_GROOVY, 5 * MIN, 300);
cm.addLocalCache(LOCAL_CACHE_GITHUB_GROOVY_PROJECT_SCRIPT_TYPE, 5 * MIN, 300);
return cm;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package org.ngrinder.infra.spring.listener;

import com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider;
import org.springframework.boot.context.event.ApplicationPreparedEvent;
import org.springframework.boot.context.event.ApplicationContextInitializedEvent;
import org.springframework.context.ApplicationListener;

import javax.cache.Caching;
import javax.cache.spi.CachingProvider;
import java.util.Iterator;

import static org.ngrinder.starter.InstallationChecker.checkAll;

/**
* @since 3.5.0
* */
public class ApplicationPreparedListener implements ApplicationListener<ApplicationPreparedEvent> {
public class ApplicationPreparedListener implements ApplicationListener<ApplicationContextInitializedEvent> {

@SuppressWarnings("NullableProblems")
@Override
public void onApplicationEvent(ApplicationPreparedEvent event) {
public void onApplicationEvent(ApplicationContextInitializedEvent event) {
removeCacheProviderExceptCaffeineCacheProvider();
checkAll();
}

/**
Expand All @@ -31,4 +34,5 @@ private static void removeCacheProviderExceptCaffeineCacheProvider() {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ public ScriptHandler prepareDistribution(PerfTest perfTest) throws IOException {
String scriptName = perfTest.getScriptName();
gitHubFileEntryService.checkoutGitHubScript(perfTest, ghRepository, gitHubConfig);
scriptEntry = gitHubFileEntryService.getOne(ghRepository, gitHubConfig, scriptName);
gitHubFileEntryService.evictGitHubMavenGroovyCache(ghRepository, scriptName, gitHubConfig.getBranch());
gitHubFileEntryService.evictGitHubGroovyProjectScriptTypeCache(ghRepository, scriptName, gitHubConfig.getBranch());
} else {
scriptEntry = checkNotNull(
fileEntryService.getOne(user,
Expand All @@ -680,7 +680,8 @@ public ScriptHandler prepareDistribution(PerfTest perfTest) throws IOException {
} catch (IOException e) {
noOp();
}
throw processException("Error while file distribution is prepared.");
throw processException("Error while file distribution is prepared.\n" +
"If you run groovy project type script, Please check your build script and make sure Maven or Gradle is installed.");
}
return handler;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
* Copyright (c) 2012-present NAVER Corp.
*
* This file is part of The nGrinder software distribution. Refer to
* the file LICENSE which is part of The nGrinder distribution for
* licensing details. The nGrinder distribution is available on the
* Internet at https://naver.github.io/ngrinder
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ngrinder.script.handler;

import org.apache.commons.io.IOUtils;
import org.ngrinder.common.util.PathUtils;
import org.ngrinder.infra.config.Config;
import org.ngrinder.model.User;
import org.ngrinder.script.model.FileEntry;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import static java.lang.System.getenv;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.Paths.get;
import static org.apache.commons.io.FileUtils.deleteQuietly;
import static org.apache.commons.io.FilenameUtils.normalize;
import static org.apache.commons.lang.StringUtils.EMPTY;
import static org.apache.commons.lang.StringUtils.isNotEmpty;
import static org.ngrinder.common.util.AccessUtils.getSafe;
import static org.ngrinder.common.util.CollectionUtils.buildMap;
import static org.ngrinder.common.util.ExceptionUtils.processException;
import static org.ngrinder.common.util.UrlUtils.getHost;
import static org.ngrinder.script.model.FileCategory.SCRIPT;
import static org.ngrinder.script.model.FileType.DIR;

/**
* Groovy gradle project {@link ScriptHandler}.
*
* @since 3.5.3
*/
@Component
public class GroovyGradleProjectScriptHandler extends GroovyProjectScriptHandler {

public static final String GRADLE_HOME_ENV_NAME = "GRADLE_HOME";

private final String ngrinderHomePath;
private String gradlePath;

public GroovyGradleProjectScriptHandler(Config config) {
super("groovy_gradle", "", "Groovy Gradle Project", "groovy", "build.gradle", true);

gradlePath = getSafe(getenv(GRADLE_HOME_ENV_NAME), "");
if (isNotEmpty(gradlePath)) {
gradlePath += "/bin/";
}

ngrinderHomePath = config.getHome().getDirectory().getAbsolutePath();
}

@Override
protected String getCopyDependenciesCommand(File distDir) {
String distDirPath = distDir.getAbsolutePath();
return gradlePath + "gradle -I " + ngrinderHomePath + "/init.gradle -p" + distDirPath +
" __copyDependencies -PoutputDirectory=" + distDirPath + "/lib";
}

@Override
protected boolean isSuccess(List<String> results) {
if (results.isEmpty()) {
return false;
}
return results.stream().noneMatch(str -> str.contains("FAILED"));
}

@Override
public boolean prepareScriptEnv(User user, String path, String fileName, String name, // LF
String url, boolean createLib, String scriptContent) {
path = PathUtils.join(path, fileName);
// Create Dir entry
createBaseDirectory(user, path);
// Create each template entries
createFileEntries(user, path, name, url, scriptContent);
if (createLib) {
createLibraryDirectory(user, path);
}
return false;
}

@Override
protected void deleteUnnecessaryFilesFromDist(File distDir) {
super.deleteUnnecessaryFilesFromDist(distDir);
deleteQuietly(new File(distDir, ".gradle"));
}

private void createFileEntries(User user, String path, String name, String url, String scriptContent) {
String[] scriptTemplatePaths = { getBuildScriptName(), "src/main/resources/resource1.txt", "src/main/java/TestRunner.groovy" };
for (String scriptTemplatePath : scriptTemplatePaths) {
try (InputStream inputStream = new ClassPathResource("/script_template/groovy_gradle/" + scriptTemplatePath).getInputStream()) {
String fileContent = IOUtils.toString(inputStream, UTF_8.name());
if (scriptTemplatePath.endsWith("TestRunner.groovy")) {
fileContent = scriptContent;
} else {
fileContent = fileContent.replace("${userName}", user.getUserName());
fileContent = fileContent.replace("${name}", name);
fileContent = fileContent.replace("${url}", url);
}
FileEntry fileEntry = new FileEntry();
fileEntry.setContent(fileContent);
fileEntry.setPath(normalize(PathUtils.join(path, scriptTemplatePath), true));
fileEntry.setDescription("create groovy gradle project");
String hostName = getHost(url);
if (isNotEmpty(hostName)
&& fileEntry.getFileType().getFileCategory() == SCRIPT) {
fileEntry.getProperties().put("targetHosts", getHost(url));
} else {
fileEntry.getProperties().put("targetHosts", EMPTY);
}
getFileEntryRepository().save(user, fileEntry, UTF_8.name());
} catch (IOException e) {
throw processException("Error while saving " + get(scriptTemplatePath).getFileName(), e);
}
}
}

private void createBaseDirectory(User user, String path) {
FileEntry dirEntry = new FileEntry();
dirEntry.setPath(path);
// Make it eclipse default folder ignored.
dirEntry.setProperties(buildMap("svn:ignore", ".project\n.classpath\n.settings\ntarget"));
dirEntry.setFileType(DIR);
dirEntry.setDescription("create groovy gradle project");
getFileEntryRepository().save(user, dirEntry, null);
}
}
Loading