This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • development/sharing/codeability-sharing-platform
1 result
Show changes
Commits on Source (18)
Showing
with 26833 additions and 17342 deletions
......@@ -54,6 +54,7 @@ pmdCheckstylePrettierLint:
- echo "Running checkstyle"
- ./mvnw -ntp checkstyle:check -Dmaven.repo.local=$MAVEN_USER_HOME || SUCCESS=false
- echo "Running prettier"
- node --version; npm --version
- npm install
- npm run prettier:check
- echo "Running eslint"
......
version: '3'
services:
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:6.8.8
environment:
- bootstrap.memory_lock=true
- cluster.name=docker-cluster-test
- 'xpack.license.self_generated.type=basic'
- 'xpack.security.enabled=true'
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
ulimits:
memlock:
soft: -1
hard: -1
networks:
- bridge_es
ports:
- '9200:9200'
kibana:
container_name: kibana
image: docker.elastic.co/kibana/kibana:6.8.8
networks:
- bridge_es
ports:
- '5601:5601'
networks:
bridge_es:
driver: bridge
driver_opts:
com.docker.network.bridge.name: bridge_es
......@@ -7,6 +7,12 @@ const environment = require('./webpack/environment');
module.exports = {
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$|dayjs/esm)'],
transform: {
'^.+\\.spec.ts?$': ['ts-jest', {//the content you'd placed at "global"
babel: true,
tsConfig: 'tsconfig.spec.json',
}],
},
resolver: 'jest-preset-angular/build/resolvers/ng-jest-resolver.js',
globals: {
...environment,
......@@ -20,5 +26,9 @@ module.exports = {
reporters: ['default', ['jest-junit', { outputDirectory: '<rootDir>/target/test-results/', outputName: 'TESTS-results-jest.xml' }]],
testResultsProcessor: 'jest-sonar-reporter',
testMatch: ['<rootDir>/src/main/webapp/app/**/@(*.)@(spec.ts)'],
testURL: 'http://localhost/',
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'http://localhost/',
html: '<html lang="de></html>'
}
};
source diff could not be displayed: it is too large. Options to address this: view the blob.
{
"name": "gitsearch",
"version": "1.3.0-SNAPSHOT",
"version": "1.6.0-SNAPSHOT",
"private": true,
"description": "Description for gitsearch",
"license": "UNLICENSED",
......@@ -85,16 +85,17 @@
"packaging": "jar"
},
"dependencies": {
"@angular/animations": "13.1.3",
"@angular/common": "13.1.3",
"@angular/compiler": "13.1.3",
"@angular/core": "13.1.3",
"@angular/forms": "13.1.3",
"@angular/localize": "13.1.3",
"@angular/material": "^13.1.3",
"@angular/platform-browser": "13.1.3",
"@angular/platform-browser-dynamic": "13.1.3",
"@angular/router": "13.1.3",
"@angular/animations": "13.4.0",
"@angular/cdk": "^13.3.9",
"@angular/common": "13.4.0",
"@angular/compiler": "13.4.0",
"@angular/core": "^13.4.0",
"@angular/forms": "13.4.0",
"@angular/localize": "13.4.0",
"@angular/material": "^13.3.9",
"@angular/platform-browser": "13.4.0",
"@angular/platform-browser-dynamic": "13.4.0",
"@angular/router": "13.4.0",
"@elastic/elasticsearch": "^8.9.0",
"@fortawesome/angular-fontawesome": "^0.10.1",
"@fortawesome/fontawesome-common-types": "^6.4.2",
......@@ -107,7 +108,7 @@
"@ngx-translate/http-loader": "7.0.0",
"ajv": "^8.12.0",
"angular-tag-cloud-module": "^13.0.0",
"bootstrap": "4.6.1",
"bootstrap": "4.6.2",
"colorjs.io": "^0.4.5",
"dayjs": "1.11.9",
"jspdf": "^2.5.1",
......@@ -117,23 +118,25 @@
"ngx-infinite-scroll": "10.0.1",
"ngx-markdown": "^13.0.0",
"ngx-webstorage": "9.0.0",
"npm": "^10.2.5",
"npm-check-updates": "^16.10.17",
"rxjs": "7.8.1",
"swagger-ui-dist": "4.2.1",
"tslib": "2.6.1",
"zone.js": "0.11.4"
"yarn": "^1.22.21",
"zone.js": "^0.11.4"
},
"devDependencies": {
"@angular-builders/custom-webpack": "13.0.0",
"@angular-builders/jest": "13.0.2",
"@angular-devkit/build-angular": "13.1.2",
"@angular-eslint/eslint-plugin": "13.0.1",
"@angular/cli": "13.1.2",
"@angular/compiler-cli": "13.1.3",
"@angular/service-worker": "13.1.3",
"@angular-builders/custom-webpack": "13.1.0",
"@angular-builders/jest": "13.0.4",
"@angular-devkit/build-angular": "13.3.11",
"@angular-eslint/eslint-plugin": "13.5.0",
"@angular/cli": "13.3.11",
"@angular/compiler-cli": "13.4.0",
"@angular/service-worker": "13.4.0",
"@types/chai": "4.3.5",
"@types/chai-string": "1.4.2",
"@types/jest": "27.4.0",
"@types/jest": "^29.5.11",
"@types/jspdf": "^2.0.0",
"@types/lodash": "^4.14.196",
"@types/mocha": "8.2.0",
......@@ -152,12 +155,12 @@
"eslint-config-prettier": "8.10.0",
"eslint-webpack-plugin": "3.1.1",
"folder-hash": "4.0.4",
"generator-jhipster": "^7.9.3",
"generator-jhipster": "^8.1.0",
"husky": "^7.0.4",
"jest": "27.4.7",
"jest-date-mock": "1.0.8",
"jest-environment-jsdom": "^29.7.0",
"jest-junit": "13.0.0",
"jest-preset-angular": "11.0.1",
"jest-preset-angular": "13.1.4",
"jest-sonar-reporter": "2.0.0",
"lint-staged": "12.2.2",
"merge-jsons-webpack-plugin": "2.0.1",
......@@ -167,9 +170,9 @@
"prettier-plugin-packagejson": "2.4.5",
"protractor": "7.0.0",
"rimraf": "3.0.2",
"ts-jest": "27.1.3",
"ts-jest": "29.1.1",
"ts-node": "9.1.1",
"typescript": "4.5.4",
"typescript": "4.6.4",
"wait-on": "6.0.0",
"webdriver-manager": "12.1.9",
"webpack-bundle-analyzer": "4.9.0",
......@@ -185,8 +188,5 @@
"jestSonar": {
"reportPath": "target/test-results/jest",
"reportFile": "TESTS-results-sonar.xml"
},
"overrides": {
"webpack": "5.66.0"
}
}
......@@ -7,7 +7,7 @@
<groupId>at.ac.uibk.gitsearch</groupId>
<artifactId>gitsearch</artifactId>
<version>1.5.0-SNAPSHOT</version>
<version>1.6.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Gitsearch</name>
<description>Sharing Plattform WebApp</description>
......@@ -29,8 +29,8 @@
<!-- Build properties -->
<maven.version>3.3.9</maven.version>
<java.version>11</java.version>
<node.version>v16.13.1</node.version>
<npm.version>8.3.2</npm.version>
<node.version>v20.10.0</node.version>
<npm.version>10.2.5</npm.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
......@@ -48,9 +48,10 @@
<!-- Dependency versions -->
<jhipster-dependencies.version>7.6.0</jhipster-dependencies.version>
<jhipster-dependenciesXX.version>7.9.3</jhipster-dependenciesXX.version>
<!-- The spring-boot version should match the one managed by
https://mvnrepository.com/artifact/tech.jhipster/jhipster-dependencies/${jhipster-dependencies.version} -->
<spring-boot.version>2.7.9</spring-boot.version>
<spring-boot.version>2.7.18</spring-boot.version>
<!-- The hibernate version should match the one managed by
https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies/${spring-boot.version} -->
<hibernate.version>5.6.4.Final</hibernate.version>
......@@ -138,7 +139,6 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
......@@ -402,12 +402,12 @@
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>7.17.9</version>
<version>7.17.16</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.0.1</version>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>com.networknt</groupId>
......
id;name;json_query;user_id_id
1;mint green card;deposit;1
2;Iowa whiteboard;Berkshire project;2
3;payment SQL;Licensed Mission User-friendly;1
4;Strategist;Music Home input;2
5;Dynamic Colorado;Networked cutting-edge;1
6;navigating executive Germany;benchmark microchip;2
7;input;Planner visionary Handcrafted;2
8;reboot cyan Cotton;Director Tuna Reunion;1
9;system Health;Wooden Coordinator cross-platform;1
10;Kentucky Triple-buffered;Incredible Soft Shirt;1
FROM jhipster/jhipster:v7.9.3
FROM jhipster/jhipster:v7.9.4
USER root
ARG VERSION=6.40.0
RUN apt update && apt install -y default-jre xvfb zip wget ca-certificates libnss3-dev libasound2 libxss1 libappindicator3-1 libindicator7 gconf-service libgconf-2-4 libpango1.0-0 xdg-utils fonts-liberation libgbm1 bash rsync openssh-client
RUN apt update && apt install -y default-jre xvfb zip wget ca-certificates libnss3-dev libasound2 libxss1 libappindicator3-1 libindicator7 gconf-service libgconf-2-4 libpango1.0-0 xdg-utils fonts-liberation libgbm1 bash rsync openssh-client
RUN npm install -g n
RUN n v20.10.0
......@@ -35,7 +35,10 @@ It can be executed as follows:
- ``. .env`` the .env file can be found in the KeePass file. It contains the secrets for the containers. A current version of .env can be found in the keepass file.
- ``export GITLAB_HOME``
- ``export INDEXING_SERVICE_URL``
- ``export COMMIT_ID=$(git rev-parse HEAD); export COMMIT_DATE=$(git show -s --format=%ct``
- ``docker-compose -f gitsearch.yml create gitlab`` # this may fail, if the format of the gitsearch-app version needs to be adapted.
.. note::
the command may complain about missing variables COMMIT_ID, COMMIT_DATE, GITLAB_API_ROOT_ACCESS_TOKEN. This is ok, since the variables are only used in the gitlab container.
- ``docker-compose -f gitsearch.yml up -d gitlab plantuml elasticsearch``
The following environment variables are set within the config files.
......
......@@ -17,7 +17,7 @@ import tech.jhipster.config.JHipsterConstants;
import tech.jhipster.config.h2.H2ConfigurationHelper;
@Configuration
@EnableJpaRepositories({ "at.ac.uibk.gitsearch.repository", "at.ac.uibk.gitsearch.repository.jpa" })
@EnableJpaRepositories({ "at.ac.uibk.gitsearch.repository" })
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
@EnableElasticsearchRepositories("at.ac.uibk.gitsearch.repository.search")
......
......@@ -44,7 +44,7 @@ public class LiquibaseConfiguration {
dataSourceProperties
);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setChangeLog("classpath:/config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setLiquibaseSchema(liquibaseProperties.getLiquibaseSchema());
......
......@@ -9,8 +9,10 @@ import at.ac.uibk.gitsearch.service.ShoppingBasketService.ShoppingBasketRedirect
import io.swagger.v3.oas.annotations.ExternalDocumentation;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import org.codeability.sharing.plugins.api.ShoppingBasket;
import org.codeability.sharing.plugins.api.search.SearchResultsDTO;
import org.gitlab4j.api.GitLabApiException;
......@@ -167,12 +169,20 @@ public class PluginInterfaceResource {
)
@GetMapping("/pluginIF/v0.1/basket/{basketToken}/repository/{exerciseId}")
@SuppressWarnings("PMD.CloseResource")
public ResponseEntity<?> getRepositoryZip(@PathVariable String basketToken, @PathVariable int exerciseId) throws IOException {
public ResponseEntity<InputStreamResource> getRepositoryZip(@PathVariable String basketToken, @PathVariable int exerciseId)
throws IOException {
InputStream zip;
try {
zip = basketService.getRepositoryZip(basketToken, exerciseId);
} catch (GitLabApiException e) {
return ResponseEntity.unprocessableEntity().body(e.getMessage());
return ResponseEntity
.unprocessableEntity()
.body(
new InputStreamResource(
new ByteArrayInputStream(e.getMessage().getBytes(StandardCharsets.UTF_8)),
"Internal Error: " + e.getMessage()
)
);
}
InputStreamResource resource = new InputStreamResource(zip);
return ResponseEntity
......
......@@ -15,7 +15,11 @@ import org.springframework.security.authentication.UsernamePasswordAuthenticatio
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
* Controller to authenticate users.
......@@ -74,7 +78,7 @@ public class UserJWTController {
@SuppressWarnings("unchecked")
Map<String, String> details = (Map<String, String>) authentication.getDetails();
if (!details.containsKey(TokenProvider.PRE_TOKEN_CLAIM)) {
return new ResponseEntity<>(null, HttpStatus.UNAUTHORIZED);
return new ResponseEntity<>((JWTToken) null, HttpStatus.UNAUTHORIZED);
}
updateLastLogin(authentication);
SecurityContextHolder.getContext().setAuthentication(authentication);
......@@ -83,7 +87,7 @@ public class UserJWTController {
httpHeaders.add(JWTFilter.AUTHORIZATION_HEADER, "Bearer " + jwt);
return new ResponseEntity<>(new JWTToken(jwt), httpHeaders, HttpStatus.OK);
} else {
return new ResponseEntity<>(null, HttpStatus.UNAUTHORIZED);
return new ResponseEntity<>((JWTToken) null, HttpStatus.UNAUTHORIZED);
}
}
......
......@@ -9,22 +9,20 @@ import { ActivateComponent } from './activate.component';
describe('ActivateComponent', () => {
let comp: ActivateComponent;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [ActivateComponent],
providers: [
{
provide: ActivatedRoute,
useValue: { queryParams: of({ key: 'ABC123' }) },
},
],
})
.overrideTemplate(ActivateComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [ActivateComponent],
providers: [
{
provide: ActivatedRoute,
useValue: { queryParams: of({ key: 'ABC123' }) },
},
],
})
);
.overrideTemplate(ActivateComponent, '')
.compileComponents();
}));
beforeEach(() => {
const fixture = TestBed.createComponent(ActivateComponent);
......
......@@ -6,15 +6,13 @@ describe('PasswordStrengthBarComponent', () => {
let comp: PasswordStrengthBarComponent;
let fixture: ComponentFixture<PasswordStrengthBarComponent>;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PasswordStrengthBarComponent],
})
.overrideTemplate(PasswordStrengthBarComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [PasswordStrengthBarComponent],
})
);
.overrideTemplate(PasswordStrengthBarComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PasswordStrengthBarComponent);
......
......@@ -16,17 +16,15 @@ describe('PasswordComponent', () => {
let fixture: ComponentFixture<PasswordComponent>;
let service: PasswordService;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [PasswordComponent],
providers: [FormBuilder, AccountService],
})
.overrideTemplate(PasswordComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [PasswordComponent],
providers: [FormBuilder, AccountService],
})
);
.overrideTemplate(PasswordComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PasswordComponent);
......
......@@ -13,17 +13,15 @@ describe('RegisterComponent', () => {
let fixture: ComponentFixture<RegisterComponent>;
let comp: RegisterComponent;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
declarations: [RegisterComponent],
providers: [FormBuilder],
})
.overrideTemplate(RegisterComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
declarations: [RegisterComponent],
providers: [FormBuilder],
})
);
.overrideTemplate(RegisterComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(RegisterComponent);
......
......@@ -26,17 +26,15 @@ describe('SettingsComponent', () => {
imageUrl: '',
};
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
declarations: [SettingsComponent],
providers: [FormBuilder, AccountService],
})
.overrideTemplate(SettingsComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
declarations: [SettingsComponent],
providers: [FormBuilder, AccountService],
})
);
.overrideTemplate(SettingsComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingsComponent);
......
......@@ -11,17 +11,15 @@ describe('ConfigurationComponent', () => {
let fixture: ComponentFixture<ConfigurationComponent>;
let service: ConfigurationService;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [ConfigurationComponent],
providers: [ConfigurationService],
})
.overrideTemplate(ConfigurationComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [ConfigurationComponent],
providers: [ConfigurationService],
})
);
.overrideTemplate(ConfigurationComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ConfigurationComponent);
......
......@@ -12,16 +12,14 @@ describe('HealthComponent', () => {
let fixture: ComponentFixture<HealthComponent>;
let service: HealthService;
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [HealthComponent],
})
.overrideTemplate(HealthComponent, '')
.compileComponents();
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
declarations: [HealthComponent],
})
);
.overrideTemplate(HealthComponent, '')
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HealthComponent);
......