PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/sigmah/src/test/java/org/sigmah/client/dispatch/remote/cache/SchemaCacheTest.java

http://sigma-h.googlecode.com/
Java | 33 lines | 19 code | 10 blank | 4 comment | 0 complexity | 2c3352e69569907be39e07352cff126a MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.client.dispatch.remote.cache;
 7
 8import org.junit.Assert;
 9import org.junit.Test;
10import org.sigmah.client.dispatch.remote.ProxyManager;
11import org.sigmah.client.mock.DummyData;
12import org.sigmah.shared.command.GetSchema;
13import org.sigmah.shared.dto.SchemaDTO;
14
15public class SchemaCacheTest {
16
17    @Test
18    public void testSchemaCache() {
19
20        ProxyManager proxyMgr = new ProxyManager();
21
22        SchemaCache cache = new SchemaCache(proxyMgr);
23
24        SchemaDTO schema = DummyData.PEAR();
25
26        proxyMgr.notifyListenersOfSuccess(new GetSchema(), schema);
27
28        ProxyResult<SchemaDTO> proxyResult = proxyMgr.execute(new GetSchema());
29
30        Assert.assertTrue("could execute locally", proxyResult.couldExecute);
31        Assert.assertEquals("PEAR", proxyResult.result.getDatabaseById(1).getName());
32    }
33}