Skip to content

Instantly share code, notes, and snippets.

View jonathanvila's full-sized avatar

Jonathan Vila jonathanvila

View GitHub Profile
{
"id": "mta",
"realm": "mta",
"displayName": "Migration Toolkit for Applications Web Console",
"notBefore": 0,
"revokeRefreshToken": false,
"refreshTokenMaxReuse": 0,
"accessTokenLifespan": 300,
"accessTokenLifespanForImplicitFlow": 900,
"ssoSessionIdleTimeout": 1800,
__ ____ __ _____ ___ __ ____ ______
--/ __ \/ / / / _ | / _ \/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/
2020-11-04 14:02:32,762 INFO [org.jbo.win.ope.KubernetesClientProducer] (main) Creating K8s Client instance
2020-11-04 14:02:32,764 INFO [org.jbo.win.ope.KubernetesClientProducer] (main) Creating windup.crd.yaml stream
2020-11-04 14:02:32,764 INFO [org.jbo.win.ope.KubernetesClientProducer] (main) Loading windup.crd.yaml
2020-11-04 14:02:32,771 INFO [org.jbo.win.ope.KubernetesClientProducer] (main) Loaded windup.crd.yaml
2020-11-04 14:02:32,771 INFO [org.jbo.win.ope.KubernetesClientProducer] (main) Registering custom kind
2020-11-04 14:02:32,771 INFO [org.jbo.win.ope.WindupOperator] (main) Startup
@jonathanvila
jonathanvila / ApiService.java
Created May 29, 2020 16:28
To transform a Page<Object> to Map<String,Object>
package org.jboss.xavier.integrations.jpa.service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.inject.Named;
/home/jonathan/.sdkman/candidates/java/8.0.181-open/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/jonathan/Apps/idea-IU-182.4323.46/lib/idea_rt.jar=44701:/home/jonathan/Apps/idea-IU-182.4323.46/bin -Dfile.encoding=UTF-8 -classpath /home/jonathan/Apps/idea-IU-182.4323.46/lib/idea_rt.jar:/home/jonathan/Apps/idea-IU-182.4323.46/plugins/junit/lib/junit-rt.jar:/home/jonathan/Apps/idea-IU-182.4323.46/plugins/junit/lib/junit5-rt.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/charsets.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/cldrdata.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/dnsns.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/jaccess.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/localedata.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/nashorn.jar:/home/jonathan/.sdkman/candidates/java/8.0.181-open/jre/lib/ext/sunec.jar:/home/jonathan/.sdkman/candidates/java/8.0
@Test
public void mainRouteBuilder_getRHIdentity_ContentGiven_ShouldAddHeadersAndReturnOriginalObjectEnriched() throws Exception {
//Given
String x_rh_identity= Base64.getEncoder().encodeToString("{\"entitlements\":{\"insights\":{\"is_entitled\":true},\"openshift\":{\"is_entitled\":true},\"smart_management\":{\"is_entitled\":false},\"hybrid_cloud\":{\"is_entitled\":true}},\"identity\":{\"internal\":{\"auth_time\":0,\"auth_type\":\"jwt-auth\",\"org_id\":\"6340056\"},\"account_number\":\"1460290\",\"user\":{\"first_name\":\"Marco\",\"is_active\":true,\"is_internal\":true,\"last_name\":\"Rizzi\",\"locale\":\"en_US\",\"is_org_admin\":false,\"username\":\"mrizzi@redhat.com\",\"email\":\"mrizzi+qa@redhat.com\"},\"type\":\"User\"}}".getBytes());
String filename = "mificherito.txt";
Map<String, Object> headers = new HashMap<>();
Map<String, String> ma_metadata = new HashMap<>();
ma_metadata.put("customerid", "8899");
headers.put("MA_metadata", ma_metada
public String getRHIdentity(String x_rh_identity_json, String filename, Map<String, Object> headers) throws IOException {
RHIdentity rhidentity;
String identity_json_decoded = new String(Base64.getDecoder().decode(x_rh_identity_json));
if (x_rh_identity_json != null) {
rhidentity = new ObjectMapper().reader().withRootName("identity").readValue(new JsonFactory().createParser(identity_json_decoded), RHIdentity.class);
} else {
rhidentity = new RHIdentity();
}
// we add all properties defined on the Insights Properties, that we should have as Headers of the message
----------------------------781795870797375185213430
Content-Disposition: form-data; name="redhat"; filename="pom.xml"
Content-Type: application/xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
implied. See the License for the specific language governing
permissions and limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
package org.jboss.xavier.integrations;
import com.github.tomakehurst.wiremock.WireMockServer;
import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
import com.github.tomakehurst.wiremock.common.FileSource;
import com.github.tomakehurst.wiremock.extension.Parameters;
import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
import com.github.tomakehurst.wiremock.http.Request;
import com.github.tomakehurst.wiremock.http.ResponseDefinition;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
<!--https://issues.jboss.org/browse/WINDUPRULE-385-->
<rule id="hibernate4-00040">
<when>
<and>
<!-- check if we are calling the setFirstResult method of one of the Query class -->
<javaclass references="{param_classes_setfirstresult}.setFirstResult(int)" >
<location>METHOD_CALL</location>
</javaclass>
<javaclass references="org.hibernate.dialect.{param_dialects}" as="result_classes_dialect">
diff --git a/src/main/resources/windup-realm/windup-realm.json b/src/main/resources/windup-realm/windup-realm.json
index 9950d85..e327674 100644
--- a/src/main/resources/windup-realm/windup-realm.json
+++ b/src/main/resources/windup-realm/windup-realm.json
@@ -1,922 +1,790 @@
{
- "id" : "rhamt",
- "realm" : "rhamt",
- "displayName" : "Red Hat Application Migration Toolkit Web Console",
- "notBefore" : 0,