Skip to content

Commit 6aea4c4

Browse files
committed
Add stubs for PMR and QueryExtensions modules
1 parent 836ab90 commit 6aea4c4

File tree

10 files changed

+361
-0
lines changed

10 files changed

+361
-0
lines changed

QueryExtensions/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import org.labkey.gradle.util.BuildUtils
2+
3+
plugins {
4+
id 'org.labkey.build.module'
5+
}
6+
7+
dependencies {
8+
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:discvrcore", depProjectConfig: "published", depExtension: "module")
9+
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:DiscvrLabKeyModules:discvrcore", depProjectConfig: "published", depExtension: "module")
10+
}

QueryExtensions/module.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ModuleClass: org.labkey.queryextensions.QueryExtensionsModule
2+
Label: Query Extensions
3+
Description: This module contains low-level extensions to the LabKey Query layer
4+
License: Apache 2.0
5+
LicenseURL: http://www.apache.org/licenses/LICENSE-2.0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
-- Create schema, tables, indexes, and constraints used for QueryExtensions module here
18+
-- All SQL VIEW definitions should be created in queryextensions-create.sql and dropped in queryextensions-drop.sql
19+
CREATE SCHEMA queryextensions;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
-- Create schema, tables, indexes, and constraints used for QueryExtensions module here
18+
-- All SQL VIEW definitions should be created in queryextensions-create.sql and dropped in queryextensions-drop.sql
19+
CREATE SCHEMA queryextensions;
20+
GO
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
* Copyright (c) 2023 LabKey Corporation
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
18+
-->
19+
<tables xsi:schemaLocation="http://labkey.org/data/xml ..\..\..\..\schemas\tableInfo.xsd"
20+
xmlns="http://labkey.org/data/xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.queryextensions;
18+
19+
import org.labkey.api.action.SimpleViewAction;
20+
import org.labkey.api.action.SpringActionController;
21+
import org.labkey.api.security.RequiresPermission;
22+
import org.labkey.api.security.permissions.ReadPermission;
23+
import org.labkey.api.view.JspView;
24+
import org.labkey.api.view.NavTree;
25+
import org.springframework.validation.BindException;
26+
import org.springframework.web.servlet.ModelAndView;
27+
28+
public class QueryExtensionsController extends SpringActionController
29+
{
30+
private static final DefaultActionResolver _actionResolver = new DefaultActionResolver(QueryExtensionsController.class);
31+
public static final String NAME = "queryextensions";
32+
33+
public QueryExtensionsController()
34+
{
35+
setActionResolver(_actionResolver);
36+
}
37+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.queryextensions;
18+
19+
public class QueryExtensionsManager
20+
{
21+
private static final QueryExtensionsManager _instance = new QueryExtensionsManager();
22+
23+
private QueryExtensionsManager()
24+
{
25+
26+
}
27+
28+
public static QueryExtensionsManager get()
29+
{
30+
return _instance;
31+
}
32+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.queryextensions;
18+
19+
import org.jetbrains.annotations.NotNull;
20+
import org.jetbrains.annotations.Nullable;
21+
import org.labkey.api.data.Container;
22+
import org.labkey.api.module.DefaultModule;
23+
import org.labkey.api.module.ModuleContext;
24+
import org.labkey.api.view.WebPartFactory;
25+
26+
import java.util.Collection;
27+
import java.util.Collections;
28+
import java.util.Set;
29+
30+
public class QueryExtensionsModule extends DefaultModule
31+
{
32+
public static final String NAME = "QueryExtensions";
33+
34+
@Override
35+
public String getName()
36+
{
37+
return NAME;
38+
}
39+
40+
@Override
41+
public @Nullable Double getSchemaVersion()
42+
{
43+
return 23.000;
44+
}
45+
46+
@Override
47+
public boolean hasScripts()
48+
{
49+
return true;
50+
}
51+
52+
@Override
53+
@NotNull
54+
protected Collection<WebPartFactory> createWebPartFactories()
55+
{
56+
return Collections.emptyList();
57+
}
58+
59+
@Override
60+
protected void init()
61+
{
62+
addController(QueryExtensionsController.NAME, QueryExtensionsController.class);
63+
}
64+
65+
@Override
66+
public void doStartup(ModuleContext moduleContext)
67+
{
68+
69+
}
70+
71+
@Override
72+
@NotNull
73+
public Collection<String> getSummary(Container c)
74+
{
75+
return Collections.emptyList();
76+
}
77+
78+
@Override
79+
@NotNull
80+
public Set<String> getSchemaNames()
81+
{
82+
return Collections.singleton(QueryExtensionsSchema.NAME);
83+
}
84+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.queryextensions;
18+
19+
import org.labkey.api.data.DbSchema;
20+
import org.labkey.api.data.DbSchemaType;
21+
import org.labkey.api.data.dialect.SqlDialect;
22+
23+
public class QueryExtensionsSchema
24+
{
25+
private static final QueryExtensionsSchema _instance = new QueryExtensionsSchema();
26+
public static final String NAME = "queryextensions";
27+
28+
public static QueryExtensionsSchema getInstance()
29+
{
30+
return _instance;
31+
}
32+
33+
private QueryExtensionsSchema()
34+
{
35+
// private constructor to prevent instantiation from
36+
// outside this class: this singleton should only be
37+
// accessed via org.labkey.queryextensions.QueryExtensionsSchema.getInstance()
38+
}
39+
40+
public DbSchema getSchema()
41+
{
42+
return DbSchema.get(NAME, DbSchemaType.Module);
43+
}
44+
45+
public SqlDialect getSqlDialect()
46+
{
47+
return getSchema().getSqlDialect();
48+
}
49+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2023 LabKey Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.labkey.test.tests.queryextensions;
18+
19+
import org.junit.Before;
20+
import org.junit.BeforeClass;
21+
import org.junit.Test;
22+
import org.junit.experimental.categories.Category;
23+
import org.labkey.test.BaseWebDriverTest;
24+
import org.labkey.test.TestTimeoutException;
25+
import org.labkey.test.categories.InDevelopment;
26+
import org.labkey.test.pages.queryextensions.BeginPage;
27+
28+
import java.util.Collections;
29+
import java.util.List;
30+
31+
import static org.junit.Assert.*;
32+
33+
@Category({InDevelopment.class})
34+
public class QueryExtensionsTest extends BaseWebDriverTest
35+
{
36+
@Override
37+
protected void doCleanup(boolean afterTest) throws TestTimeoutException
38+
{
39+
_containerHelper.deleteProject(getProjectName(), afterTest);
40+
}
41+
42+
@BeforeClass
43+
public static void setupProject()
44+
{
45+
QueryExtensionsTest init = (QueryExtensionsTest)getCurrentTest();
46+
47+
init.doSetup();
48+
}
49+
50+
private void doSetup()
51+
{
52+
_containerHelper.createProject(getProjectName(), null);
53+
}
54+
55+
@Before
56+
public void preTest()
57+
{
58+
goToProjectHome();
59+
}
60+
61+
@Test
62+
public void testQueryExtensionsModule()
63+
{
64+
_containerHelper.enableModule("QueryExtensions");
65+
66+
}
67+
68+
@Override
69+
protected BrowserType bestBrowser()
70+
{
71+
return BrowserType.CHROME;
72+
}
73+
74+
@Override
75+
protected String getProjectName()
76+
{
77+
return "QueryExtensionsTest Project";
78+
}
79+
80+
@Override
81+
public List<String> getAssociatedModules()
82+
{
83+
return Collections.singletonList("QueryExtensions");
84+
}
85+
}

0 commit comments

Comments
 (0)