Skip to content

Instantly share code, notes, and snippets.

@walidum
walidum / JUnit5CustomExtension.java
Created July 25, 2021 16:19
JUnit5CustomExtension
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
public class JUnit5CustomExtension implements AfterEachCallback, BeforeEachCallback {
@Override
public void beforeEach(ExtensionContext extensionContext) throws Exception {
System.out.println(this.getClass().getSimpleName() + " " + extensionContext.getDisplayName() + " has started");
}
@walidum
walidum / pom.xml
Created July 25, 2021 12:20
Maven Surefire plugin
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
@walidum
walidum / pom.xml
Created July 25, 2021 12:16
junit 5 dependencies
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
@walidum
walidum / common.service.ts
Created July 23, 2021 09:12
common.service.ts
import { Injectable } from '@angular/core';
@Injectable()
export class CommonService {
// javascript object types
TYPE_OBJECT = 'object'
TYPE_FUNCTION = 'function'
TYPE_STRING = 'string'
TYPE_UNDEFINED = 'undefined'
@walidum
walidum / FireBaseService.java
Created July 13, 2021 13:04
FireBaseService.java
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Bucket;
import com.google.firebase.cloud.StorageClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@Service
@walidum
walidum / FireBaseConfig.java
Created July 13, 2021 12:50
FireBaseConfig
@Component
public class FireBaseConfig {
@Value("${firebase.bucket-name}")
private String bucketName;
@PostConstruct
public void init() {
FileInputStream serviceAccount = null;
try {
serviceAccount = new FileInputStream("./serviceAccountKey.json");
@walidum
walidum / application.properties
Created July 13, 2021 12:47
application.properties
firebase.bucket-name=test-project-ee5c9.appspot.com
firebase.image-url=https://storage.googleapis.com/${firebase.bucket-name}/%s
@walidum
walidum / pom.xml
Created July 13, 2021 12:43
dependencies to add in pom.xml file
<dependency>
<groupId>com.google.firebase</groupId>
<artifactId>firebase-admin</artifactId>
<version>8.0.0</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>1.96.0</version>
</dependency>
@walidum
walidum / link.txt
Last active June 7, 2021 09:20
Link to drive
@walidum
walidum / to.json
Created June 2, 2021 10:57
Data path "" must NOT have additional properties(styleext).
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},