From 6bbfc1b6811cbc58fa67105e6c34214487d91a3c Mon Sep 17 00:00:00 2001 From: rollno748 Date: Tue, 1 Aug 2023 00:36:33 +0100 Subject: [PATCH 1/8] Updated config props --- src/main/resources/config.properties | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/resources/config.properties b/src/main/resources/config.properties index 1a775d6..9057f6c 100644 --- a/src/main/resources/config.properties +++ b/src/main/resources/config.properties @@ -2,9 +2,10 @@ jmeter.repo.url=https://jmeter-plugins.org/repo/ #Directory Properties -#local.repo.path=/app/performance/di-repo -local.repo.path=/Users/mi185051/app/di-repo/ -local.repo.plugins.path=/Users/mi185051/app/di-repo/plugins/ -local.repo.lib.path=/Users/mi185051/app/di-repo/libs/ -repo.hostname=diperformance.dca.diginsite.net -repo.hostname.path=/projects/di-repo \ No newline at end of file +local.repo.path=/app/performance/jmeter/repo/ +local.repo.plugins.path=/app/performance/jmeter/repo/plugins +local.repo.lib.path=/app/performance/jmeter/repo/libs/ + +#Repo hostname info +repo.hostname=localhost +#repo.hostname.path=/projects/repo \ No newline at end of file From 12b157affe5a39d650fec88f44b64f12c23152fe Mon Sep 17 00:00:00 2001 From: rollno748 Date: Tue, 1 Aug 2023 21:00:05 +0100 Subject: [PATCH 2/8] Updated some xhanges --- src/main/java/com/perftalks/jmeter/app/{App.java => Manager.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/com/perftalks/jmeter/app/{App.java => Manager.java} (100%) diff --git a/src/main/java/com/perftalks/jmeter/app/App.java b/src/main/java/com/perftalks/jmeter/app/Manager.java similarity index 100% rename from src/main/java/com/perftalks/jmeter/app/App.java rename to src/main/java/com/perftalks/jmeter/app/Manager.java From a7999e1381c515874999603913d63491d6a9eaeb Mon Sep 17 00:00:00 2001 From: rollno748 Date: Wed, 23 Aug 2023 20:09:18 +0100 Subject: [PATCH 3/8] Added app --- .../java/com/perftalks/jmeter/app/App.java | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/main/java/com/perftalks/jmeter/app/App.java diff --git a/src/main/java/com/perftalks/jmeter/app/App.java b/src/main/java/com/perftalks/jmeter/app/App.java new file mode 100644 index 0000000..15f9423 --- /dev/null +++ b/src/main/java/com/perftalks/jmeter/app/App.java @@ -0,0 +1,49 @@ +package com.perftalks.jmeter.app; + +import java.io.File; +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Properties; +import java.util.logging.Logger; + +import org.json.JSONArray; + +import com.perftalks.jmeter.repo.rest.HTTPRequests; +import com.perftalks.jmeter.repo.utils.DirOps; +import com.perftalks.jmeter.repo.utils.LoadMap; +import com.perftalks.jmeter.repo.utils.Plugins; + +public class App { + + private static final Logger LOGGER = Logger.getLogger(App.class.getName()); + private static LoadMap load = new LoadMap(); + private final Properties props; + + + public App(Properties props) { + this.props = props; + } + + public void execute() throws MalformedURLException, IOException { + + Plugins plugins = new Plugins(props); + File repoPath = new File(props.getProperty("local.repo.plugins.path")); + + if(!repoPath.exists()) { + DirOps.createDir(props.getProperty("local.repo.plugins.path")); + } + + JSONArray jmeterJson = HTTPRequests.get(props.getProperty("jmeter.repo.url")); + if (!jmeterJson.isEmpty()) { + LOGGER.info("Plugins sync started"); + plugins.downloadMissingPlugins(load.ConvertToMap(jmeterJson)); + LOGGER.info("Updating Plugins Json for DI-Internal"); + plugins.UpdateJsonPluginsInfo(jmeterJson, props); + LOGGER.info("Plugins sync completed"); + } else { + LOGGER.info("Failed to connect to Internet, Check your Internet settings.."); + System.exit(1); + } + + } +} \ No newline at end of file From 08f19a4ff5136f5b46d31edaaa83319ef10510cc Mon Sep 17 00:00:00 2001 From: rollno748 Date: Wed, 23 Aug 2023 20:10:58 +0100 Subject: [PATCH 4/8] Removing redundent class --- .../com/perftalks/jmeter/app/Manager.java | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/main/java/com/perftalks/jmeter/app/Manager.java diff --git a/src/main/java/com/perftalks/jmeter/app/Manager.java b/src/main/java/com/perftalks/jmeter/app/Manager.java deleted file mode 100644 index 492eeaf..0000000 --- a/src/main/java/com/perftalks/jmeter/app/Manager.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.perftalks.jmeter.app; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Properties; -import java.util.logging.Logger; - -import org.json.JSONArray; - -import com.perftalks.jmeter.repo.rest.HTTPRequests; -import com.perftalks.jmeter.repo.utils.DirOps; -import com.perftalks.jmeter.repo.utils.LoadMap; -import com.perftalks.jmeter.repo.utils.Plugins; - -public class App { - - private static final Logger LOGGER = Logger.getLogger(App.class.getName()); - private static LoadMap load = new LoadMap(); - private final Properties props; - - - public App(Properties props) { - this.props = props; - } - - public void execute() throws MalformedURLException, IOException { - - Plugins plugins = new Plugins(props); - File repoPath = new File(props.getProperty("local.repo.plugins.path")); - - if(!repoPath.exists()) { - DirOps.createDir(props.getProperty("local.repo.plugins.path")); - } - - JSONArray jmeterJson = HTTPRequests.get(props.getProperty("jmeter.repo.url")); - if (!jmeterJson.isEmpty()) { - LOGGER.info("Plugins sync started"); - plugins.downloadMissingPlugins(load.ConvertToMap(jmeterJson)); - LOGGER.info("Updating Plugins Json for DI-Internal"); - plugins.UpdateJsonPluginsInfo(jmeterJson, props); - LOGGER.info("Plugins sync completed"); - } else { - LOGGER.info("Failed to connect to Internet, Check your Internet settings.."); - System.exit(1); - } - - } -} From b5fb0f1ceb2ec74b08fb9ba045a8ff4e4c870eb5 Mon Sep 17 00:00:00 2001 From: rollno748 Date: Wed, 23 Aug 2023 20:15:52 +0100 Subject: [PATCH 5/8] updated pom --- pom.xml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 54918af..3d3d3b6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.perftalks.jmeter.pluginsmanager jmeter-local-plugins-manager - 2.0 + 1.0 2.8.2 LATEST @@ -43,12 +43,9 @@ true lib/ - com.perftalks.jmeter.app.PluginsManager + com.perftalks.jmeter.app.AppRunner - - jar-with-dependencies - From 066cbae8328c7be80ab02f7efe25457719cb8b51 Mon Sep 17 00:00:00 2001 From: rollno748 Date: Tue, 5 Sep 2023 11:09:42 +0100 Subject: [PATCH 6/8] removing old directories --- .../java/com/perftalks/jmeter/app/App.java | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 src/main/java/com/perftalks/jmeter/app/App.java diff --git a/src/main/java/com/perftalks/jmeter/app/App.java b/src/main/java/com/perftalks/jmeter/app/App.java deleted file mode 100644 index 15f9423..0000000 --- a/src/main/java/com/perftalks/jmeter/app/App.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.perftalks.jmeter.app; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Properties; -import java.util.logging.Logger; - -import org.json.JSONArray; - -import com.perftalks.jmeter.repo.rest.HTTPRequests; -import com.perftalks.jmeter.repo.utils.DirOps; -import com.perftalks.jmeter.repo.utils.LoadMap; -import com.perftalks.jmeter.repo.utils.Plugins; - -public class App { - - private static final Logger LOGGER = Logger.getLogger(App.class.getName()); - private static LoadMap load = new LoadMap(); - private final Properties props; - - - public App(Properties props) { - this.props = props; - } - - public void execute() throws MalformedURLException, IOException { - - Plugins plugins = new Plugins(props); - File repoPath = new File(props.getProperty("local.repo.plugins.path")); - - if(!repoPath.exists()) { - DirOps.createDir(props.getProperty("local.repo.plugins.path")); - } - - JSONArray jmeterJson = HTTPRequests.get(props.getProperty("jmeter.repo.url")); - if (!jmeterJson.isEmpty()) { - LOGGER.info("Plugins sync started"); - plugins.downloadMissingPlugins(load.ConvertToMap(jmeterJson)); - LOGGER.info("Updating Plugins Json for DI-Internal"); - plugins.UpdateJsonPluginsInfo(jmeterJson, props); - LOGGER.info("Plugins sync completed"); - } else { - LOGGER.info("Failed to connect to Internet, Check your Internet settings.."); - System.exit(1); - } - - } -} \ No newline at end of file From b6b938f4f4ac3a00f1b52cefbaec45e7dbf0d2fc Mon Sep 17 00:00:00 2001 From: rollno748 Date: Wed, 6 Sep 2023 08:09:42 +0100 Subject: [PATCH 7/8] Updated Readme --- README.md | 73 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3b5e963..e9da1f9 100644 --- a/README.md +++ b/README.md @@ -1,52 +1,73 @@ -# Jmeter-local-plugins-manager -Intranet Plugin Manager for JMeter - which downloads the plugins from internet periodically. - -## Motive -Some organization will not have/provide access to internet on certain hosts - This will enable the team to create an own server to manage the plugins - -## Features -1. Downloads the plugins, and it's associated dependent libraries to local storage. -2. Stores all the information to SQLITE DB. -3. Enables a UI to upload custom plugin which are restricted to share outside of organization. -4. Creates and exposes modified API with to get the Plugins info for Jmeter Plugin manager -5. Easily configurable scheduler to check for the newly available plugins/versions in the market. +# JMeter local plugins manager +Intranet Plugin Manager for JMeter - Periodically downloads plugins from the internet. +## Motive +In situations where specific hosts lack internet access, this tool enables the team to establish a dedicated server for managing plugins within the organization. ## Required Components 1. Java 8 or above -## Architecture +## Creating Properties file +create an properties file with the below contents. +```sh +server.port=2222 +server.uri.path=/v1 -## How to Set up +# Scheduler interval (in ms) +scheduler.interval=86400000 + +# DB Connection Pool configuration +db.min.threads=2 +db.max.threads=10 +db.timeout.secs=300 + +# External APIs +jmeter.plugins.url=https://jmeter-plugins.org/repo/ +mvn.repo.url=https://mvnrepository.com/search?q= -* Download the source code and compile or Download the releases -* Create config to override configuration for application -* Run the jar (java -jar jmeter-local-plugins-manager-2.0.jar) +# Directory Configs +local.repo.path=/app/plugins-manager/ +# Uncomment the below if you are running this on Windows +local.repo.path=C:\\Temp\\plugins-manager\\ +``` ## Available APIs | Service | HTTP Method | URI | |:-------------------|:-----------:|:----------------------------------------| | App Running Status | GET | http://:\/v1/ | -| Upload Plugin | GET | http://:\/v1/upload | | Get Plugins | GET | http://:\/v1/plugins | +| Upload Custom Plugin | GET | http://:\/v1/upload | +## How to Set up + +* Download the Latest release from here +* Create `configuration.properties` file +* Run the JAR (java -jar jmeter-local-plugins-manager-2.0.jar -c configuration.properties) +* Go to the JMeter installed directory and set jpgc.repo.address (this should be the local plugins manager API) in the jmeter.properties + +## Features +1. Downloads plugins and their associated dependent libraries to local storage. +2. Stores all information in an SQLITE DB. +3. Provides a UI to upload custom plugins restricted to sharing within the organization. +4. Creates and exposes a modified API to retrieve plugin info for JMeter Plugin Manager. +5. Easily configurable scheduler to check for newly available plugins/versions in the market. + ## Uploading Custom plugin ![Custom Upload Form](/img/upload-form.jpg) - ## How it works ? -* Its acts as an independent server which polls plugins manager for update (which is configurable) -* It creates the required directories to store the plugins and its dependencies to the local -* It checks the permission on the local directories before storing the files -* Exposes 3 APIs in intranet - - Public plugins api - - Custom Plugins api - - Merged (Public and Custom) Plugins api +* Acts as an independent server that polls the plugins manager for updates (configurable). +* Creates the required directories to store plugins and their dependencies locally. +* Checks permissions on local directories before storing files. +* Exposes 3 APIs in the intranet: + - Public plugins API + - Custom Plugins API + - Merged (Public and Custom) Plugins API ## Tools used - Spark java framework From 6905b86de4df2f257d35b6c06136bbb8a7179e9d Mon Sep 17 00:00:00 2001 From: rollno748 Date: Wed, 6 Sep 2023 08:15:12 +0100 Subject: [PATCH 8/8] Updated Readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e9da1f9..87b68e9 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ In situations where specific hosts lack internet access, this tool enables the t 1. Java 8 or above ## Creating Properties file -create an properties file with the below contents. +create a properties file with the below contents. ```sh server.port=2222 @@ -44,10 +44,10 @@ local.repo.path=C:\\Temp\\plugins-manager\\ ## How to Set up -* Download the Latest release from here +* Download the Latest release from [here](https://github.com/rollno748/Jmeter-local-plugins-manager/tags) * Create `configuration.properties` file * Run the JAR (java -jar jmeter-local-plugins-manager-2.0.jar -c configuration.properties) -* Go to the JMeter installed directory and set jpgc.repo.address (this should be the local plugins manager API) in the jmeter.properties +* Go to the JMeter installed directory and set `jpgc.repo.address` (this should be the local plugins manager API) in the jmeter.properties ## Features 1. Downloads plugins and their associated dependent libraries to local storage.