mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
no effective change - format test code
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
package org.avaje.ebeantest;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.Level;
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import ch.qos.logback.classic.LoggerContext;
|
||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||
import ch.qos.logback.core.UnsynchronizedAppenderBase;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Helper that can collect the SQL that is logged via SLF4J.
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package org.avaje.test.model.inheritmany.test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.avaje.ebean.BaseTestCase;
|
||||
import com.avaje.ebean.Ebean;
|
||||
import com.avaje.ebean.EbeanServer;
|
||||
@@ -15,6 +10,10 @@ import com.avaje.tests.model.inheritmany.IMRelated;
|
||||
import com.avaje.tests.model.inheritmany.IMRoot;
|
||||
import com.avaje.tests.model.inheritmany.IMRootOne;
|
||||
import com.avaje.tests.model.inheritmany.IMRootTwo;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class TestInheritWithMany extends BaseTestCase {
|
||||
@@ -25,49 +24,48 @@ public class TestInheritWithMany extends BaseTestCase {
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
Assert.assertNotNull(server);
|
||||
|
||||
SpiEbeanServer spiServer = (SpiEbeanServer)server;
|
||||
|
||||
SpiEbeanServer spiServer = (SpiEbeanServer) server;
|
||||
BeanDescriptor<IMRoot> beanDescriptor = spiServer.getBeanDescriptor(IMRoot.class);
|
||||
InheritInfo inheritInfo = beanDescriptor.getInheritInfo();
|
||||
Assert.assertNotNull(inheritInfo);
|
||||
|
||||
|
||||
|
||||
IMRootOne one = new IMRootOne();
|
||||
one.setName("One Name");
|
||||
server.save(one);
|
||||
add(one, "aaa");
|
||||
add(one, "bbb");
|
||||
|
||||
|
||||
|
||||
|
||||
IMRootTwo two = new IMRootTwo();
|
||||
two.setTitle("Two Title");
|
||||
server.save(two);
|
||||
add(two, "ccc");
|
||||
add(two, "ddd");
|
||||
|
||||
|
||||
|
||||
|
||||
List<IMRoot> list = server.find(IMRoot.class).select("id").findList();
|
||||
|
||||
|
||||
for (IMRoot imRoot : list) {
|
||||
// lazy load the related OneToMany which is related to a non-leaf
|
||||
List<IMRelated> related = imRoot.getRelated();
|
||||
for (IMRelated imRelated : related) {
|
||||
imRelated.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void add(IMRoot owner, String string) {
|
||||
|
||||
|
||||
IMRelated relate = new IMRelated();
|
||||
relate.setName(string);
|
||||
relate.setOwner(owner);
|
||||
|
||||
|
||||
EbeanServer server = Ebean.getServer(null);
|
||||
server.save(relate);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,24 +11,24 @@ import java.util.List;
|
||||
@Table(name = "rawinherit_data")
|
||||
public class Data {
|
||||
|
||||
@Id
|
||||
private Long id;
|
||||
@Id
|
||||
private Long id;
|
||||
|
||||
private Integer val;
|
||||
private Integer val;
|
||||
|
||||
@ManyToMany(mappedBy = "data")
|
||||
public List<Parent> parents = new ArrayList<>();
|
||||
@ManyToMany(mappedBy = "data")
|
||||
public List<Parent> parents = new ArrayList<>();
|
||||
|
||||
public Data(int number) {
|
||||
this.val = number;
|
||||
}
|
||||
public Data(int number) {
|
||||
this.val = number;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Integer getVal() {
|
||||
return val;
|
||||
}
|
||||
public Integer getVal() {
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import javax.persistence.OneToOne;
|
||||
@Sql
|
||||
public class ParentAggregate {
|
||||
|
||||
@OneToOne
|
||||
public Parent parent;
|
||||
@OneToOne
|
||||
public Parent parent;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user