Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added TSQ manager and its IVT program #984

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public interface ICicsRegion {
ICemt cemt() throws CicstsManagerException;
ICeda ceda() throws CicstsManagerException;
ICeci ceci() throws CicstsManagerException;
ITsqFactory getTsqFactory() throws CicstsManagerException;

/**
* Provides a CICS resource instance that can then be used to create a specific CICS resource
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts;

import javax.validation.constraints.NotNull;
public interface ITsq {
Anuprakash-Moothedath marked this conversation as resolved.
Show resolved Hide resolved

/**
* Check the existence of a TSQ.
* @throws TsqException if there is a problem in checking the TSQ existence
* @return boolean based on if TSQ is existing or not
*/
public boolean exists() throws TsqException;

/**
* Check if a TSQ is recoverable.
* @throws TsqException if there is a problem in checking if the TSQ is recoverable or not
* @return boolean based on if TSQ is recoverable or not
*/
public boolean isRecoverable() throws TsqException;

/**
* Read Data from TSQ based on item number.
* @param item Item number of the TSQ to be read
* @return Data read from TSQ as String
* @throws TsqException if there is a problem in reading from the TSQ
*/
public String readQueue(int item) throws TsqException;

/**
* Read next from TSQ.
* @return Data read from TSQ as String
* @throws TsqException if there is a problem in reading next from the TSQ
*/
public String readQueueNext() throws TsqException;

/**
* Write data to TSQ.
* @param data The data to be written to the TSQ
* @throws TsqException if there is a problem in writing to the TSQ
*/
public void writeQueue(@NotNull String data) throws TsqException;
Anuprakash-Moothedath marked this conversation as resolved.
Show resolved Hide resolved

/**
* Delete non-recoverable TSQ.
* @throws TsqException if there is a problem in deleting the TSQ
*/
public void deleteQueue() throws TsqException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts;

import javax.validation.constraints.NotNull;
public interface ITsqFactory {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer ITSQFactory or TSQFactory. 'I' Prefix is optional, but has been used pretty consistently in Galasa, but I'm personally not wedded to it. Given that the implementation is internal to the bundle and non-reachable, I think that should be TSQFactoryImpl or similar ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @techcobweb , I can find that all the interfaces have name starting with 'I' and the implementation of ITsqFactory.java is named as TsqFactoryImpl.java. I thought this is the naming convention followed in Galasa. Please advise if I need to change this or keep it similar to the existing file names in Galasa?


/**
* Create a new ITsq object with recoverable status
* @param queueName TSQ name
* @param isRecoverable true for recoverable and false for non-recoverable
* @return ITsq object. The existence of the ITsq object does not have any correlation to whether
* the queue actually exists underneath it. It is used to access or create the ITsq.
* @throws TsqException if there is a problem in creating the ITsq object
*/
public ITsq createQueue(@NotNull String queueName, boolean isRecoverable) throws TsqException;

/**
* Create a new ITsq object without recoverable status. Default recoverable status is NonRecoverable
* @param queueName TSQ name
* @return ITsq object. The existence of the ITsq object does not have any correlation to whether
* the queue actually exists underneath it. It is used to access or create the ITsq.
* @throws TsqException if there is a problem in creating the ITsq object
Anuprakash-Moothedath marked this conversation as resolved.
Show resolved Hide resolved
*/
public ITsq createQueue(@NotNull String queueName) throws TsqException;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts;

/*
* TsqException happens for errors in the TSQ manager methods.
*/
public class TsqException extends TsqManagerException {
Anuprakash-Moothedath marked this conversation as resolved.
Show resolved Hide resolved
private static final long serialVersionUID = 1L;

public TsqException() {
}

public TsqException(String message) {
super(message);
}

public TsqException(Throwable cause) {
super(cause);
}

public TsqException(String message, Throwable cause) {
super(message, cause);
}

public TsqException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts;

/*
* TsqManagerException happens for errors in TSQ manager provisioning
*/
public class TsqManagerException extends CicstsManagerException {
private static final long serialVersionUID = 1L;

public TsqManagerException() {
}

public TsqManagerException(String message) {
super(message);
}

public TsqManagerException(Throwable cause) {
super(cause);
}

public TsqManagerException(String message, Throwable cause) {
super(message, cause);
}

public TsqManagerException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import dev.galasa.cicsts.spi.ICeciProvider;
import dev.galasa.cicsts.spi.ICedaProvider;
import dev.galasa.cicsts.spi.ICemtProvider;
import dev.galasa.cicsts.spi.ITsqProvider;
import dev.galasa.cicsts.spi.ICicsRegionLogonProvider;
import dev.galasa.cicsts.spi.ICicsRegionProvisioned;
import dev.galasa.cicsts.spi.ICicsRegionProvisioner;
Expand Down Expand Up @@ -80,6 +81,7 @@ public class CicstsManagerImpl extends AbstractManager implements ICicstsManager
private ICeciProvider ceciProvider;
private ICedaProvider cedaProvider;
private ICemtProvider cemtProvider;
private ITsqProvider tsqProvider;
private ICicsResourceProvider cicsResourceProvider;

@Override
Expand Down Expand Up @@ -361,6 +363,11 @@ public void registerCedaProvider(@NotNull ICedaProvider cedaProvider) {
this.cedaProvider = cedaProvider;
}

@Override
public void registerTsqProvider(@NotNull ITsqProvider tsqProvider) {
this.tsqProvider = tsqProvider;
}

@Override
public void registerCemtProvider(@NotNull ICemtProvider cemtProvider) {
this.cemtProvider = cemtProvider;
Expand Down Expand Up @@ -390,6 +397,16 @@ public ICedaProvider getCedaProvider() throws CicstsManagerException {

return this.cedaProvider;
}

@Override
@NotNull
public ITsqProvider getTsqProvider() throws CicstsManagerException {
if (this.tsqProvider == null) {
throw new CicstsManagerException("No TSQ provider has been registered");
}

return this.tsqProvider;
}

@Override
@NotNull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts.internal.properties;

import java.util.ArrayList;
Expand Down Expand Up @@ -42,6 +42,7 @@ public static List<String> get() throws CicstsManagerException {
list.add("dev.galasa.cicsts.ceci.manager");
list.add("dev.galasa.cicsts.ceda.manager");
list.add("dev.galasa.cicsts.cemt.manager");
list.add("dev.galasa.cicsts.tsq.manager");
list.add("dev.galasa.cicsts.resource.manager");
list.add("dev.galasa.zosliberty.manager");
list.add("dev.galasa.textscan.manager");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts.spi;

import dev.galasa.cicsts.CicstsManagerException;
import dev.galasa.cicsts.ICeci;
import dev.galasa.cicsts.ICeda;
import dev.galasa.cicsts.ICemt;
import dev.galasa.cicsts.ITsqFactory;
import dev.galasa.cicsts.MasType;
import dev.galasa.cicsts.cicsresource.CicsJvmserverResourceException;
import dev.galasa.cicsts.cicsresource.ICicsResource;
Expand All @@ -29,6 +30,7 @@ public abstract class BaseCicsImpl implements ICicsRegionProvisioned {
private ICeci ceci;
private ICeda ceda;
private ICemt cemt;
private ITsqFactory tsq;
private ICicsResource cicsResource;
private IZosUNIXFile runTemporaryUNIXPath;

Expand Down Expand Up @@ -93,6 +95,14 @@ public ICeda ceda() throws CicstsManagerException {
return this.ceda;
}

@Override
public ITsqFactory getTsqFactory() throws CicstsManagerException {
if (this.tsq == null) {
this.tsq = this.cicstsManager.getTsqProvider().getTsqFactory(this, this.cicstsManager);
}
return this.tsq;
}

@Override
public ICemt cemt() throws CicstsManagerException {
if (this.cemt == null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts.spi;

import java.util.List;
Expand Down Expand Up @@ -44,6 +44,13 @@ public interface ICicstsManagerSpi {
* @param cedaProvider - the new provider
*/
void registerCedaProvider(@NotNull ICedaProvider cedaProvider);

/**
* Register the a ITsq instance provider with the CICS TS Manager
*
* @param tsqProvider - the new provider
*/
void registerTsqProvider(@NotNull ITsqProvider tsqProvider);

/**
* Register the a ICicsResource instance provider with the CICS TS Manager
Expand Down Expand Up @@ -73,6 +80,13 @@ public interface ICicstsManagerSpi {
@NotNull
public ICedaProvider getCedaProvider() throws CicstsManagerException;

/**
* @return The registered TSQ provider
* @throws CicstsManagerException
*/
@NotNull
public ITsqProvider getTsqProvider() throws CicstsManagerException;

/**
* @return The registered CICS Resource provider
* @throws CicstsManagerException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright contributors to the Galasa project
*
* SPDX-License-Identifier: EPL-2.0
*/
package dev.galasa.cicsts.spi;

import javax.validation.constraints.NotNull;

import dev.galasa.cicsts.ITsqFactory;
import dev.galasa.cicsts.TsqManagerException;
import dev.galasa.cicsts.ICicsRegion;

/**
* Provides CICS Region related TSQ objects
*
*/
public interface ITsqProvider {

/**
* Returns a unique instance of the ITsqFactory per CICS region
*
* @param cicsRegion
* @param cicstsManager
* @return ITsqFactory object for this CICS region, will have a different instance for different regions
* @throws TsqManagerException if getTsqFactory() fails
*/
@NotNull
ITsqFactory getTsqFactory(ICicsRegion cicsRegion, ICicstsManagerSpi cicstsManager) throws TsqManagerException;

techcobweb marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-snapshot: ${tstamp}
Bundle-Name: Galasa TSQ Manager IVTs
Export-Package: dev.galasa.cicsts.tsq.manager.ivt
Import-Package: !javax.validation.constraints, \
*
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
plugins {
id 'galasa.manager.ivt'
}

description = 'Galasa TSQ Manager IVTs'

version = '0.1.0'

dependencies {
implementation project (':galasa-managers-core-parent:dev.galasa.core.manager')
implementation project (':galasa-managers-cicsts-parent:dev.galasa.cicsts.tsq.manager')
implementation project (':galasa-managers-zos-parent:dev.galasa.zos3270.manager')
}


// Note: These values are consumed by the parent build process
// They indicate which packages of functionality this OSGi bundle should be delivered inside,
// or referenced from.
// The settings here are gathered together by the build process to create a release.yaml file
// which gathers-up all the packaging metadata about all the OSGi bundles in this component.
ext.projectName=project.name
ext.includeInOBR = true
ext.includeInMVP = true
ext.includeInBOM = true
ext.includeInIsolated = true
ext.includeInCodeCoverage = false
ext.includeInJavadoc = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be true for javadoc if these APIs are to appear on the javadoc site.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @techcobweb , Is this required for IVTs?

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'dev.galasa.cicsts.tsq.manager.ivt'

Loading