我已经使用**#PYTHON SCRIPT TO COPY DATA FROM ORACLE TO SQL SERVER**
import cx_Oracle
import pyodbc
#Server Variables
orServer = '10.xxx.x.xxx'
orPort = 'xxxx'
orService = 'MYSERV'
orUser = 'ORMYUSER'
orPassword = 'orpassword'
sqlServer = 'SQLSERVER'
sqlDatabase = 'MYDB'
#SQL Server Connection
sqlConn = pyodbc.connect('Driver={SQL Server};'
'Server='+sqlServer+';'
'Database='+sqlDatabase+';'
'Trusted_Connection=yes;')
sqlCursor = sqlConn.cursor()
#Oracle Connection
dsn_tns = cx_Oracle.makedsn(orServer, orPort, service_name= orService )
orConn = cx_Oracle.connect(user= orUser, password= orPassword, dsn=dsn_tns)
orCursor = orConn.cursor()
#Get data from Oracle Server
orCursor.execute("""SELECT ID
,NAME
,SEX
,ADDRESS
PHONE
FROM DetailsTable"""
)
orColumns =['ID',
'NAME',
'SEX',
'ADDRESS',
'PHONE']
#Creating Strings for insert statement to load data into SQL Server
cValues = str(orColumns).replace("[","(").replace("]",")").replace("'","")
x = len(orColumns)
i = 0
ab = []
while i < x:
i = i+ 1
ab.append("?")
values = str(ab).replace("[","(").replace("]",")").replace("'","")
#Load data to SQL server
sqlCursor.executemany("INSERT INTO [MYDB].[dbo].[DetailsTable]"+ cValues+ " VALUES "+ values ,orCursor)
sqlConn.commit()
sqlConn.close()
orConn.close()
来进行以下操作:
而且Jacoco不涵盖Lombok生成的代码。如果我明确定义一个私有构造函数,Jacoco可以识别它。
那么,有什么方法可以避免由于使用lombok.@UtilityClass
而导致的覆盖范围损失?
答案 0 :(得分:0)
好吧,事实证明可以解决此问题,就像我们忽略任何Lombok生成的代码一样:在项目根目录中添加以下行:lombok.config
文件>
# this is root dir and don't search for parent
config.stopBubbling = true
# add @Generated and Jacoco will detect Lombok generated code and ignore them in reports
lombok.addLombokGeneratedAnnotation = true