mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#1237 - ENH: Add ProfileLocation - support for relating performance metrics for queries and transactions back to source line of code
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package io.ebeaninternal.server.profile;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class BasicProfileLocationTest {
|
||||
|
||||
@Test
|
||||
public void obtain() {
|
||||
|
||||
DProfileLocation loc = new DProfileLocation(12);
|
||||
String obtain = loc.obtain();
|
||||
|
||||
assertThat(obtain).endsWith(":12)");
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,9 @@ public class CustomerFinder extends Finder<Integer, Customer> {
|
||||
* Find customer by unique name.
|
||||
*/
|
||||
public Customer byName(String name) {
|
||||
|
||||
return query().where().eq("name", name).findOne();
|
||||
return query().where()
|
||||
.eq("name", name)
|
||||
.findOne();
|
||||
}
|
||||
|
||||
public List<Customer> byNameStatus(String nameStartsWith, Customer.Status status) {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.tests.profile;
|
||||
|
||||
import io.ebean.ProfileLocation;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class ProfileLocationTest {
|
||||
|
||||
private static ProfileLocation loc = ProfileLocation.create(12);
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
assertThat(doIt()).isEqualTo("org.tests.profile.ProfileLocationTest.doIt(ProfileLocationTest.java:19)");
|
||||
}
|
||||
|
||||
private String doIt() {
|
||||
return loc.obtain();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user