Skip to content

Commit

Permalink
* Added copyright header
Browse files Browse the repository at this point in the history
* Renamed the tests.
* Added author.
  • Loading branch information
khmarbaise committed Jul 28, 2023
1 parent 34ab5f5 commit 3789f30
Show file tree
Hide file tree
Showing 12 changed files with 221 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.settings
.classpath
.project
target
/target
test-output
.idea
*.iml
Expand Down
2 changes: 1 addition & 1 deletion README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// "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
// https://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
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/soebes/module/calculator/ByteArrayWrapper.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.util.Arrays;

/**
* @author Karl Heinz Marbaise
*/
final class ByteArrayWrapper {
private final byte[] byteArray;

Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/soebes/module/calculator/CalculateChecksum.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
* @author Karl Heinz Marbaise
*/
final class CalculateChecksum {
private static final int BUFFER_SIZE = 64 * 1024;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* @author Karl Heinz Marbaise
*/
final class ChecksumForFileResult {

/**
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/soebes/module/calculator/ChecksumResult.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.util.Objects;

/**
* @author Karl Heinz Marbaise
*/
final class ChecksumResult {
private final byte[] digest;

Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/soebes/module/calculator/FileSelector.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -10,6 +29,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* @author Karl Heinz Marbaise
*/
final class FileSelector {
private static final Predicate<Path> IS_REGULAR_FILE = Files::isRegularFile;
private static final Predicate<Path> IS_READABLE = Files::isReadable;
Expand Down
28 changes: 25 additions & 3 deletions src/main/java/com/soebes/module/calculator/ModuleCalculator.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.soebes.module.calculator.FileSelector.selectAllFiles;
import static com.soebes.module.calculator.FileSelector.toChecksumForFile;

/**
* @author Karl Heinz Marbaise
*/
public final class ModuleCalculator {

private final Logger LOGGER = LoggerFactory.getLogger( getClass() );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import nl.jqno.equalsverifier.EqualsVerifier;
import nl.jqno.equalsverifier.Warning;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;

/**
* @author Karl Heinz Marbaise
*/
class ByteArrayWrapperTest {

@Test
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/com/soebes/module/calculator/FileSelectorTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
package com.soebes.module.calculator;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/

import com.github.marschall.memoryfilesystem.MemoryFileSystemBuilder;
import org.junit.jupiter.api.Test;

Expand All @@ -15,6 +34,9 @@
import static org.assertj.core.api.Assertions.assertThat;


/**
* @author Karl Heinz Marbaise
*/
class FileSelectorTest {

@Test
Expand Down
Loading

0 comments on commit 3789f30

Please sign in to comment.