Skip to content

Commit

Permalink
Added version number to is-alive endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
bcdasilv committed Nov 6, 2023
1 parent 25faf63 commit e3a1749
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion com.teamscale.polarion.plugin/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Teamscale Polarion Plugin
Bundle-SymbolicName: com.teamscale.polarion.plugin;singleton:=true
Bundle-Version: 0.0.2
Bundle-Version: 0.0.4
Import-Package: com.google.gson;version="2.8.9"
Require-Bundle: com.polarion.portal.tomcat;bundle-version="9.0.53",
com.polarion.alm.tracker;bundle-version="3.22.2"
Expand Down
3 changes: 2 additions & 1 deletion com.teamscale.polarion.plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

description = "Teamscale Polarion plugin for Polarion v22 R2"

version = '0.0.3'
version = '0.0.4'


sourceSets {
Expand Down Expand Up @@ -44,6 +44,7 @@ jar {
}
manifest {
from 'META-INF/MANIFEST.MF'
attributes 'Bundle-Version': version
}
exclude('com/teamscale/polarion/plugin/client')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package com.teamscale.polarion.plugin;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Properties;
import java.util.jar.Attributes;
import java.util.jar.Manifest;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
* This servlet defines the /is-alive endpoint. It'll return either a 200 with a string representing
* the 'is alive' or an http error (e.g., 404, 500, 403, etc) depending on the scenario.
Expand All @@ -26,7 +34,11 @@ protected void doGet(final HttpServletRequest req, final HttpServletResponse res
throws ServletException, IOException {
res.setContentType("text/plain");
PrintWriter out = res.getWriter();
out.print("Alive! I'm ready to crunch some work items!");
URL manifestUrl = IsAliveServlet.class.getResource("/META-INF/MANIFEST.MF");
Manifest manifest = new Manifest(manifestUrl.openStream());
Attributes attrs = manifest.getMainAttributes();
String version = attrs.getValue("Bundle-Version");
out.print("Alive! I'm ready to crunch some work items! v" + version);
}

/**
Expand All @@ -44,4 +56,5 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
doGet(req, resp);
}

}

0 comments on commit e3a1749

Please sign in to comment.