### Start Olog Service with Spring Boot Maven Plugin Source: https://github.com/olog/phoebus-olog/blob/master/README.md This command starts the Olog service directly using the Spring Boot Maven plugin. It's ideal for development and testing, allowing quick execution without needing to build a full deployable JAR first. ```shell mvn org.springframework.boot:spring-boot-maven-plugin:run ``` -------------------------------- ### Build Olog Service Deployable JAR Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_RUN.md Maven command to clean and install the Olog service, creating a deployable JAR artifact. ```Maven mvn clean install -Pdeployable-jar ``` -------------------------------- ### Simple Example: Olog API Up Check Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This test verifies that the Olog service is up and running. It performs an HTTP GET request to the Olog base URL and asserts that the response status code is 200 (HTTP_OK). ```Java @Test void ologUp() ``` -------------------------------- ### Run Olog Services with Docker Compose Source: https://github.com/olog/phoebus-olog/blob/master/README.md This command starts all Olog-related services, including Olog itself, Elasticsearch, and MongoDB, as Docker containers. It orchestrates the entire application stack for easy deployment and management. ```shell docker-compose up ``` -------------------------------- ### Comprehensive Build and Test Workflow with Maven Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_RUN.md Maven commands for a complete build and test cycle, including cleaning, installing, compiling, and running all unit and Docker-based integration tests. Options are provided for running with or without JaCoCo code coverage. ```Maven mvn clean install test-compile failsafe:integration-test failsafe:verify --batch-mode --fail-at-end -DskipITs=false -Pdeployable-jar -Pintegrationtest-docker ``` ```Maven mvn clean install test-compile failsafe:integration-test failsafe:verify --batch-mode --fail-at-end -Djacoco.skip=false -DskipITs=false -DskipITCoverage=false -Pdeployable-jar -Pintegrationtest-docker ``` -------------------------------- ### Example Login Request Body Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst An example JSON payload for authenticating with the Olog Phoebus login endpoint. This body should be sent with the POST request to the /Olog/login endpoint. ```json {"username":"johndoe", "password":"undisclosed"} ``` -------------------------------- ### Start Olog Service using Spring Boot Maven Plugin Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This command executes the Olog service application directly from the command line using the Spring Boot Maven plugin. It's typically used for local development and testing to quickly launch the service. ```shell mvn org.springframework.boot:spring-boot-maven-plugin:run ``` -------------------------------- ### Medium Example: Olog API Property Handling Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This test handles a single property, demonstrating a sequence of operations including listing, creating, retrieving, and deleting a property. It utilizes a series of HTTP requests and curl commands to test the behavior. ```Java @Test void handleProperty() ``` -------------------------------- ### Integration Test Setup with Testcontainers Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java code snippet demonstrates the basic structure of an integration test class using Testcontainers. It sets up a ComposeContainer to manage Docker services for Olog, Elasticsearch, and MongoDB, and includes a simple test method to verify Olog's availability. ```Java @Testcontainers class OlogIT { @Container public static final ComposeContainer ENVIRONMENT = ITUtil.defaultComposeContainers(); @Test void ologUp() { try { int responseCode = ITUtil.sendRequestStatusCode(ITUtil.HTTP_IP_PORT_OLOG); assertEquals(HttpURLConnection.HTTP_OK, responseCode); } catch (Exception e) { fail(); } } ``` -------------------------------- ### Markdown Inline Code Example Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet.html Demonstrates the use of backticks to format text as inline code within a Markdown document. This is useful for highlighting small code snippets or commands directly within a paragraph. ```Markdown `Inline code` ``` -------------------------------- ### Complex Example: Olog API Logs Query Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This test focuses on querying logs by pattern. It sets up a comprehensive test fixture with properties, tags, logbooks, and associated logs, then queries for logs based on various criteria. Finally, it tears down the fixture to revert the changes. ```Java @Test void handleLogsQueryByPattern() ``` -------------------------------- ### Logbook Search Date/Time Range Parameters (start, end) Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/SearchHelp_en.html Details the `start` and `end` parameters used to filter log entries by their creation date/time. It covers various absolute and relative time formats, default values, and error conditions for invalid ranges. ```APIDOC Parameter: start, end Description: Search for log entries created within a specified date/time range. Type: Date/Time String | Relative Time Specifier Default (start): 1970-01-01 00:00:00 Default (end): now (current date/time) Error Condition: Invalid time range (start date/time after end date/time) will trigger an error and prevent search. Supported Absolute Date/Time Formats: - yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm - yyyy-MM-dd (time defaults to 00:00:00) - HH:mm:ss (date defaults to current date) Supported Relative Time Formats (case insensitive): - X w (e.g., '10 w' for 10 weeks) - X d (e.g., '5 d' for 5 days) - X h (e.g., '3 h' for 3 hours) - X m (e.g., '30 m' for 30 minutes) - X s (e.g., '15 s' for 15 seconds) - now (current date/time) - Full wording allowed (e.g., 'weeks', 'days') - Combinations allowed (e.g., '10 w 4 d'); any additional elements will be ignored. ``` -------------------------------- ### Basic Python Code Block Example Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet_en.html This snippet illustrates a simple Python code block, demonstrating how to print multiple lines of text. It represents common ways to format code within markdown, such as fenced code blocks and indented blocks. ```python # code block print '3 backticks or' print 'indent 4 spaces' ``` -------------------------------- ### Olog Markup: Basic Text Formatting Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet.html Examples of how to apply italic and bold formatting to text using Commonmark-based syntax in Olog, showing both asterisk/underscore and double asterisk/underscore variants. ```Markup *Italic* ``` ```Markup _Italic_ ``` ```Markup **Bold** ``` ```Markup __Bold__ ``` -------------------------------- ### Java Example: Using ITUtilLogs for Olog Log Query Tests Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java test snippet, part of `OlogLogsQueryIT`, illustrates the practical application of the `ITUtilLogs.assertListLogs` utility methods. It shows how to write integration tests that query Olog logs based on description patterns and assert the expected count of returned logs. The `@Testcontainers` annotation indicates this is an integration test leveraging Docker containers. ```Java @Testcontainers public class OlogLogsQueryIT { @Test void handleLogsQueryByPattern() { ITUtilLogs.assertListLogs("?desc", 60); ITUtilLogs.assertListLogs("?desc=asdf", 0); ITUtilLogs.assertListLogs("?desc=Initial", 2); ``` -------------------------------- ### Search and Retrieve Log Entries and Attachments Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This section details the parameters available for searching log entries and provides examples for retrieving specific log entries or their attachments based on various criteria like description, logbook, or attachment type. ```APIDOC | **Attachments searches** | +---------------+------------------------------------------------------------------+ |*attachments* | To search for entries with at least one attachment | +---------------+------------------------------------------------------------------+ | **Pagination searches** | +---------------+------------------------------------------------------------------+ |*size* | The number of log entries to be returned within each page | +---------------+------------------------------------------------------------------+ |*page* | The page number, i.e page 1 is the 1 to 1+size log | | | entries matching the search | +---------------+------------------------------------------------------------------+ |*Sorting Search Results* | +---------------+------------------------------------------------------------------+ |*sort* | `up|down` order the search results based on create time | +---------------+------------------------------------------------------------------+ ``` ```HTTP GET https://localhost:8181/Olog/logs/search?desc=dump&logbooks=Operations ``` ```HTTP GET https://localhost:8181/Olog/logs/attachments/{logId}/{filename} ``` ```HTTP GET https://localhost:8181/Olog/logs/search?attachments=image ``` -------------------------------- ### Python Project Dependency List Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/requirements.txt This snippet lists the Python packages and their pinned versions required for the project. These dependencies are typically installed using pip from a requirements.txt file to ensure a consistent development and deployment environment. ```Python sphinx==7.2.6 sphinx_rtd_theme==2.0.0 readthedocs-sphinx-search==0.3.2 ``` -------------------------------- ### Olog Log Entry Property JSON Example Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This JSON snippet demonstrates the structure of a 'property' object that can be attached to an Olog log entry. Properties allow for custom key-value metadata, such as linking a log entry to an external ticket system by providing an `id` and `URL` attribute. ```json { "name":"ticket", "attributes":[ { "name":"id", "value":"1234" }, { "name":"URL", "value":"https://trac.nsls2.bnl.gov/ticket/1234" }] } ``` -------------------------------- ### Retrieve Olog Property by Name Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java method from `PropertiesResource` handles GET requests to retrieve a specific property by its name. The property name is provided as a path variable. This method corresponds to requests 7 and 10 in the property handling sequence. ```Java @GetMapping("/{propertyName}") public Property findByTitle(@PathVariable String propertyName) { ``` -------------------------------- ### Olog Search Query Examples with Multiple Values Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/SearchHelp_en.html Demonstrates how to use comma-separated values for search keys in Olog queries. The logic for combining multiple values varies by key: 'user' applies an 'OR' strategy, while 'desc' and 'title' apply an 'AND' strategy. ```Text user=John*,Jane* ``` ```Text desc=magnet,current ``` ```Text user=John*,Jane*&desc=magnet,current ``` -------------------------------- ### Create Olog Log Entry via REST API Source: https://github.com/olog/phoebus-olog/blob/master/README.md This example illustrates how to create a new log entry in the Olog service using a cURL PUT request. It includes setting content type, basic authentication headers, and providing a JSON payload with log entry details such as owner, source, title, level, and associated logbooks. ```shell curl --location --insecure --request PUT 'https://localhost:8181/Olog/logs' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic YWRtaW46YWRtaW5QYXNz' \ --data '{ "owner": "test-owner", "source": "This is an test entry", "title": "Tes title", "level": "Info", "logbooks": [{"name": "operations","owner": "olog-logs"}] }' ``` ```json { "owner": "test-owner", "source": "This is an test entry", "title": "Tes title", "level": "Info", "logbooks": [{"name": "operations","owner": "olog-logs"}] } ``` -------------------------------- ### Update an Existing Log Entry Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This snippet demonstrates how to update an existing log entry using a POST request. It includes the endpoint and an example JSON payload for the update operation. Note that certain fields like creation date, attachments, and events cannot be modified. ```HTTP POST https://localhost:8181/Olog/logs/{logId} ``` ```JSON { "owner":"log", "description":"Beam Dump due to Major power dip Current Alarms Booster transmitter switched back to lower state.\n New important info appended", "level":"Info", "title":"A new title", "logbooks":[ { "name":"Operations" } ] } ``` -------------------------------- ### Java Integration Test for Olog Property Management Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java code snippet presents an integration test class, `OlogPropertiesIT`, designed to validate property management functionalities within the Olog system using Testcontainers. It demonstrates the lifecycle of an integration test, including static setup (`@BeforeAll`) and teardown (`@AfterAll`) of test data, and a comprehensive test method (`handleProperty`) that performs CRUD-like operations (create, list, retrieve, remove) on Olog properties. The test leverages utility classes for assertions and interactions with the Olog API, showcasing how to test property states (active/inactive) and permissions. ```java @Testcontainers class OlogPropertiesIT { static Property[] default_properties; static Property property_p1_owner_a_state_a_attributes; static Property property_p1_owner_a_state_i_attributes; static Attribute a1; @Container public static final ComposeContainer ENVIRONMENT = ITUtil.defaultComposeContainers(); @BeforeAll public static void setupObjects() { default_properties = new Property[] {new Property("resource", null, State.Active, new HashSet())}; default_properties[0].addAttributes(new Attribute("name", null, State.Active)); default_properties[0].addAttributes(new Attribute("file", null, State.Active)); a1 = new Attribute("a1", "v1", State.Active); property_p1_owner_a_state_a_attributes = new Property("p1", "admin", State.Active, new HashSet()); property_p1_owner_a_state_a_attributes.addAttributes(a1); property_p1_owner_a_state_i_attributes = new Property("p1", "admin", State.Inactive, new HashSet()); property_p1_owner_a_state_i_attributes.addAttributes(a1); } @AfterAll public static void tearDownObjects() { default_properties = null; property_p1_owner_a_state_a_attributes = null; property_p1_owner_a_state_i_attributes = null; a1 = null; } /** * Test {@link org.phoebus.olog.OlogResourceDescriptors#PROPERTY_RESOURCE_URI}. */ @Test void handleProperty() { // what // user with required role // create property // list, create, list/retrieve, remove (unauthorized), remove, retrieve/list try { ITUtilProperties.assertListProperties(1, default_properties[0]); ITUtilProperties.assertCreateProperty("/p1", property_p1_owner_a_state_a_attributes); // refresh elastic indices ITUtil.assertRefreshElasticIndices(); ITUtilProperties.assertListProperties(2, property_p1_owner_a_state_a_attributes, default_properties[0]); ITUtilProperties.assertListProperties("?inactive=false", 2, property_p1_owner_a_state_a_attributes, default_properties[0]); ITUtilProperties.assertListProperties("?inactive=true", 2, property_p1_owner_a_state_a_attributes, default_properties[0]); ITUtilProperties.assertRetrieveProperty("/p1", property_p1_owner_a_state_a_attributes); // check permissions // ITUtilProperties.assertRemoveProperty(AuthorizationChoice.USER, "/p1", HttpURLConnection.HTTP_UNAUTHORIZED); ITUtilProperties.assertRemoveProperty("/p1"); // refresh elastic indices ITUtil.assertRefreshElasticIndices(); ITUtilProperties.assertRetrieveProperty("/p1", property_p1_owner_a_state_i_attributes); ITUtilProperties.assertListProperties("?inactive=false", 1, default_properties[0]); ITUtilProperties.assertListProperties("?inactive=true", 2, property_p1_owner_a_state_i_attributes, default_properties[0]); ITUtilProperties.assertListProperties(1, default_properties[0]); } catch (Exception e) { fail(); } } } ``` -------------------------------- ### Olog Log Entry JSON Structure Example Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This JSON snippet illustrates the comprehensive data structure for a single log entry in the Olog service. It includes core fields like `id`, `owner`, `description`, `level`, and `title`, along with arrays for `logbooks`, `tags`, `properties`, `attachments`, and `events`, showcasing how various metadata and related entities are associated with a log entry. ```json { "id":575, "owner":"testOwner1", "source":"**Beam Dump** due to Major power dip Current Alarms Booster transmitter switched back to lower state. PV : BR-RF{Xmtr-PLC}ICS:Down-Sts", "description":"Beam Dump due to Major power dip Current Alarms Booster transmitter switched back to lower state. PV : BR-RF{Xmtr-PLC}ICS:Down-Sts", "level":"Info", "title":"Some title", "state":"Active", "createdDate":1577392617217, "logbooks":[ { "name":"ControlsOperations", "owner":"operators" } ], "tags":[ { "name":"Fault" } ], "properties":[ { "name":"FaultReport", "owner":"testOwner1", "attributes":[ { "name":"id", "value":"1234" }, { "name":"URL", "value":"https://nsls2.bnl.gov/faults/1234" } ] } ], "attachments":[ { "id":"5e21fe829fef8a53f0183d4a", "filename":"screenshot_image.png", "fileMetadataDescription":"image.png" } ], "events":[ { "name":"faultTime", "instant":1577389011004 } ] } ``` -------------------------------- ### Retrieve All Olog Properties Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java method from `PropertiesResource` handles GET requests to list all properties. It supports an optional 'inactive' parameter to include inactive properties in the results. This method corresponds to requests 1, 4, 5, 6, 11, 12, and 13 in the property handling sequence. ```Java @GetMapping public Iterable findAll(@RequestParam(required=false) boolean inactive) { ``` -------------------------------- ### Refresh Elasticsearch Indices Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This static utility method from `ITUtil` sends a GET request to Elasticsearch to refresh its indices. This is typically done after data modifications to ensure search results are up-to-date. This method corresponds to requests 3 and 9 in the property handling sequence. ```Java static void assertRefreshElasticIndices() throws IOException { String[] response = doGetJson(HTTP_IP_PORT_ELASTICSEARCH + "/_refresh"); ``` -------------------------------- ### Normalize.css and Skeleton Framework Base Styles Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/SearchHelp_en.html A comprehensive set of CSS rules, starting with normalize.css for cross-browser consistency, followed by foundational styles from a CSS framework. This includes typography, layout (grid system with responsive breakpoints), link, list, and code styling, along with specific mobile modifications. ```CSS /*! normalize.css v3.0.2 | MIT License | git.io/normalize */ /** * 1. Set default font family to sans-serif. * 2. Prevent iOS text size adjust after orientation change, without disabling * user zoom. */ html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } /** * Remove default margin. */ body { margin: 8px; } a { background-color: transparent; } /** * Improve readability when focused and also mouse hovered in all browsers. */ a:active, a:hover { outline: 0; } b, strong { font-weight: bold; } h1 { font-size: 2em; margin: 0.67em 0; } img { border: 0; } /** * Contain overflow in all browsers. */ pre { overflow: auto; } button, input, optgroup, select, textarea { color: inherit; /* 1 */ font: inherit; /* 2 */ margin: 0; /* 3 */ } /* Tables ========================================================================== */ /** * Remove most spacing between table cells. */ table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } /* Grid –––––––––––––––––––––––––––––––––––––––––––––––––– */ .container { position: relative; width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; } .column, .columns { width: 100%; float: left; box-sizing: border-box; } /* For devices larger than 400px */ @media (min-width: 400px) { .container { width: 85%; padding: 0; } } /* For devices larger than 550px */ @media (min-width: 550px) { .container { width: 80%; } } /* Base Styles –––––––––––––––––––––––––––––––––––––––––––––––––– */ /* NOTE html is set to 62.5% so that all the REM measurements throughout Skeleton are based on 10px sizing. So basically 1.5rem = 15px :) */ html { font-size: 62.5%; } body { font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ line-height: 1.6; font-weight: 400; color: #222; } /* Typography –––––––––––––––––––––––––––––––––––––––––––––––––– */ h1, h2, h3, h4, h5, h6 { margin-top: 1rem; margin-bottom: 0rem; font-weight: 300; } h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem; } h2 { font-size: 3.3rem; line-height: 1.25; letter-spacing: -.1rem; } h3 { font-size: 2.8rem; line-height: 1.3; letter-spacing: -.1rem; } h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: -.08rem; } h5 { font-size: 1.9rem; line-height: 1.5; letter-spacing: -.05rem; } h6 { font-size: 1.2rem; line-height: 1.6; letter-spacing: 0; } p { margin-top: 0; } /* Links –––––––––––––––––––––––––––––––––––––––––––––––––– */ a { color: #1EAEDB; } a:hover { color: #0FA0CE; } /* Lists –––––––––––––––––––––––––––––––––––––––––––––––––– */ ol, ul { padding-left: 1.8em; margin-top:0.5em; } /* Code –––––––––––––––––––––––––––––––––––––––––––––––––– */ code { padding: .2rem .5rem; margin: 0 .2rem; font-size: 110%; white-space: nowrap; background: #F1F1F1; border: 1px solid #E1E1E1; border-radius: 4px; } pre > code { display: block; padding: 1rem 1.5rem; white-space: pre; } html,body { height: 97%; margin: 0; } p { margin-bottom: 1.5em; } .container { margin-top: 2em; } /* mobile modifications */ @media (max-width: 737px) { .editor { height: 9em; font-size: 0.9em; } .render-pad, .html-pad { height: 10em; } .rowspacer { display: none; } .container { margin-top: 0.5em; padding: 0 10px; } h1 { font-size: 3rem; margin-bottom: 1rem; } h2 { font-size: 2.5rem; margin-bottom: 1rem; } .generated-check { display: none; } .button-answer { margin-top: 1em; margin-bottom: -1em; } .button-reset { margin-top: 1em; margin-bottom: -1em; } .row.exercise-instructions p { margin-bottom: 0.4em; } .cd-container { margin: 0; } .second-example { display: none; } } .markdown-reference { width: 100%; } ``` -------------------------------- ### Search Olog Log Entries via REST API Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This endpoint allows searching for log entries using various criteria. Parameters include text-based searches (text, fuzzy, phrase, owner), time-based searches (start, end, includeevents), and metadata searches (tags, logbooks). ```APIDOC GET https://localhost:8181/Olog/logs Search Parameters: - **Text search** - *text*: A list of keywords which are present in the log entry description - *fuzzy*: Allow fuzzy searches - *phrase*: Finds log entries with the exact same word/s - *owner*: Finds log entries with the given owner - **Time based searches** - *start*: Search for log entries created after given time instant - *end*: Search for log entries created before the given time instant - *includeevents*: A flag to include log event times when - **Meta Data searches** - *tags*: Search for log entries with at least one of the given tags - *logbooks*: Search for log entries with at least one of the given logbooks ``` -------------------------------- ### Execute Maven Release Plugin Commands Source: https://github.com/olog/phoebus-olog/blob/master/README.md Commands to perform a full Maven release cycle. `mvn release:prepare` handles version updates, SCM tagging, and pre-release checks. `mvn release:perform` checks out the tagged release, builds, signs, and deploys the artifacts to the configured remote repository. ```bash mvn release:prepare ``` ```bash mvn release:perform ``` -------------------------------- ### Build Olog Service using Maven Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This command compiles the Olog service source code, runs tests, and packages the application artifacts. It's a standard Maven command for preparing the project for deployment or execution. ```shell mvn clean install ``` -------------------------------- ### Build Olog Service with Maven Source: https://github.com/olog/phoebus-olog/blob/master/README.md This command builds the Olog service using Maven, compiling source code and packaging it into a standard JAR file. It's a fundamental step for setting up the project. ```shell cd phoebus-olog mvn clean install ``` -------------------------------- ### Create Hyperlinks in Olog Markup Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet_en.html Demonstrates two ways to create hyperlinks: inline and reference-style. Inline links directly embed the URL, while reference links define URLs separately. ```Markup [Link](http://a.com) ``` ```Markup [Link][1] ⋮ [1]: http://b.org ``` -------------------------------- ### Run All Integration Tests with Maven Failsafe Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_RUN.md Maven commands to execute all integration tests using the failsafe plugin, enabling Docker profile. Includes options for running with or without code coverage analysis. ```Maven mvn failsafe:integration-test -DskipITs=false -Pintegrationtest-docker ``` ```Maven mvn failsafe:integration-test -DskipITs=false -DskipITCoverage=false -Pintegrationtest-docker ``` -------------------------------- ### Create New Logbooks Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This section demonstrates how to create new logbooks, supporting both single and multiple logbook creation via PUT requests. It provides the API endpoints and the necessary JSON structures for each operation. ```HTTP PUT https://localhost:8181/Olog/logbooks/{logbookName} ``` ```JSON { "name":"Operations", "owner":"olog-logs", "state":"Active" } ``` ```HTTP PUT https://localhost:8181/Olog/logbooks ``` ```JSON [ {"name":"Operations", "owner":"olog-logs", "state":"Active"}, {"name":"DAMA", "owner":"olog-logs", "state":"Active"} ] ``` -------------------------------- ### Build Olog Docker Images Source: https://github.com/olog/phoebus-olog/blob/master/README.md This command builds the Docker images required for the Olog service and its dependencies, as defined in the `docker-compose.yml` file. It's a prerequisite for running Olog in a containerized environment. ```shell docker-compose build ``` -------------------------------- ### Run Olog Integration Tests with Docker Source: https://github.com/olog/phoebus-olog/blob/master/README.md This Maven command executes the integration tests for the Olog API within Docker containers. It ensures that the tests are not skipped and activates the specific Maven profile designed for Docker-based integration testing. ```shell mvn failsafe:integration-test -DskipITs=false -Pintegrationtest-docker ``` -------------------------------- ### Olog Markup: Heading Levels Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet.html Demonstrates the syntax for creating different levels of headings in Olog markup, including both hash-style and underline-style headings for Heading 1 and Heading 2. ```Markup # Heading 1 ``` ```Markup Heading 1\n========= ``` ```Markup ## Heading 2 ``` ```Markup Heading 2\n--------- ``` -------------------------------- ### Run Individual Integration Tests with Maven Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_RUN.md Maven commands to run specific integration test classes by name using the test plugin. ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogIT ``` ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogLogbooksIT ``` ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogLogsIT ``` ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogLogsQueryIT ``` ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogPropertiesIT ``` ```Maven mvn test -Dtest=org.phoebus.olog.docker.OlogTagsIT ``` -------------------------------- ### Build Deployable Olog Jar with Maven Source: https://github.com/olog/phoebus-olog/blob/master/README.md This Maven command builds a self-contained, deployable JAR of the Olog service. It includes all necessary dependencies and an embedded Tomcat server, making it easy to run as a standalone application. ```shell cd phoebus-olog mvn -Pdeployable-jar clean install ``` -------------------------------- ### Base CSS Styles and Responsive Grid System Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet_en.html This comprehensive CSS snippet defines foundational styles for various HTML elements, including typography, links, images, and tables. It also implements a responsive grid system with classes like 'container', 'column', and 'columns', utilizing media queries to adapt layouts for different screen sizes. The stylesheet establishes a base font size using 'rem' units for scalability. ```css html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } body { margin: 0; } a { background-color: transparent; } /** * Improve readability when focused and also mouse hovered in all browsers. */ a:active, a:hover { outline: 0; } b, strong { font-weight: bold; } h1 { font-size: 2em; margin: 0.67em 0; } img { border: 0; } /** * Address differences between Firefox and other browsers. */ hr { -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } /* Grid –––––––––––––––––––––––––––––––––––––––––––––––––– */ .container { position: relative; width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; } .column, .columns { width: 100%; float: left; box-sizing: border-box; } /* For devices larger than 400px */ @media (min-width: 400px) { .container { width: 85%; padding: 0; } } /* For devices larger than 550px */ @media (min-width: 550px) { .container { width: 80%; } .column, .columns { margin-left: 4%; } .column:first-child, .columns:first-child { margin-left: 0; } .one.column, .one.columns { width: 4.66666666667%; } .two.columns { width: 13.3333333333%; } .three.columns { width: 22%; } .four.columns { width: 30.6666666667%; } .five.columns { width: 39.3333333333%; } .six.columns { width: 48%; } .seven.columns { width: 56.6666666667%; } .eight.columns { width: 65.3333333333%; } .nine.columns { width: 74.0%; } .ten.columns { width: 82.6666666667%; } .eleven.columns { width: 91.3333333333%; } .twelve.columns { width: 100%; margin-left: 0; } .one-third.column { width: 30.6666666667%; } .two-thirds.column { width: 65.3333333333%; } .one-half.column { width: 48%; } /* Offsets */ .offset-by-one.column, .offset-by-one.columns { margin-left: 8.66666666667%; } .offset-by-two.column, .offset-by-two.columns { margin-left: 17.3333333333%; } .offset-by-three.column, .offset-by-three.columns { margin-left: 26%; } .offset-by-four.column, .offset-by-four.columns { margin-left: 34.6666666667%; } .offset-by-five.column, .offset-by-five.columns { margin-left: 43.3333333333%; } .offset-by-six.column, .offset-by-six.columns { margin-left: 52%; } .offset-by-seven.column, .offset-by-seven.columns { margin-left: 60.6666666667%; } .offset-by-eight.column, .offset-by-eight.columns { margin-left: 69.3333333333%; } .offset-by-nine.column, .offset-by-nine.columns { margin-left: 78.0%; } .offset-by-ten.column, .offset-by-ten.columns { margin-left: 86.6666666667%; } .offset-by-eleven.column, .offset-by-eleven.columns { margin-left: 95.3333333333%; } .offset-by-one-third.column, .offset-by-one-third.columns { margin-left: 34.6666666667%; } .offset-by-two-thirds.column, .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } .offset-by-one-half.column, .offset-by-one-half.columns { margin-left: 52%; } } /* Base Styles –––––––––––––––––––––––––––––––––––––––––––––––––– */ /* NOTE html is set to 62.5% so that all the REM measurements throughout Skeleton are based on 10px sizing. So basically 1.5rem = 15px :) */ html { font-size: 62.5%; } body { font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ line-height: 1.6; font-weight: 400; font-family: "Roboto", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; color: #222; } /* Typography –––––––––––––––––––––––––––––––––––––––––––––––––– */ h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 2rem; font-weight: 300; } h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} h2 { font-size: 3.3rem; line-height: 1.25; letter-spacing: -.1rem; } h3 { font-size: 2.8rem; line-height: 1.3; letter-spacing: -.1rem; } h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: ``` -------------------------------- ### Local Debugging of Docker Image Tag Generation Scripts Source: https://github.com/olog/phoebus-olog/blob/master/README.md Shell commands to simulate the GitHub Actions environment and execute local scripts responsible for deriving Docker image registry and tag names from Maven project information. This is useful for debugging issues related to image naming outside of the CI/CD pipeline. ```bash source ./scripts/setup-locally.sh ./scripts/write-project-info.sh ./scripts/set-github-env.sh ``` -------------------------------- ### Base CSS Styles and Responsive Grid System Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet.html A comprehensive CSS stylesheet defining foundational styles for HTML elements, including typography, links, images, and tables. It also implements a responsive grid system with container, column, and offset classes, utilizing media queries for adaptive layouts across various device widths. ```CSS html { font-family: sans-serif; /* 1 */ -ms-text-size-adjust: 100%; /* 2 */ -webkit-text-size-adjust: 100%; /* 2 */ } body { margin: 0; } a { background-color: transparent; } /** * Improve readability when focused and also mouse hovered in all browsers. */ a:active, a:hover { outline: 0; } b, strong { font-weight: bold; } h1 { font-size: 2em; margin: 0.67em 0; } img { border: 0; } /** * Address differences between Firefox and other browsers. */ hr { -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } table { border-collapse: collapse; border-spacing: 0; } td, th { padding: 0; } /* Grid –––––––––––––––––––––––––––––––––––––––––––––––––– */ .container { position: relative; width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; } .column, .columns { width: 100%; float: left; box-sizing: border-box; } /* For devices larger than 400px */ @media (min-width: 400px) { .container { width: 85%; padding: 0; } } /* For devices larger than 550px */ @media (min-width: 550px) { .container { width: 80%; } .column, .columns { margin-left: 4%; } .column:first-child, .columns:first-child { margin-left: 0; } .one.column, .one.columns { width: 4.66666666667%; } .two.columns { width: 13.3333333333%; } .three.columns { width: 22%; } .four.columns { width: 30.6666666667%; } .five.columns { width: 39.3333333333%; } .six.columns { width: 48%; } .seven.columns { width: 56.6666666667%; } .eight.columns { width: 65.3333333333%; } .nine.columns { width: 74.0%; } .ten.columns { width: 82.6666666667%; } .eleven.columns { width: 91.3333333333%; } .twelve.columns { width: 100%; margin-left: 0; } .one-third.column { width: 30.6666666667%; } .two-thirds.column { width: 65.3333333333%; } .one-half.column { width: 48%; } /* Offsets */ .offset-by-one.column, .offset-by-one.columns { margin-left: 8.66666666667%; } .offset-by-two.column, .offset-by-two.columns { margin-left: 17.3333333333%; } .offset-by-three.column, .offset-by-three.columns { margin-left: 26%; } .offset-by-four.column, .offset-by-four.columns { margin-left: 34.6666666667%; } .offset-by-five.column, .offset-by-five.columns { margin-left: 43.3333333333%; } .offset-by-six.column, .offset-by-six.columns { margin-left: 52%; } .offset-by-seven.column, .offset-by-seven.columns { margin-left: 60.6666666667%; } .offset-by-eight.column, .offset-by-eight.columns { margin-left: 69.3333333333%; } .offset-by-nine.column, .offset-by-nine.columns { margin-left: 78.0%; } .offset-by-ten.column, .offset-by-ten.columns { margin-left: 86.6666666667%; } .offset-by-eleven.column, .offset-by-eleven.columns { margin-left: 95.3333333333%; } .offset-by-one-third.column, .offset-by-one-third.columns { margin-left: 34.6666666667%; } .offset-by-two-thirds.column, .offset-by-two-thirds.columns { margin-left: 69.3333333333%; } .offset-by-one-half.column, .offset-by-one-half.columns { margin-left: 52%; } } /* Base Styles –––––––––––––––––––––––––––––––––––––––––––––––––– */ /* NOTE html is set to 62.5% so that all the REM measurements throughout Skeleton are based on 10px sizing. So basically 1.5rem = 15px :) */ html { font-size: 62.5%; } body { font-size: 1.5em; /* currently ems cause chrome bug misinterpreting rems on body element */ line-height: 1.6; font-weight: 400; font-family: "Roboto", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif; color: #222; } /* Typography –––––––––––––––––––––––––––––––––––––––––––––––––– */ h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 2rem; font-weight: 300; } h1 { font-size: 4.0rem; line-height: 1.2; letter-spacing: -.1rem;} h2 { font-size: 3.3rem; line-height: 1.25; letter-spacing: -.1rem; } h3 { font-size: 2.8rem; line-height: 1.3; letter-spacing: -.1rem; } h4 { font-size: 2.4rem; line-height: 1.35; letter-spacing: ``` -------------------------------- ### Create New Properties Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This snippet demonstrates how to create new properties, either individually or in a batch, using PUT requests. It includes the API endpoints and the corresponding JSON payloads, which can define attributes for each property. ```HTTP PUT https://localhost:8181/Olog/properties/{propertyName} ``` ```JSON { "name":"Ticket", "owner":"olog-logs", "state":"Active", "attributes":[ { "name":"id", "state":"Active" }, { "name":"url", "state":"Active" } ] } ``` ```HTTP PUT https://localhost:8181/Olog/properties ``` ```JSON [ { "name":"Ticket", "owner":"olog-logs", "state":"Active", "attributes":[ {"name":"id", "state":"Active"}, {"name":"url", "state":"Active"} ] }, { "name":"Scan", "owner":"olog-logs", "state":"Active", "attributes":[ {"name":"id", "state":"Active"} ] } ] ``` -------------------------------- ### Create New Tags Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This snippet illustrates how to create new tags, either individually or in a batch, using PUT requests. It includes the API endpoints and the corresponding JSON payloads for single and multiple tag creation. ```HTTP PUT https://localhost:8181/Olog/tags/{tagName} ``` ```JSON { "name":"Fault", "state":"Active" } ``` ```HTTP PUT https://localhost:8181/Olog/tags ``` ```JSON [ {"name":"Fault", "state":"Active" }, {"name":"Alarm", "state":"Active" } ] ``` -------------------------------- ### Maven Sonatype Server Credentials Configuration Source: https://github.com/olog/phoebus-olog/blob/master/README.md XML configuration for Maven's settings.xml file, used to store authentication credentials for Sonatype repositories. This allows Maven to securely publish artifacts to Maven Central. ```xml phoebus-releases shroffk ******* ``` -------------------------------- ### Olog Markup: Hyperlinks Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet.html Shows two methods for creating hyperlinks in Olog markup: inline links with direct URLs and reference-style links that define the URL separately. ```Markup [Link](http://a.com) ``` ```Markup [Link][1]\n⋮\n[1]: http://b.org ``` -------------------------------- ### Create Olog Property by Name Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java method from `PropertiesResource` handles PUT requests to create a new property. It takes the property name from the path, the property object from the request body, and the principal for authentication. This method corresponds to request 2 in the property handling sequence and requires ADMIN authority. ```Java @PutMapping("/{propertyName}") public Property createProperty(@PathVariable String propertyName, @RequestBody final Property property, @AuthenticationPrincipal Principal principal) { ``` -------------------------------- ### Retrieve List of Properties Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This section provides the API endpoint for fetching a list of all existing properties within the Olog system. ```HTTP GET https://localhost:8181/Olog/properties ``` -------------------------------- ### Java Utility Class for Olog Log List Assertions Source: https://github.com/olog/phoebus-olog/blob/master/src/test/resources/INTEGRATIONTEST_DOCKER_TUTORIAL.md This Java class, `ITUtilLogs`, provides static utility methods to simplify testing of Olog log list retrieval. It includes overloaded `assertListLogs` methods that allow asserting the HTTP response code, the number of returned logs within a range, and the content of the logs against expected values. It relies on `ITUtil` for sending requests and `mapper` for JSON deserialization. ```Java public class ITUtilLogs { public static Log[] assertListLogs(int expectedEqual, Log... expected) { return assertListLogs("", HttpURLConnection.HTTP_OK, expectedEqual, expectedEqual, expected); } public static Log[] assertListLogs(String queryString, int expectedEqual, Log... expected) { return assertListLogs(queryString, HttpURLConnection.HTTP_OK, expectedEqual, expectedEqual, expected); } /** * Utility method to return the list of all logs in the directory. * * @param queryString query string * @param expectedResponseCode expected response code * @param expectedGreaterThanOrEqual (if non-negative number) greater than or equal to this number of items * @param expectedLessThanOrEqual (if non-negative number) less than or equal to this number of items * @param expected expected response logs * @return number of logs */ public static Log[] assertListLogs(String queryString, int expectedResponseCode, int expectedGreaterThanOrEqual, int expectedLessThanOrEqual, Log... expected) { Log[] actual = null; try { String[] response = ITUtil.sendRequest(ITUtil.HTTP_IP_PORT_OLOG_LOGS + queryString); ITUtil.assertResponseLength2Code(response, expectedResponseCode); if (HttpURLConnection.HTTP_OK == expectedResponseCode) { actual = mapper.readValue(response[1], Log[].class); } // expected number of items in list // (if non-negative number) // expectedGreaterThanOrEqual <= nbr of items <= expectedLessThanOrEqual if (expectedGreaterThanOrEqual >= 0) { assertTrue(actual.length >= expectedGreaterThanOrEqual); } if (expectedLessThanOrEqual >= 0) { assertTrue(actual.length <= expectedLessThanOrEqual); } if (expected != null && expected.length > 0) { ITUtil.assertEqualsLogs(actual, expected); } } catch (Exception e) { fail(); } return actual; } ``` -------------------------------- ### Format Text as Bold in Olog Markup Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/CommonmarkCheatsheet_en.html Shows two methods for rendering text in bold using Olog's Commonmark-based markup. Both syntaxes produce bold text. ```Markup **Bold** ``` ```Markup __Bold__ ``` -------------------------------- ### Combining Multiple Search Keys Source: https://github.com/olog/phoebus-olog/blob/master/src/main/resources/static/SearchHelp_en.html Details how multiple search parameters are processed when included in a single query. The service considers all valid keys and returns only those log entries that satisfy all specified criteria, effectively performing a logical AND operation across the parameters. ```APIDOC Parameter Combination: Logical AND Behavior: All valid keys in a search query must be matched for a log entry to be returned. ``` -------------------------------- ### Create a New Level Source: https://github.com/olog/phoebus-olog/blob/master/src/site/sphinx/index.rst This snippet shows how to create a new log level using a PUT request. It includes the endpoint and the JSON payload, highlighting the option to define a level as the default (only one default level is allowed). ```HTTP PUT https://localhost:8181/Olog/level/{levelName} ``` ```JSON { "name":"Info", "defaultLevel":[true|false] } ```