Skip to content

Commit

Permalink
Revert "Ref #8 Changing directory structure"
Browse files Browse the repository at this point in the history
This reverts commit f3f2d98.
  • Loading branch information
kkazmierczyk committed Nov 9, 2024
1 parent 81485b4 commit 32f8820
Show file tree
Hide file tree
Showing 42 changed files with 16 additions and 18 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/javacore-analyser/constants.py → constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"

# Web application constants
DEFAULT_REPORTS_DIR = "../../reports"
DEFAULT_REPORTS_DIR = "reports"
DEFAULT_PORT = 5000
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 9 additions & 15 deletions src/javacore-analyser/javacore_set.py → javacore_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from pathlib import Path
from xml.dom.minidom import parseString

import importlib_resources
from lxml import etree
from lxml.etree import XMLSyntaxError

Expand Down Expand Up @@ -112,20 +111,15 @@ def generate_report_files(self, output_dir):
def __create_output_files_structure(self, output_dir):
if not os.path.isdir(output_dir):
os.mkdir(output_dir)
data_output_dir = output_dir + '/data'
if os.path.isdir(data_output_dir):
shutil.rmtree(data_output_dir, ignore_errors=True)
logging.info("Data dir: " + data_output_dir)

# In pip package we have to access file by resource, not directly by filename
style_css_resource = importlib_resources.files("javacore-analyser") / "data" / "style.css"
data_dir = os.path.dirname(style_css_resource)
os.mkdir(data_output_dir)
shutil.copytree(data_dir, data_output_dir, dirs_exist_ok=True)
data_dir = output_dir + '/data'
if os.path.isdir(data_dir):
shutil.rmtree(data_dir, ignore_errors=True)
logging.info("Data dir: " + data_dir)
shutil.copytree("data", data_dir, dirs_exist_ok=True)

def __generate_htmls_for_threads(self, output_dir, temp_dir_name):
self.create_xml_xsl_for_collection(temp_dir_name + "/threads",
output_dir + "/data/xml/threads/thread",
"data/xml/threads/thread",
self.threads,
"thread")
self.generate_htmls_from_xmls_xsls(self.report_xml_file,
Expand All @@ -134,7 +128,7 @@ def __generate_htmls_for_threads(self, output_dir, temp_dir_name):

def __generate_htmls_for_javacores(self, output_dir, temp_dir_name):
self.create_xml_xsl_for_collection(temp_dir_name + "/javacores",
output_dir + "/data/xml/javacores/javacore",
"data/xml/javacores/javacore",
self.javacores,
"")
self.generate_htmls_from_xmls_xsls(self.report_xml_file,
Expand Down Expand Up @@ -463,8 +457,8 @@ def get_javacore_set_in_xml(self):
def __create_index_html(input_dir, output_dir):

# Copy index.xml and report.xsl to temp - for index.html we don't need to generate anything. Copying is enough.
shutil.copy2(output_dir + "/data/xml/index.xml", input_dir)
shutil.copy2(output_dir + "/data/xml/report.xsl", input_dir)
shutil.copy2("data/xml/index.xml", input_dir)
shutil.copy2("data/xml/report.xsl", input_dir)

xslt_doc = etree.parse(input_dir + "/report.xsl")
xslt_transformer = etree.XSLT(xslt_doc)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file removed src/javacore-analyser/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#
# Copyright IBM Corp. 2024 - 2024
# SPDX-License-Identifier: Apache-2.0
#
2 changes: 1 addition & 1 deletion test/test_code_snapshot_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import unittest

from code_snapshot_collection import CodeSnapshotCollection
from java_thread import Thread
from javacore_analyser.code_snapshot_collection import CodeSnapshotCollection
from thread_snapshot import ThreadSnapshot


Expand Down
2 changes: 1 addition & 1 deletion test/test_javacore_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_api(self):

test_failed = False
try:
javacore_analyzer.process_javacores_and_generate_report_data([], "tmp")
javacore_analyzer.process_javacores_and_generate_report_data([],"tmp")
except RuntimeError:
test_failed = True
self.assertTrue(test_failed, "API on missing javacores should fail but finished successfully")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 32f8820

Please sign in to comment.