cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: Unit Testing WebApp with 3.2M1 release
Date Wed, 24 Jul 2013 21:33:01 GMT
getContext() was renamed to newContext()


On Wed, Jul 24, 2013 at 3:51 PM, Markus Reich
<markus.reich@markusreich.at>wrote:

> Hi,
>
> I'm using following code for unit testing:
>
> package db;
>
> import org.apache.cayenne.ObjectContext;
> import org.apache.cayenne.access.DataContext;
> import org.apache.cayenne.configuration.server.ServerRuntime;
> import org.junit.After;
> import org.junit.Before;
> import org.junit.Test;
>
> public class PartnerTest {
>
> private ObjectContext context;
>
> @Before
> public void setUp() throws Exception {
>  ServerRuntime runtime = new ServerRuntime("cayenne-mxerp.xml");
> context = runtime.getContext();
>  }
>
> @After
> public void tearDown() throws Exception {
>  context.rollbackChanges();
> }
>
> @Test
>  public void testDB() {
>   }
>
> }
>
> ...but it seems since 3.2M1 runtime.getContext() is deprecated?
> What is the right way to get a context for testing?
>
> regards
> Markus
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message