add case-ognl-practise-en. #1743

pull/1746/head^2
hengyunabc 4 years ago
parent 5c606a62f3
commit acbae91c73

@ -755,6 +755,18 @@
cn: "case-watch-method-exception-cn", cn: "case-watch-method-exception-cn",
} }
}, },
{
id: "case-ognl-practise",
type: "USERCASE",
names: {
en: "Debug ognl express",
cn: "调试ognl表达式",
},
ids: {
en: "case-ognl-practise-en",
cn: "case-ognl-practise-cn",
}
},
{ {
id: "case-thread", id: "case-thread",
type: "USERCASE", type: "USERCASE",

@ -1,25 +0,0 @@
# Katacoda Hello World
This is an example repository. Starting building your own scenario by editing the files in this directory. Create additional scenarios by adding additional directories to the top level folder.
## index.json
The file _index.json_ contains all the information about the scenario. It has the title, description and a heading for each step.
The file also contains an imageid. This refers to the Katacoda environment. Here are some environment image IDs you may find useful:
| **Environment** | **Image ID** |
|------------------|---------------|
| Docker | docker |
| Kubernetes | kubernetes |
| CoreOS | coreos |
| Node.js v6 | node6 |
| Go | go |
| C# | c# |
| Java | java8 |
| Bash | bash |
## Pro Author Accounts
Interested in metrics, private repositories and environments for classroom teaching? Update to become a Pro Author at https://katacoda.com/teach
## Interactive Developer Portals
Want to take your scenarios to the next level? Visit https://katacoda.com/embed

@ -1,5 +1,4 @@
{ {
"noindex": true,
"title": "调试 Arthas 的 ognl 表达式", "title": "调试 Arthas 的 ognl 表达式",
"description": "调试 Arthas 的 ognl 表达式", "description": "调试 Arthas 的 ognl 表达式",
"details": { "details": {
@ -10,8 +9,7 @@
} }
], ],
"intro": { "intro": {
"text": "intro.md", "text": "intro.md"
"credits": ""
}, },
"finish": { "finish": {
"text": "finish.md" "text": "finish.md"
@ -20,10 +18,9 @@
"files": [ "files": [
], ],
"environment": { "environment": {
"hidefinish": true,
"hideHiddenFiles": true, "hideHiddenFiles": true,
"uilayout": "editor-terminal", "uilayout": "editor-terminal",
"uisettings": "javascript", "uisettings": "java",
"uieditorpath": "/root/example/ognl-demo" "uieditorpath": "/root/example/ognl-demo"
}, },
"backend": { "backend": {

@ -0,0 +1,12 @@
The tutorial demonstrates how to debug `ognl` express in Arthas. If you have more tips or questions, please feel free to tell or ask in Issue.
* For special usage of OGNL, please refer to: https://github.com/alibaba/arthas/issues/71
* Official Guide to OGNL Expressions: https://commons.apache.org/proper/commons-ognl/language-guide.html
---
* Issues: https://github.com/alibaba/arthas/issues
* Documentation: https://arthas.aliyun.com/doc/en
If you are using Arthas, please let us know that. Your use is very important to us: [View](https://github.com/alibaba/arthas/issues/111)

@ -0,0 +1,29 @@
{
"title": "Debug ognl express in Arthas",
"description": "Debug ognl express in Arthas",
"details": {
"steps": [
{
"text": "step1.md",
"code": "setup.sh"
}
],
"intro": {
"text": "intro.md"
},
"finish": {
"text": "finish.md"
}
},
"files": [
],
"environment": {
"hideHiddenFiles": true,
"uilayout": "editor-terminal",
"uisettings": "java",
"uieditorpath": "/root/example/ognl-demo"
},
"backend": {
"imageid": "openjdk:15"
}
}

@ -0,0 +1,8 @@
![Arthas](https://arthas.aliyun.com/doc/_images/arthas.png)
`Arthas` is a Java diagnostic tool open-sourced by Alibaba middleware team. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers.
This tutorial show how to debug `ognl` express in Arths.
* Github: https://github.com/alibaba/arthas
* Docs: https://arthas.aliyun.com/doc/en

@ -0,0 +1 @@
mkdir -p example; cd example/; git clone https://github.com/hengyunabc/ognl-demo.git ; cd ognl-demo

@ -0,0 +1,42 @@
Demonstrate the workflow of the `ognl` expression in the `watch` command in Arthas. You can modify the expressions in `Demo.java`, and compile and run the code.
Project: https://github.com/hengyunabc/ognl-demo
# Open the Demo.java file
`src/main/java/com/example/ognl/Demo.java`{{open}}
# Compile and run the code
`mvn compile exec:java`{{execute}}
Expression in the code:
```java
String watchExpress = "{target, params, returnObj, #cost}";
String conditionExpress = "params[0] > 1 && #cost > 0.1";
```
The result is similar to the following expression:
```bash
watch com.example.ognl.TestService test "{target, params, returnObj, #cost}" "params[0] > 1 && #cost > 0.1" -x 3
```
# View the expression result when the method throws an exception
`mvn compile exec:java -DexceptionCase=true`{{execute}}
Expression in the code:
```java
String watchExpress = "{target, params, throwExp}";
String conditionExpress = "params[0] > 1";
```
The result is similar to the following expression:
```bash
watch com.example.ognl.TestService test "{target, params, throwExp}" "params[0] > 1" -e -x 2
```
Loading…
Cancel
Save