miércoles, 23 de octubre de 2019

HashMap Road Operations Java

HashMap Road Operations Java


https://github.com/jalbertomr/HashMapOperations.git



Console Output

============== createEmptyHashMapTestInitCapLoadFac =================
map is Emply
============== createEmptyHashMapFromMapTest =================
map is Emply
============== remove =================
{cinco=5555, seisB=NOREMOVER, uno=1111, dos=2222, seis=REMOVER, tres=3333, cuatro=4444}
hashmap.remove("seis")
{cinco=5555, seisB=NOREMOVER, uno=1111, dos=2222, tres=3333, cuatro=4444}
hashmap.remove("seisB", "XXX")
{cinco=5555, seisB=NOREMOVER, uno=1111, dos=2222, tres=3333, cuatro=4444}
hashmap.remove("seisB", "NOREMOVER");
{cinco=5555, uno=1111, dos=2222, tres=3333, cuatro=4444}
============== getKeys =================
{1=Uno, 2=Dos, 3=Tres, 4=Cuatro, 5=Cinco}
1, 2, 3, 4, 5,
============== createEmptyHashMapInitCapacityTest =================
map is Emply
============== fillHashMapTest =================
== hashMap
key: cinco value: 5
key: CUATRO value: 4
key: uno value: 1
key: dos value: 2
key: tres value: 33
key: cuatro value: 4
== hashMap2
key: sies value: 6
key: siete value: 7
hashMap2.putAll(hashMap);
== hashMap
key: cinco value: 5
key: CUATRO value: 4
key: uno value: 1
key: dos value: 2
key: tres value: 33
key: cuatro value: 4
== hashMap2
key: cinco value: 5
key: sies value: 6
key: CUATRO value: 4
key: siete value: 7
key: uno value: 1
key: dos value: 2
key: tres value: 33
key: cuatro value: 4
============== getValues =================
{1=Uno, 2=Dos, 3=Tres, 4=Cuatro, 5=Cinco}
Uno, Dos, Tres, Cuatro, Cinco,
============== putIfAbsentTest =================
{1=uno, 2=dos, 3=tres, 4=cuatro, 5=cinco}
{1=UNO, 2=dos, 3=tres, 4=cuatro, 5=cinco}
hashmap.put() overwrites on key
{1=UNO, 2=dos, 3=tres, 4=cuatro, 5=cinco}
hashmap.putifAbsent() not overwrites on key
============== sizeAndClear =================
{1=Uno, 2=Dos, 3=Tres, 4=Cuatro, 5=Cinco}
hashmap.size() : 5
hashmap.clear()
{}
hashmap.size() : 0
============== createEmptyHashMapTest =================
map is Emply
============== replace =================
{cinco=5555, siete=VALIDADO, uno=1111, dos=2222, seis=A REEMPLAZAR, tres=3333, cuatro=4444}
hashmap.replace("seis", "6666")
{cinco=5555, siete=VALIDADO, uno=1111, dos=2222, seis=6666, tres=3333, cuatro=4444}
hashmap.replace("siete", "NO ES", "OK7777")
{cinco=5555, siete=VALIDADO, uno=1111, dos=2222, seis=6666, tres=3333, cuatro=4444}
hashmap.replace("siete", "VALIDADO", "OK7777")
{cinco=5555, siete=OK7777, uno=1111, dos=2222, seis=6666, tres=3333, cuatro=4444}
============== containsKeyORValue =================
{1=uno, 2=dos, 3=tres, 4=cuatro, 5=cinco}
hashmap.containsKey(2) : true
hashmap.containsValue("cuatro") : true
hashmap.containsKey(99) : false
hashmap.containsValue("NO ESTA") : false
============== traverse =================
{1=Uno, 2=Dos, 3=Tres, 4=Cuatro, 5=Cinco}
--- forEach
key: 1 value: Uno
key: 2 value: Dos
key: 3 value: Tres
key: 4 value: Cuatro
key: 5 value: Cinco
--- for
key: 1 value: Uno
key: 2 value: Dos
key: 3 value: Tres
key: 4 value: Cuatro
key: 5 value: Cinco
--- iterator
key: 1 value: Uno
key: 2 value: Dos
key: 3 value: Tres
key: 4 value: Cuatro
key: 5 value: Cinco


eot

miércoles, 16 de octubre de 2019

TIBCO TEA developing a Basic Custom Agent, java

TIBCO TEA developing a Basic Custom Agent, java

https://github.com/jalbertomr/basicCustomAgent.git


Starting from the docmentacion of TIBCO TEA, developers guide. BasicCustomAgent is a simple application that works as an agent with an operation. a simple message text.

The TEA is running and also the basic custom agent, now register it.













eot

martes, 15 de octubre de 2019

TIBCO Concepts Domain, AppSpace, Node, Tea Architecture

TIBCO Concepts Domain, AppSpace, Node, Tea Architecture

Domain

AppSpace


Node


TEA Administration Architecture



eot

TIBCO TEA change default path to logs, data

TIBCO TEA change default path to logs, data


   By default TEA uses a route for configuration files, logs and data where the datastore are. By X rason I need to change it to another drive.  All this is manually.

- Change the tea.tra file, but first create a system var. TEA_CONFIG_HOME

This is used in tea.tra, It is pointing to the desired path.


Copy the original content of the path to the desired path. This is because de installer creates a directory structure that is not on the desired destination. after that, we restart de TEA and the change happen.


READY...




eot

TIBCO TEA Connecting to the remote shell

TIBCO TEA Connecting to the remote shell



This is how to connect to the TEA shell

C:\Users\bext>ssh -o HostKeyAlgorithms=ssh-dss -oKexAlgorithms=+diffie-hellman-group1-sha1 -p 2222 admin@localhost
admin@localhost's password:
    _____ _____    _      ____  _          _ _
   |_   _| ____|  / \    / ___|| |__   ___| | |
     | | |  _|   / _ \   \___ \| '_ \ / _ \ | |
     | | | |___ / ___ \   ___) | | | |  __/ | |
     |_| |_____/_/   \_\ |____/|_| |_|\___|_|_|

TEA shell v2.3.0-015

Hit '<tab>' for a list of available commands
   and '[cmd] --help' for help on a specific command.
   or 'help [cmd]' to get detailed help on the command with samples.
Run 'logout' or 'exit' to exit the shell.

admin@DESKTOP-NLF0058:/>


Obiously, we must first run the TEA administarator, in this case by means of the windows menu, and


In this case the routes path has been changed to another drive than the default. it was made changing the config files manually.

eot

martes, 8 de octubre de 2019

Spring Boot , Angular 7 REST

Spring Boot , Angular 7 REST

código
https://github.com/jalbertomr/springbootRestCross
https://github.com/jalbertomr/Angular7RestCross




Probando spring boot desde el browser

Pasamos a la Parte de Angular


bext@bext-G3-3779:~$ npm -v
6.9.0
bext@bext-G3-3779:~$ node -v
v10.16.3

Instalamos angular cli
 
bext@bext-G3-3779:~$ npm install -g @angular/cli
/home/bext/.nvm/versions/node/v10.16.3/bin/ng -> /home/bext/.nvm/versions/node/v10.16.3/lib/node_modules/@angular/cli/bin/ng

> @angular/cli@8.3.8 postinstall /home/bext/.nvm/versions/node/v10.16.3/lib/node_modules/@angular/cli
> node ./bin/postinstall/script.js

? Would you like to share anonymous usage data with the Angular Team at Google u
nder
Google’s Privacy Policy at https://policies.google.com/privacy? For more details
 and
how to change this setting, see http://angular.io/analytics. No
+ @angular/cli@8.3.8
added 244 packages from 185 contributors in 47.928s


   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │       New minor version of npm available! 6.9.0 → 6.12.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.12.0   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

bext@bext-G3-3779:~$ 
bext@bext-G3-3779:~$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 8.3.8
Node: 10.16.3
OS: linux x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.803.8
@angular-devkit/core         8.3.8
@angular-devkit/schematics   8.3.8
@schematics/angular          8.3.8
@schematics/update           0.803.8
rxjs                         6.4.0
    
bext@bext-G3-3779:~$ 

Creamos el proyecto angular con angular cli

bext@bext-G3-3779:~/nodeWorkspace$ ng new person-management
? Would you like to add Angular routing? Yes
? Which stylesheet format would you like to use? CSS
CREATE person-management/README.md (1033 bytes)
CREATE person-management/.editorconfig (246 bytes)
CREATE person-management/.gitignore (631 bytes)
CREATE person-management/angular.json (3681 bytes)
CREATE person-management/package.json (1291 bytes)
CREATE person-management/tsconfig.json (543 bytes)
CREATE person-management/tslint.json (1953 bytes)
CREATE person-management/browserslist (429 bytes)
CREATE person-management/karma.conf.js (1029 bytes)
CREATE person-management/tsconfig.app.json (270 bytes)
CREATE person-management/tsconfig.spec.json (270 bytes)
CREATE person-management/src/favicon.ico (948 bytes)
CREATE person-management/src/index.html (302 bytes)
CREATE person-management/src/main.ts (372 bytes)
CREATE person-management/src/polyfills.ts (2838 bytes)
CREATE person-management/src/styles.css (80 bytes)
CREATE person-management/src/test.ts (642 bytes)
CREATE person-management/src/assets/.gitkeep (0 bytes)
CREATE person-management/src/environments/environment.prod.ts (51 bytes)
CREATE person-management/src/environments/environment.ts (662 bytes)
CREATE person-management/src/app/app-routing.module.ts (246 bytes)
CREATE person-management/src/app/app.module.ts (393 bytes)
CREATE person-management/src/app/app.component.css (0 bytes)
CREATE person-management/src/app/app.component.html (25530 bytes)
CREATE person-management/src/app/app.component.spec.ts (1131 bytes)
CREATE person-management/src/app/app.component.ts (221 bytes)
CREATE person-management/e2e/protractor.conf.js (810 bytes)
CREATE person-management/e2e/tsconfig.json (214 bytes)
CREATE person-management/e2e/src/app.e2e-spec.ts (650 bytes)
CREATE person-management/e2e/src/app.po.ts (262 bytes)

> core-js@2.6.9 postinstall /home/bext/nodeWorkspace/person-management/node_modules/babel-runtime/node_modules/core-js
> node scripts/postinstall || echo "ignore"


> core-js@3.2.1 postinstall /home/bext/nodeWorkspace/person-management/node_modules/core-js
> node scripts/postinstall || echo "ignore"


> core-js@2.6.9 postinstall /home/bext/nodeWorkspace/person-management/node_modules/karma/node_modules/core-js
> node scripts/postinstall || echo "ignore"


> @angular/cli@8.3.8 postinstall /home/bext/nodeWorkspace/person-management/node_modules/@angular/cli
> node ./bin/postinstall/script.js

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/watchpack/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/karma/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/@angular/compiler-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.0 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.0: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1189 packages from 1051 contributors and audited 18849 packages in 17.955s
found 0 vulnerabilities

    Successfully initialized git.
bext@bext-G3-3779:~/nodeWorkspace$ dir
person-management  simpleRest
Ya creado el proyecto en angular lo probamos


bext@bext-G3-3779:~/nodeWorkspace/person-management$ ng serve
10% building 3/3 modules 0 activeℹ 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 52.4 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.72 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 4.08 MB [initial] [rendered]
Date: 2019-10-08T22:59:43.145Z - Hash: 3b04a273cad2461b798c - Time: 5347ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
ℹ 「wdm」: Compiled successfully. 
 
Lo probamos en el browser


Ahora editamos el proyecto angular con Visual Studio Code, y le creamos el componente person


bext@bext-G3-3779:~/nodeWorkspace/person-management$ ng generate component person
CREATE src/app/person/person.component.css (0 bytes)
CREATE src/app/person/person.component.html (21 bytes)
CREATE src/app/person/person.component.spec.ts (628 bytes)
CREATE src/app/person/person.component.ts (269 bytes)
UPDATE src/app/app.module.ts (475 bytes)


ya creado el componente person, modificamos app-routing.module.ts para integrar PersonComponent en el ruteador.

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PersonComponent } from './person/person.component';

const routes: Routes = [
  { path:'', component: PersonComponent },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Al ejecutar nuevamente la aplicación en angular,  aparece la página inicial más un texto persona works!, quitamos el código extra en app.component.html que genera la página inicial y solo dejamos la última linea. quedando...

<router-outlet></router-outlet>


creamos un servicio que llamará a spring boot

bext@bext-G3-3779:~/nodeWorkspace/person-management$ ng generate service service/httpClient
CREATE src/app/service/http-client.service.spec.ts (354 bytes)
CREATE src/app/service/http-client.service.ts (139 bytes)

Ahora modificamos http-client.service.ts para que llame al servicio rest en spring boot, para eso importamos el llamado http. creamos una clase Person compatible a la de regreso del servicio spring boot la cual es capturada en un array. exportamos la clase que contiene la respuesta HttpClientService, la cual posteriormente la importamos en los modulos de la app.

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

export class Person {
  constructor(
    id:string,
    nombre:string,
    email:string,
    peso:string
  ) {}
}

@Injectable({
  providedIn: 'root'
})
export class HttpClientService {

  constructor( private httpClient:HttpClient) { }

  getPersonas() {
    console.log('llamando al servicio spring boot...');
    return this.httpClient.get<Person[]>('http://localhost:8080/personas');
  }
}

app.module.ts
...
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { PersonComponent } from './person/person.component';
import { HttpClientModule } from '@angular/common/http';

@NgModule({
  declarations: [
    AppComponent,
    PersonComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    HttpClientModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

en el componente person.component.ts integramos la respuesta del servicio que creamos.

import { Component, OnInit } from '@angular/core';
import { HttpClientService } from '../service/http-client.service';

@Component({
  selector: 'app-person',
  templateUrl: './person.component.html',
  styleUrls: ['./person.component.css']
})
export class PersonComponent implements OnInit {

  personas:string[];

  constructor( private httpClientService:HttpClientService ) { }

  ngOnInit() {
    this.httpClientService.getPersonas().subscribe( 
      response => this.handleSuccessfulResponse( response ));
  }

  handleSuccessfulResponse(response)
  {
    this.personas=response;
  }
}

Ahora adaptamos el html del componente person para que los datos los despliegue en una tabla.

<div>
<table border="1">
    <thead></thead>
    <tr>
        <th>id</th><th>nombre</th><th>email</th><th>peso</th>
    </tr>
    <tbody>
        <tr *ngFor="let persona of personas">
            <td>{{persona.id}}</td>
            <td>{{persona.nombre}}</td>
            <td>{{persona.email}}</td>
            <td>{{persona.peso}}</td>
        </tr>
    </tbody>
</table>
</div>

Ahora ejecutamos la aplicación spting boot para tener disponible los datos de persona, y también ejecutamos la aplicación en angular que llamará al servicio spring boot.


 Y llamamos en el browser la app de angular

listo.

eot

lunes, 7 de octubre de 2019

TIBCO TEA deploying simple REST

TIBCO TEA deploying simple REST

Esta es la app que se deployará al TEA.


Probandolo con swagger


Exportamos la aplicacion como ear a una ruta X donde después desde el TEA lo tomaremos para deployarlo en TEA.


- Tenemos corriendo el TEA.
- Desde linea de comandos corremos el bwagent
Configuramos el bwagent para que corra en modo "enterprise" , esto en su archivo de configuración

C:\Program Files\tibco\bw6\bw\6.5\config\bwagent.ini
...
#------------------------------------------------------------------------------
# Section: BW Agent general configuraton.
#------------------------------------------------------------------------------
# Admin mode. BW Administration tools can work in two modes, enterprise mode or
# local mode. In enterprise mode it works with the agents across machines.
# In local mode it works only with local machine and assumes no data store
# and transport and agents are available. The actions performed in local mode
# are not visible to the agents when ever they are started or even
# the admin tool when it is started in the enterprise mode
#bw.admin.mode=local
bw.admin.mode=enterprise

# Network (group) name
bw.agent.networkName=bwmetaspace

...


C:\Program Files\tibco\bw6\bw\6.5\bin>bwagent
TIBCO ActiveMatrix BusinessWorks version 6.5.0, hotfix 4, build V99, 2018-11-21
BW Agent name DESKTOP-NLF0058
BW Agent stores data locally
Initializing datastore using
 TIBCO ActiveSpaces (Java). Enterprise Edition. Version 2.1.6.011
...................
Initialization of datastore complete
BW Agents in the group that store data:
Name DESKTOP-NLF0058, Host 10.17.14.2
19:23:08.401 WARN  [main] o.e.j.s.handler.RequestLogHandler - !RequestLog
TIBCO-BW-AGENT-300002: BusinessWorks Agent started successfully.



- Desde linea de comandos corremos el bwadmin para registrar el bwagent

Para desregistrar bwagent
C:\Program Files\tibco\bw6\bw\6.5\bin>bwadmin
TIBCO ActiveMatrix BusinessWorks version 6.5.0, hotfix 4, build V99, 2018-11-21
BusinessWorks Administration Console

Hit '<tab>' for a list of available commands
   and 'help command ' for help on a specific command.
Enter 'exit' or Ctrl-D to exit the shell.

bwadmin[admin]> unregisterteaagent http://localhost:8777/tea
Connecting to the BW Agent using
 TIBCO ActiveSpaces (Java). Enterprise Edition. Version 2.1.6.011
 Connected to BW Agent

TIBCO-BW-ADMIN-CLI-300011: Unregistered TEA Agent [DESKTOP-NLF0058] with TEA Server.

bwadmin[admin]>


Para registrar bwagent
bwadmin[admin]> registerteaagent http://localhost:8777/tea
TIBCO-BW-ADMIN-CLI-300010: Registered TEA Agent [DESKTOP-NLF0058] with TEA Server.


Lo verificamos en el TEA








- Creamos un Dominio, un AppSpace y  un Nodo.











Arrancamos el AppSpace que creamos, así se arrancarán los nodos también.





Ahora subimos el ear que deseamos deployar





lo deployamos



Ahora lo probamos llamando a la aplicación que deployamos




eot