Skip to content

Commit

Permalink
Fix DuckDB flows + add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelbey committed Sep 19, 2024
1 parent c8d2e88 commit d2d6177
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.list.MutableList;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.extension.CompilerExtension;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.DatabaseType;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.authentication.AuthenticationStrategy;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.authentication.TestDatabaseAuthenticationStrategy;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.flows.DatabaseAuthenticationFlowKey;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.specification.DatasourceSpecification;
import org.finos.legend.engine.protocol.pure.v1.model.packageableElement.store.relational.connection.specification.DuckDBDatasourceSpecification;
import org.finos.legend.pure.generated.Root_meta_pure_alloy_connections_alloy_authentication_AuthenticationStrategy;
Expand Down Expand Up @@ -63,4 +66,10 @@ public CompilerExtension build()
{
return new DuckDBCompilerExtension();
}

@Override
public List<DatabaseAuthenticationFlowKey> getFlowKeys()
{
return Lists.mutable.of(DatabaseAuthenticationFlowKey.newKey(DatabaseType.DuckDB, DuckDBDatasourceSpecification.class, TestDatabaseAuthenticationStrategy.class));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2024 Goldman Sachs
//
// 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.
//

package org.finos.legend.engine.language.pure.compiler.toPureGraph;

import org.finos.legend.engine.language.pure.compiler.test.TestCompilationFromGrammar;
import org.finos.legend.engine.language.pure.grammar.test.TestGrammarRoundtrip;
import org.junit.Ignore;
import org.junit.Test;

public class TestDuckDBConnectionCompiler extends TestCompilationFromGrammar.TestCompilationFromGrammarTestSuite
{
@Test
public void testDuckDbDatabaseConnection()
{
test("###Connection\n" +
"RelationalDatabaseConnection simple::DuckDBConnection\n" +
"{\n" +
" store: apps::pure::studio::relational::tests::dbInc;\n" +
" type: DuckDB;\n" +
" specification: DuckDB\n" +
" {\n" +
" path: '/test';\n" +
" };\n" +
" auth: Test;\n" +
"}\n");
}

@Override
protected String getDuplicatedElementTestCode()
{
throw new UnsupportedOperationException();
}

@Override
protected String getDuplicatedElementTestExpectedErrorMessage()
{
throw new UnsupportedOperationException();
}

@Test
@Ignore("N/A - no new elements on extension")
public void testDuplicatedElement()
{
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
public class TestDuckDBConnectionGrammarRoundtrip extends TestGrammarRoundtrip.TestGrammarRoundtripTestSuite
{
@Test
public void testDeltaLakeDatabaseConnection()
public void testDuckDbDatabaseConnection()
{
test("###Connection\n" +
"RelationalDatabaseConnection simple::DuckDBConnection\n" +
Expand Down

0 comments on commit d2d6177

Please sign in to comment.