Package org.teiid.metadata

Examples of org.teiid.metadata.MetadataRepository


   
    static final String VDB = "metadata";
   
  @BeforeClass public static void setUp() throws Exception {
      FakeServer server = new FakeServer();
      MetadataRepository repo = Mockito.mock(MetadataRepository.class);
      server.setMetadataRepository(repo);
      Mockito.stub(repo.getViewDefinition(Mockito.anyString(), Mockito.anyInt(), (Table)Mockito.anyObject())).toAnswer(new Answer<String>() {
        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
          Table t = (Table)invocation.getArguments()[2];
          if (t.getName().equals("vw")) {
            return "select '2011'";
          }
          return null;
        }
    });
      Mockito.stub(repo.getProcedureDefinition(Mockito.anyString(), Mockito.anyInt(), (Procedure)Mockito.anyObject())).toAnswer(new Answer<String>() {
        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
          Procedure t = (Procedure)invocation.getArguments()[2];
          if (t.getName().equals("proc")) {
            return "create virtual procedure begin select '2011'; end";
          }
          return null;
        }
    });
      Mockito.stub(repo.getInsteadOfTriggerDefinition(Mockito.anyString(), Mockito.anyInt(), (Table)Mockito.anyObject(), (Table.TriggerEvent) Mockito.anyObject())).toAnswer(new Answer<String>() {
        @Override
        public String answer(InvocationOnMock invocation) throws Throwable {
        return "for each row select 1/0;";
        }
    });
      Mockito.stub(repo.isInsteadOfTriggerEnabled(Mockito.anyString(), Mockito.anyInt(), (Table)Mockito.anyObject(), (Table.TriggerEvent) Mockito.anyObject())).toAnswer(new Answer<Boolean>() {
        @Override
        public Boolean answer(InvocationOnMock invocation) throws Throwable {
        return Boolean.TRUE;
        }
    });
View Full Code Here

TOP

Related Classes of org.teiid.metadata.MetadataRepository

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.