Skip to content

Commit 2ed50dc

Browse files
committed
Add test files for license header compliance testing
- Good files with complete license headers (4 files): * Java: TestProcessor.java * Python: setup-environment.py * YAML: docker-compose.yml * Properties: application.properties - Bad files with missing/incomplete headers (5 files): * Java: NewFeature.java (no header) * Python: monitor.py (short header) * YAML: data-prepper-config.yaml (no header) * Properties: dev.properties (no header) * Shell: compile.sh (incomplete header) These files test the license header compliance system across all supported file types and various violation scenarios.
1 parent 4864d56 commit 2ed50dc

9 files changed

Lines changed: 125 additions & 0 deletions

File tree

config/docker/docker-compose.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#
2+
# Copyright OpenSearch Contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# The OpenSearch Contributors require contributions made to
6+
# this file be licensed under the Apache-2.0 license or a
7+
# compatible open source license.
8+
#
9+
10+
version: '3.8'
11+
12+
services:
13+
data-prepper:
14+
image: opensearchproject/data-prepper:latest
15+
ports:
16+
- "4900:4900"
17+
volumes:
18+
- ./pipelines.yaml:/usr/share/data-prepper/pipelines/pipelines.yaml

config/environments/dev.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Development environment configuration
2+
environment=development
3+
debug.enabled=true
4+
log.level=DEBUG
5+
data-prepper.workers=2
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.opensearch.dataprepper.core;
2+
3+
/**
4+
* This file is missing the license header completely.
5+
*/
6+
public class NewFeature {
7+
8+
public void doSomething() {
9+
System.out.println("This file has no license header!");
10+
}
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* The OpenSearch Contributors require contributions made to
6+
* this file be licensed under the Apache-2.0 license or a
7+
* compatible open source license.
8+
*/
9+
10+
package org.opensearch.dataprepper.plugins.test;
11+
12+
import org.opensearch.dataprepper.model.processor.Processor;
13+
14+
public class TestProcessor implements Processor {
15+
// This is a good Java file with complete license header
16+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: data-prepper-config
5+
namespace: opensearch
6+
data:
7+
pipelines.yaml: |
8+
simple-pipeline:
9+
source:
10+
http:
11+
port: 2021
12+
sink:
13+
- stdout:
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright OpenSearch Contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# The OpenSearch Contributors require contributions made to
6+
# this file be licensed under the Apache-2.0 license or a
7+
# compatible open source license.
8+
#
9+
10+
# Application configuration for trace analytics example
11+
server.port=8080
12+
logging.level.org.opensearch.dataprepper=DEBUG
13+
data-prepper.pipeline.workers=4

scripts/compile.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
# Copyright OpenSearch Contributors
3+
4+
# This shell script has incomplete license header
5+
set -e
6+
7+
echo "Starting compilation..."
8+
./gradlew clean build
9+
10+
echo "Compilation completed successfully!"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env python3
2+
#
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
#
10+
11+
"""
12+
Environment setup script for Data Prepper deployment.
13+
"""
14+
15+
def setup_environment():
16+
"""Set up the deployment environment."""
17+
print("Setting up environment...")
18+
19+
if __name__ == "__main__":
20+
setup_environment()

tools/monitoring/monitor.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python3
2+
# Copyright OpenSearch Contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
"""
6+
This file has only the short header (missing the 3 additional lines).
7+
"""
8+
9+
import sys
10+
import time
11+
12+
def monitor_system():
13+
"""Monitor system resources."""
14+
while True:
15+
print("Monitoring...")
16+
time.sleep(60)
17+
18+
if __name__ == "__main__":
19+
monitor_system()

0 commit comments

Comments
 (0)