Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new module for shared interfaces #174

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions legend-shared-utility-interfaces/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Overview

This module is intended to be a collection of utility interfaces/classes to be widely used across Legend repos.

Candidates for inclusion in this module include :
* Annotations such as "@ExperimentalApi"
* Test interfaces to be used with Junit Categories

# Dependencies

Since we intend to use this module widely across Legend, this module should not bring in too many (or any ?) library dependencies.

42 changes: 42 additions & 0 deletions legend-shared-utility-interfaces/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2020 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.finos.legend.shared</groupId>
<artifactId>legend-shared</artifactId>
<version>0.23.4-SNAPSHOT</version>
</parent>

<artifactId>legend-shared-utility-interfaces</artifactId>
<name>Legend Shared - Utility Interfaces</name>
<url>https://legend.finos.org</url>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
</plugins>
</build>

<dependencies>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2023 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.shared.api.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

/**
* Marker interface for preview and experimental APIs. Breaking changes may be
* introduced to elements marked as {@link ExperimentalApi}. Users should assume that anything annotated as experimental will change or break in subsequent releases.
*/
@Target({ElementType.PACKAGE, ElementType.TYPE, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.METHOD})
public @interface ExperimentalApi
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.shared.test.junit;

/*
Marker interface to be used with Junit Categories. See https://junit.org/junit4/javadoc/4.12/org/junit/experimental/categories/Categories.html

Used to indicate integration tests that test database functionality e.g. SQL generation, authentication etc
*/
public interface DatabaseIntegrationTest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between this and IntegrationTest? Why we need both?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One is more specific than the other ? For e.g for SQL tests, we want the surefire plugin to select a set of tests. I'm thinking of even more fine grained categories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we annotate the Junit categoies as @experimentalapi :-D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the value for that? Like, where you think we will run Integration test cases, but not SQL or vice-versa?

We will have an increase likelihood of not running test cases if we make this a complicated set of toggles.

We should be looking at this from the "running any test" POV so that we can try to make as intelligent decisions as possible when scheduling. The closest you get to what is happening on the test, the harder will get to make further refactoring on how things are executed.

{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.shared.test.junit;

/*
Marker interface to be used with Junit Categories. See https://junit.org/junit4/javadoc/4.12/org/junit/experimental/categories/Categories.html

Used to indicate a test that launches infrastructure (e.g. databases, Docker containers etc.) or depends on external infrastructure
*/
public interface IntegrationTest
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.shared.test.junit;

/*
Marker interface to be used with Junit Categories. See https://junit.org/junit4/javadoc/4.12/org/junit/experimental/categories/Categories.html

Used to indicate a test that can only be run on a CI/CD server because that test requires configuration (e.g. secrets) that are injected by the CI/CD server.
*/
public interface RunUsingCICDServer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need this one? My worry is that extending this interface could lead executing wrong categories. Like, do we will ever enable RunUsingCICDServer or we will enable RunUsingGithubActions and/or RunUsingTeamCity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not everyone uses Github or TeamCity. But we can always extract a base interface .

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if this is for the platform development, we should target what we use. Are aiming for people to use these generically? Even if that is the case, I will avoid extending this interface on the other two categories.

{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.shared.test.junit;

/*
Marker interface to be used with Junit Categories. See https://junit.org/junit4/javadoc/4.12/org/junit/experimental/categories/Categories.html

Used to indicate a test that can only be run on a CI/CD server because that test requires configuration (e.g. secrets) that are injected by the CI/CD server.
*/
public interface RunUsingGithubActions extends RunUsingCICDServer
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2023 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.shared.test.junit;

/*
Marker interface to be used with Junit Categories. See https://junit.org/junit4/javadoc/4.12/org/junit/experimental/categories/Categories.html

Used to indicate a test that can only be run on a CI/CD server because that test requires configuration (e.g. secrets) that are injected by the CI/CD server.
*/
public interface RunUsingTeamCity extends RunUsingCICDServer
{
}
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
<module>legend-shared-opentracing-servlet-filter</module>

<module>legend-shared-server</module>
<module>legend-shared-utility-interfaces</module>
</modules>

<build>
Expand Down Expand Up @@ -324,6 +325,11 @@
<artifactId>legend-shared-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.finos.legend.shared</groupId>
<artifactId>legend-shared-utility-interfaces</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.finos.legend.shared</groupId>
<artifactId>legend-shared-pac4j</artifactId>
Expand Down