Test your hybris and Java knowledge

Challenge 1, “ThreadDumps”

“Write some code which shows ThreadDumps of all threads.”

Sample output:

cpu time: 0 ms user time: 0 ms "hybrisHTTP32" Id=127 RUNNABLE (in native) at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:150) at java.net.SocketInputStream.read(SocketInputStream.java:121) at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:519) at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:504) at org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout(Http11Processor.java:167) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:982) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) ...  cpu time: 15.6001 ms user time: 15.6001 ms "hybrisHTTP31" Id=126 WAITING on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@4e46065f at sun.misc.Unsafe.park(Native Method) -  waiting on java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@4e46065f at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442) at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:104) at org.apache.tomcat.util.threads.TaskQueue.take(TaskQueue.java:32) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127) ...

Hint:

Challenge 2, “FlexibleSearch”

“Write some code, which searchs for all existing users in the system by using the FlexibleSearchService. Print out the total count and the UID and PK of each user.


Sample output:


Count: 2

ID: admin (8796093054980)

ID: anonymous (8796093087748)

Hint:

Challenge 3, “Dump attributes & database columns “

“Write some code, which dumps the qualifiers and the names of the database columns for the attributes of the type “Product” –  Excluding the attributes “pk“, “owner“, “modifiedtime“, “owner” and “itemtype“.

Sample output:

Dump of type: Product 

Attribute: Europe1PriceFactory_PDG
DB Column: p_europe1pricefactory_pdg

---------------------------------------------------

Attribute: Europe1PriceFactory_PPG
DB Column: p_europe1pricefactory_ppg

---------------------------------------------------

Attribute: Europe1PriceFactory_PTG
DB Column: p_europe1pricefactory_ptg

---------------------------------------------------

Attribute: approvalStatus
DB Column: p_approvalstatus

---------------------------------------------------

Attribute: articleStatus
DB Column: p_articlestatus

---------------------------------------------------

Attribute: buyerIDS
DB Column: p_buyerids

---------------------------------------------------

Attribute: catalogVersion
DB Column: p_catalogversion

---------------------------------------------------

Attribute: code
DB Column: code

---------------------------------------------------

...


Hint:

  • You can use the hAC scripting shell (groovy) or a classical hybris extension for your solution.
  • Study TypeSystem

Challenge 4, “Monitor heap and database connections”

“Write some code, which prints out the ‘used heap’ and the ‘max db connections'”.

Sample output:

used heap : 491665016 max db connections: 3


Hint:

Challenge 5, “Restart procedures”

“Write some code, which restarts the server”.
“How can you protect the application against such kind of “security” vulnerability?”

Sample output:

JVM requested a restart.

Hint:

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply