/* * (C) Copyright 2006-2010 Nuxeo SA (http://nuxeo.com/) and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * bstefanescu */ package org.nuxeo.ecm.platform.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import javax.inject.Inject; import javax.naming.InitialContext; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.nuxeo.common.server.DataSource; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.schema.DocumentType; import org.nuxeo.ecm.core.schema.SchemaManager; import org.nuxeo.ecm.directory.api.DirectoryService; import org.nuxeo.runtime.datasource.DataSourceHelper; import org.nuxeo.runtime.test.runner.Features; import org.nuxeo.runtime.test.runner.FeaturesRunner; import org.nuxeo.runtime.test.runner.LocalDeploy; /** * Tests features available in platform runner * * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> */ @RunWith(FeaturesRunner.class) @Features(PlatformFeature.class) @LocalDeploy("org.nuxeo.ecm.core:local-resource-test.xml") public class RunnerTest { @Inject protected DirectoryService dirs; @Inject protected CoreSession session; @Inject protected SchemaManager sm; @Test public void testLocalResource() { DocumentType dt = sm.getDocumentType("MyFolder"); assertEquals("MyFolder", dt.getName()); } @Test @Ignore public void testDatasourceBinding() throws Exception { DataSource ds = (DataSource) new InitialContext().lookup(DataSourceHelper.getDataSourceJNDIName("nxsqldirectory")); assertNotNull(ds); } @Test public void testServiceInjection() { assertNotNull(dirs); } @Test public void testCoreSessionInjection() { assertNotNull(session); } }