Skip to content

Commit

Permalink
Add milestoning repository test
Browse files Browse the repository at this point in the history
  • Loading branch information
aziemchawdhary-gs committed Nov 14, 2024
1 parent faab12f commit 6799b32
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 4 deletions.
27 changes: 27 additions & 0 deletions legend-pure-core/legend-pure-m3-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,33 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-maven-generation-par</artifactId>
<configuration>
<sourceDirectory>${project.basedir}/src/test/resources</sourceDirectory>
<purePlatformVersion>${project.version}</purePlatformVersion>
<!-- <extraRepositories>-->
<!-- <extraRepository>${project.basedir}/src/test/resources/testMilestoningRepository.definition.json-->
<!-- </extraRepository>-->
<!-- </extraRepositories>-->
</configuration>
<executions>
<execution>
<phase>test-compile</phase>
<goals>
<goal>build-pure-jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.finos.legend.pure</groupId>
<artifactId>legend-pure-m3-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public class TestGenericRepository
public void testRepositoryDetection()
{
RichIterable<CodeRepository> repositoryList = CodeRepositoryProviderHelper.findCodeRepositories();
Assert.assertEquals(3, repositoryList.size());
Assert.assertEquals(4, repositoryList.size());
Verify.assertAllSatisfy(repositoryList, r -> r instanceof GenericCodeRepository);
Verify.assertSetsEqual(Sets.mutable.with("platform", "test_generic_repository", "other_test_generic_repository"), repositoryList.collect(CodeRepository::getName).toSet());
Verify.assertSetsEqual(Sets.mutable.with("platform", "test_generic_repository", "other_test_generic_repository", "test_milestoning_repository"), repositoryList.collect(CodeRepository::getName).toSet());
}

@Test
Expand All @@ -52,7 +52,7 @@ public void testBuildCodeStorage() throws Exception
{
RichIterable<CodeRepository> repositoryList = CodeRepositoryProviderHelper.findCodeRepositories();
CompositeCodeStorage codeStorage = new CompositeCodeStorage(new ClassLoaderCodeStorage(repositoryList));
Verify.assertSetsEqual(Sets.mutable.with("platform", "test_generic_repository", "other_test_generic_repository"), codeStorage.getAllRepositories().collect(CodeRepository::getName).toSet());
Verify.assertSetsEqual(Sets.mutable.with("platform", "test_generic_repository", "other_test_generic_repository", "test_milestoning_repository"), codeStorage.getAllRepositories().collect(CodeRepository::getName).toSet());
Verify.assertSetsEqual(Sets.mutable.with("/test_generic_repository/testBla.pure", "/other_test_generic_repository/test.pure"), codeStorage.getUserFiles().toSet().select(c -> !c.startsWith("/platform")));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// 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.pure.m3.serialization.filesystem.genericrepository.config;

import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepository;
import org.finos.legend.pure.m3.serialization.filesystem.repository.CodeRepositoryProvider;
import org.finos.legend.pure.m3.serialization.filesystem.repository.GenericCodeRepository;

public class TestMilestoningRepositoryProvider implements CodeRepositoryProvider
{

@Override
public CodeRepository repository()
{
return GenericCodeRepository.build("testMilestoningRepository.definition.json");
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
org.finos.legend.pure.m3.serialization.filesystem.genericrepository.config.TestGenericRepositoryProvider
org.finos.legend.pure.m3.serialization.filesystem.genericrepository.config.TestOtherGenericRepositoryProvider
org.finos.legend.pure.m3.serialization.filesystem.genericrepository.config.TestOtherGenericRepositoryProvider
org.finos.legend.pure.m3.serialization.filesystem.genericrepository.config.TestMilestoningRepositoryProvider
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "test_milestoning_repository",
"pattern" : "(meta)(::.*)?",
"dependencies" : ["platform"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2021 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.

0 comments on commit 6799b32

Please sign in to comment.