ServerManager extends ObjectImpl implements RelationalObject { public Teiid getDefaultServer(UnitOfWork transaction) throws KException { ArgCheck.isNotNull(transaction, "transaction"); ArgCheck.isTrue((transaction.getState() == UnitOfWork.State.NOT_STARTED), "transaction state is not NOT_STARTED"); KomodoObject serversNode = getRepository().komodoServersNode(transaction); KomodoObject serverObj = null; if (!serversNode.hasChild(transaction, DEFAULT_SERVER_NAME)) { serverObj = serversNode.addChild(transaction, DEFAULT_SERVER_NAME, KomodoLexicon.Teiid.NODE_TYPE); } else { serverObj = serversNode.getChild(transaction, DEFAULT_SERVER_NAME, KomodoLexicon.Teiid.NODE_TYPE); } if (serverObj != null && Teiid.RESOLVER.resolvable(transaction, serverObj)) { return Teiid.RESOLVER.resolve(transaction, serverObj); } throw new KException(Messages.getString(Relational.SERVER_MANAGER_DEFAULT_TEIID_ERROR)); } private  ServerManager(UnitOfWork uow, Repository repository ); static ServerManager getInstance(Repository repository); static void uncacheInstance(final Repository repository); @Override Filter[] getFilters(); @Override void setFilters( Filter[] newFilters ); @Override int getTypeId(); @Override KomodoType getTypeIdentifier(UnitOfWork uow); Teiid getDefaultServer(UnitOfWork transaction); boolean connectDefaultServer(UnitOfWork transaction, ServerCallback callback); boolean disconnectDefaultServer(UnitOfWork transaction, ServerCallback callback); boolean isDefaultServerConnected(UnitOfWork transaction); TeiidInstance getDefaultTeiidInstance(UnitOfWork transaction); CachedTeiid createCachedTeiid( final UnitOfWork uow, final Teiid srcTeiid); static String SERVER_CONNECT_ON_STARTUP; static final String DEFAULT_SERVER_NAME; static final boolean DEFAULT_SERVER_CONNECT_ON_STARTUP; static final int TYPE_ID; }
@Test public void shouldCreateDefaultServer() throws Exception { Teiid teiid = serverMgr.getDefaultServer(getTransaction()); assertNotNull(teiid); assertEquals(RepositoryImpl.SERVERS_ROOT + FORWARD_SLASH + ServerManager.DEFAULT_SERVER_NAME, teiid.getAbsolutePath()); teiid.setAdminUser(getTransaction(), "admin2"); assertEquals("admin2", teiid.getAdminUser(getTransaction())); }