Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(camel): getBreakpoints op for Camel BacklogDebugger changed between v3 and v4 #593

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/hawtio/src/plugins/camel/camel-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,19 @@ export function findDebugBean(node: MBeanNode): MBeanNode | null {
return findMBean(node, 'tracer', 'BacklogDebugger')
}

/**
* Returns the name of operation for getting all the breakpoints on the BacklogDebugger
* MBean. The operation name differs between Camel v3 and v4.
*/
export function getBreakpointsOperation(node: MBeanNode): string {
return isCamelVersionEQGT(node, 4, 0) ? 'breakpoints' : 'getBreakpoints'
}

export function canGetBreakpoints(node: MBeanNode): boolean {
if (!isRouteNode(node)) return false

const db = findDebugBean(node)
return db?.hasInvokeRights('getBreakpoints') ?? false
return db?.hasInvokeRights(getBreakpointsOperation(node)) ?? false
}

export function canTrace(node: MBeanNode): boolean {
Expand Down Expand Up @@ -357,7 +365,7 @@ export function compareVersions(version: string, major: number, minor: number):
* @param major major version as number
* @param minor minor version as number
*/
export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number) {
export function isCamelVersionEQGT(node: MBeanNode, major: number, minor: number): boolean {
const camelVersion = getCamelVersion(node)
if (!camelVersion) {
return false
Expand Down
2 changes: 1 addition & 1 deletion packages/hawtio/src/plugins/camel/debug/debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DebugService {
const db = this.getDebugBean(node)
if (!db || !db.objectName) return []

const result = await jolokiaService.execute(db.objectName, 'getBreakpoints')
const result = await jolokiaService.execute(db.objectName, camelService.getBreakpointsOperation(node))
return result as string[]
}

Expand Down
Loading