Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into kie-issues#1330
Browse files Browse the repository at this point in the history
  • Loading branch information
yesamer committed Jun 21, 2024
2 parents e016012 + af0f91a commit 35380b6
Show file tree
Hide file tree
Showing 31 changed files with 1,016 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.drools.core.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
Expand All @@ -35,6 +36,7 @@
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;

import org.junit.AfterClass;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
Expand All @@ -52,6 +54,16 @@ public class KeyStoreHelperTest {
private static final String KEY_PASSWORD = "keypwd";
private static final String KEY_PHRASE = "secretkey";

@AfterClass
public static void cleanup() {
try {
new File(KEYSTORE_JCEKS_FILENAME).delete();
} catch (Exception e) {
// ignore
}

}

@Test
public void testSignDataWithPrivateKey() throws UnsupportedEncodingException,
UnrecoverableKeyException,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.drools.example.api.defaultkiesessionfromfile;

import java.io.File;
import java.io.PrintStream;

import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.KieRepository;
Expand All @@ -26,9 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.PrintStream;


public class DefaultKieSessionFromFileExample {

Expand Down Expand Up @@ -69,8 +69,7 @@ public static File getFile(String exampleName) {
File folder = new File("drools-examples-api").getAbsoluteFile();
File exampleFolder = null;
while (folder != null) {
exampleFolder = new File(folder,
exampleName);
exampleFolder = new File(folder, exampleName);
if (exampleFolder.exists()) {
break;
}
Expand All @@ -80,14 +79,13 @@ public static File getFile(String exampleName) {

if (exampleFolder != null) {

File targetFolder = new File(exampleFolder,
"target");
File targetFolder = new File(exampleFolder, "target");
if (!targetFolder.exists()) {
throw new RuntimeException("The target folder does not exist, please build project " + exampleName + " first");
}

for (String str : targetFolder.list()) {
if (str.startsWith(exampleName) && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
if (str.startsWith(exampleName) && str.endsWith(".jar") && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
return new File(targetFolder, str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
*/
package org.drools.example.api.defaultkiesessionfromfile;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintStream;

import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.KieRepository;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintStream;

import static org.junit.Assert.assertEquals;

public class DefaultKieSessionFromByteArrayExampleTest {
Expand Down Expand Up @@ -105,8 +105,7 @@ public static File getFile(String exampleName) {
File folder = new File("drools-examples-api").getAbsoluteFile();
File exampleFolder = null;
while (folder != null) {
exampleFolder = new File(folder,
exampleName);
exampleFolder = new File(folder, exampleName);
if (exampleFolder.exists()) {
break;
}
Expand All @@ -116,8 +115,7 @@ public static File getFile(String exampleName) {

if (exampleFolder != null) {

File targetFolder = new File(exampleFolder,
"target");
File targetFolder = new File(exampleFolder, "target");
if (!targetFolder.exists()) {
throw new RuntimeException("The target folder does not exist, please build project " + exampleName + " first");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.drools.example.api.kiemodulefrommultiplefiles;

import java.io.File;
import java.io.PrintStream;

import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.KieRepository;
Expand All @@ -27,9 +30,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.PrintStream;


public class KieModuleFromMultipleFilesExample {

Expand Down Expand Up @@ -76,8 +76,7 @@ public static File getFile(String exampleName) {
File folder = new File( KieModuleFromMultipleFilesExample.class.getProtectionDomain().getCodeSource().getLocation().getPath() );
File exampleFolder = null;
while (folder != null) {
exampleFolder = new File(folder,
exampleName);
exampleFolder = new File(folder, exampleName);
if (exampleFolder.exists()) {
break;
}
Expand All @@ -87,14 +86,13 @@ public static File getFile(String exampleName) {

if (exampleFolder != null) {

File targetFolder = new File(exampleFolder,
"target");
File targetFolder = new File(exampleFolder, "target");
if (!targetFolder.exists()) {
throw new RuntimeException("The target folder does not exist, please build project " + exampleName + " first");
}

for (String str : targetFolder.list()) {
if (str.startsWith(exampleName) && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
if (str.startsWith(exampleName) && str.endsWith(".jar") && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
return new File(targetFolder, str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.drools.example.api.kiemodulemodel;

import java.io.File;
import java.io.PrintStream;

import org.drools.base.util.Drools;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
Expand All @@ -31,9 +34,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.PrintStream;

public class KieModuleModelExample {

private static final Logger LOG = LoggerFactory.getLogger(KieModuleModelExample.class);
Expand Down Expand Up @@ -115,8 +115,7 @@ public static File getFile(String exampleName) {
File folder = new File("drools-examples-api").getAbsoluteFile();
File exampleFolder = null;
while (folder != null) {
exampleFolder = new File(folder,
exampleName);
exampleFolder = new File(folder, exampleName);
if (exampleFolder.exists()) {
break;
}
Expand All @@ -126,14 +125,13 @@ public static File getFile(String exampleName) {

if (exampleFolder != null) {

File targetFolder = new File(exampleFolder,
"target");
File targetFolder = new File(exampleFolder, "target");
if (!targetFolder.exists()) {
throw new RuntimeException("The target folder does not exist, please build project " + exampleName + " first");
}

for (String str : targetFolder.list()) {
if (str.startsWith(exampleName) && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
if (str.startsWith(exampleName) && str.endsWith(".jar") && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
return new File(targetFolder, str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
*/
package org.drools.example.api.namedkiesessionfromfile;

import java.io.File;
import java.io.PrintStream;

import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.KieRepository;
Expand All @@ -26,9 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.PrintStream;


public class NamedKieSessionFromFileExample {

Expand Down Expand Up @@ -69,8 +69,7 @@ public static File getFile(String exampleName) {
File folder = new File("drools-examples-api").getAbsoluteFile();
File exampleFolder = null;
while (folder != null) {
exampleFolder = new File(folder,
exampleName);
exampleFolder = new File(folder, exampleName);
if (exampleFolder.exists()) {
break;
}
Expand All @@ -80,14 +79,13 @@ public static File getFile(String exampleName) {

if (exampleFolder != null) {

File targetFolder = new File(exampleFolder,
"target");
File targetFolder = new File(exampleFolder, "target");
if (!targetFolder.exists()) {
throw new RuntimeException("The target folder does not exist, please build project " + exampleName + " first");
}

for (String str : targetFolder.list()) {
if (str.startsWith(exampleName) && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
if (str.startsWith(exampleName) && str.endsWith(".jar") && !str.endsWith("-sources.jar") && !str.endsWith("-tests.jar") && !str.endsWith("-javadoc.jar")) {
return new File(targetFolder, str);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.kie.dmn.feel.runtime.FEELFunction;
import org.kie.dmn.feel.runtime.Range;
import org.kie.dmn.feel.runtime.UnaryTest;
import org.kie.dmn.feel.runtime.custom.ZoneTime;

public enum BuiltInType implements SimpleType {

Expand Down Expand Up @@ -124,7 +125,7 @@ public static Type determineTypeFromInstance( Object o ) {
return STRING;
} else if( o instanceof LocalDate ) {
return DATE;
} else if( o instanceof LocalTime || o instanceof OffsetTime ) {
} else if( o instanceof LocalTime || o instanceof OffsetTime || o instanceof ZoneTime) {
return TIME;
} else if( o instanceof ZonedDateTime || o instanceof OffsetDateTime || o instanceof LocalDateTime ) {
return DATE_TIME;
Expand Down
Loading

0 comments on commit 35380b6

Please sign in to comment.