Steadhaven
Steadhaven
Explore posts from servers
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 1/25/2025 in #java-help
Extend/Inherit java class - how to?
class theUrls {
String ntseUrl;
String publicApi;
}
class theUrls {
String ntseUrl;
String publicApi;
}
What do I do with this java code, now that it is indented/nested inside "system" in the YAML file.
26 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 1/25/2025 in #java-help
Extend/Inherit java class - how to?
Or another example
theUrls:
system: INTERESTS
ntseUrl: some-INTERESTS-website.dev.com
publicApi: some-INTERESTS-api.dev.com
...
system: INVEST
ntseUrl: some-INVEST-website.dev.com
publicApi: some-INVEST-api.dev.com
...
theUrls:
system: INTERESTS
ntseUrl: some-INTERESTS-website.dev.com
publicApi: some-INTERESTS-api.dev.com
...
system: INVEST
ntseUrl: some-INVEST-website.dev.com
publicApi: some-INVEST-api.dev.com
...
The above is the new addition. Before it was only something like:
theUrls:
ntseUrl: some-INTERESTS-website.dev.com
publicApi: some-INTERESTS-api.dev.com
...
theUrls:
ntseUrl: some-INTERESTS-website.dev.com
publicApi: some-INTERESTS-api.dev.com
...
Adding the system property at top level, allows the yaml config repo to have different values for each system. Then in my java code, I can call the correct system to setup my website with the correct stuff in it.
26 replies
Mmfad
Created by Steadhaven on 8/31/2024 in #questions-and-advice
shoes for blue shorts/white t shirt
Thanks. I think i will go with chuck taylors
3 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/13/2024 in #java-help
Resources to learn and apply input/output streams?
thanks
8 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
thanks so much, I was stuck with this for weeks
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
No description
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
This was chatgpts try with groovys RESTClient
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
@Grab(group='org.apache.poi', module='poi-ooxml', version='5.0.0')

import groovyx.net.http.RESTClient
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.ss.usermodel.WorkbookFactory

import java.io.ByteArrayInputStream

// Import Selenium dependencies
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver

// Set the path to the chromedriver executable
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver")

// Initialize Selenium WebDriver
WebDriver driver = new ChromeDriver()

try {
// Navigate to the web page
driver.get("http://your-internal-tool-url")

// Find the download link element
WebElement downloadLink = driver.findElement(By.id("your-download-link-id"))

// Get the URL of the download link
String fileURL = downloadLink.getAttribute("href")

// Initialize HTTPBuilder with the file URL
def client = new RESTClient(fileURL)

// Perform a GET request to download the file
def response = client.get([:])

// Check if the response status is OK (HTTP 200)
if (response.status == 200) {
// Extract the bytes from the response data
byte[] fileBytes = response.data.bytes

// Use Apache POI to verify the file
try (ByteArrayInputStream bais = new ByteArrayInputStream(fileBytes)) {
// Create a Workbook from the byte array input stream
Workbook workbook = WorkbookFactory.create(bais)
println("The downloaded file is a valid Excel file.")
} catch (Exception e) {
println("The downloaded file is not a valid Excel file.")
}
} else {
//...
}
} catch (Exception e) {
//...
} finally {
//...
}
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
@Grab(group='org.apache.poi', module='poi-ooxml', version='5.0.0')

import groovyx.net.http.RESTClient
import org.apache.poi.ss.usermodel.Workbook
import org.apache.poi.ss.usermodel.WorkbookFactory

import java.io.ByteArrayInputStream

// Import Selenium dependencies
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver

// Set the path to the chromedriver executable
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver")

// Initialize Selenium WebDriver
WebDriver driver = new ChromeDriver()

try {
// Navigate to the web page
driver.get("http://your-internal-tool-url")

// Find the download link element
WebElement downloadLink = driver.findElement(By.id("your-download-link-id"))

// Get the URL of the download link
String fileURL = downloadLink.getAttribute("href")

// Initialize HTTPBuilder with the file URL
def client = new RESTClient(fileURL)

// Perform a GET request to download the file
def response = client.get([:])

// Check if the response status is OK (HTTP 200)
if (response.status == 200) {
// Extract the bytes from the response data
byte[] fileBytes = response.data.bytes

// Use Apache POI to verify the file
try (ByteArrayInputStream bais = new ByteArrayInputStream(fileBytes)) {
// Create a Workbook from the byte array input stream
Workbook workbook = WorkbookFactory.create(bais)
println("The downloaded file is a valid Excel file.")
} catch (Exception e) {
println("The downloaded file is not a valid Excel file.")
}
} else {
//...
}
} catch (Exception e) {
//...
} finally {
//...
}
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
like how would one capture/"intercept" the data from the download link
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
pretty hard to understand I/O, especially when its not local files on my own system
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
I have been stuck with this work task for too long
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
will be great
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
Maybe HTTPBuilder from Groovy is a solution?
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 8/4/2024 in #java-help
Capture download data directly from browser to give to Apache POI workbook?
I didn't get further. The workbook line is from some other part of our code base. My main confusion is how to get the stream of data that comes when you click on the download link. I want to pass that response to the workbook, and see if it accepts it as an excel file. I don't care about the content further than that, except if its a proper excel file or not. I don't have access to the file system (that would be easy, just give workbook the file) since its like a docker container which runs both locally and in git/jenkins CI/CD.
21 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 6/30/2024 in #java-help
Cucumber fails to recognize steps definition (Intellij, Java Maven)
it fixed my problem
9 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 6/30/2024 in #java-help
Cucumber fails to recognize steps definition (Intellij, Java Maven)
Thanks a lot
9 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 5/28/2024 in #java-help
How to learn Groovy? (fundamentals, incl.scripting and unit testing)
and I want to be prepared for it
8 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 5/28/2024 in #java-help
How to learn Groovy? (fundamentals, incl.scripting and unit testing)
I am starting at this job: Your tasks/responsibilities: * Help the business to concretize business requirements and acceptance criteria that are testable. * Participate in daily stand-ups and retrospective meetings. * Plan test activities over the next sprint period. * Prepare bug reports and risk-based test designs using known test design techniques. * Communicate test strategy to the team, including when different test types and approaches should be used, e.g., system tests, integration tests, unit tests, etc. * Maintain and expand existing automated tests in the department's test tools. * Develop and maintain the automated system test in the framework, which is based on Junit, Cucumber, Spock, Groovy, Selenium WebDriver (GEB), and Wiremock, as well as setup on the CI/CD platform (Jenkins-Rancher). * Prepare test documentation, including establishing correlation between business needs and tests, as well as ensuring technical documentation. Who are you? * We envision you have a developer background and practical experience as a technical tester. * You have worked with test automation and quality assurance for a couple of years or more and can document your experience. * It will be an advantage if you have a relevant ISTQB certification (Advanced Technical Test Analyst, ISTQB Foundation, ISTQB Agile Extension) and have experience with test management. It is also an advantage if you have an understanding of and experience with: * The test process and test levels * Test designs, automated testing of web services and web-based front-end * Deployment, configuration management, and release management * Development, including Groovy or Java, Docker and Kubernetes, and Git (Github) * Setting up CI/CD in Jenkins/Rancher * Security, encryption, and certificates * Mocking tools and their use in a distributed setup * Jira and Confluence * Performance testing and implementation
8 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 5/22/2024 in #java-help
Logic test help for a job interview
what, I am allow to do that
16 replies
JCHJava Community | Help. Code. Learn.
Created by Steadhaven on 5/22/2024 in #java-help
Logic test help for a job interview
no idea
16 replies