blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
5c34582cce9094dfd99f94c94bdd9824ece755d3
9f6faa052fa13743a8658fd696547fb860e74b49
/LatexEditor/src/controller/commands/StableCommand.java
2e0e6227ab38c5446d4a38036e206a2e10010aa3
[]
no_license
NikolaosSintoris/LatexEditor
b3f86255fc9976a9adfd4981491d1ba8267bc6e4
59f0d4ce35a0091768ac9e6fa751737524a9b1ad
refs/heads/master
2020-06-09T17:00:10.535748
2020-03-20T20:22:57
2020-03-20T20:22:57
193,473,166
1
0
null
null
null
null
UTF-8
Java
false
false
530
java
package controller.commands; import controller.LatexEditorController; public class StableCommand implements Command { private LatexEditorController theController; public StableCommand(LatexEditorController newController) { theController = newController; } public void execute(String aString, String bString) { theController.getVersionsManager().enable(); theController.getVersionsManager().getVersionsStrategy().setEntireHistory(theController.getTemporaryHistory()); } }
[ "nikolaossintoris@gmail.com" ]
nikolaossintoris@gmail.com
068b5fb90ca601ce3fb4bb4cfe472843fb51847f
bce710dcaa048457146a133ac062099225016ce7
/src/FinllyTes.java
b379c5a54b3a2345f780f1c6edf3977be9ef6eda
[]
no_license
dmxliu/StringTest
e037b18ee51fb71c8e425af3811ea6a03646ba38
30716ce7f473c6b51e82dbada4e8ec863c5991df
refs/heads/master
2021-01-09T05:23:05.184207
2014-12-25T06:29:34
2014-12-25T06:31:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
462
java
public class FinllyTes { private String t ; public String getT() { return t; } public void setT( String t ) { this.t = t; } public void test(FinllyTes t){ try { t.setT( "test1" ); return ; } catch ( Exception e ) { }finally{ t.setT( "test2" ); } } public static void main( String [] args ) { FinllyTes t = new FinllyTes(); t.test(t); System.out.println(t.getT()); } }
[ "286376568@qq.com" ]
286376568@qq.com
f8733f6557dc518cf48f030ce6d7587a24400b5a
cce8109170ded23a9a17717105555bac9a938b0a
/src/com/company/Dialogs/BlockProfileDialog.java
e77796e3c46d5ed14d0d51069d6ab80711389c43
[]
no_license
gMoBot/record-keeper
c14e9c0c0ee5e7216a0c4e3759e53a86693c4064
47cf8dae62447e76459344015812569274064b8b
refs/heads/master
2016-09-05T11:14:49.102310
2015-07-01T16:54:23
2015-07-01T16:54:23
37,854,077
0
0
null
null
null
null
UTF-8
Java
false
false
3,319
java
package com.company.Dialogs; import com.company.DAO.SQLiteDAO; import com.company.FarmProfileDao; import com.company.FarmRecordsApp; import com.company.Models.BlockProfile; import com.company.Models.FarmProfile; import jdk.nashorn.internal.ir.BlockLexicalContext; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.swing.*; import java.awt.event.*; import java.util.List; import java.util.Vector; @Component public class BlockProfileDialog extends JDialog { private JPanel contentPane; private JButton buttonSubmit; private JButton buttonCancel; private JTextField blockName; private JTextField blockStreetAddress; private JTextField blockZipCode; private JComboBox blockState; private JTextField blockSize; private JTextField blockCrop; private JList<BlockProfile> blockProfileJList; // private JSpinner blockSizeSpinner; private BlockProfile blockProfile; public BlockProfile getBlockProfile() { return blockProfile; } public BlockProfileDialog() { setContentPane(contentPane); setModal(true); getRootPane().setDefaultButton(buttonSubmit); buttonSubmit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onSubmit(); } }); buttonCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }); // call onCancel() when cross is clicked setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { onCancel(); } }); // call onCancel() on ESCAPE contentPane.registerKeyboardAction(new ActionListener() { public void actionPerformed(ActionEvent e) { onCancel(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); } private void onSubmit() { // blockProfile.setFarmId(); blockProfile = new BlockProfile(); blockProfile.setBlockName(String.valueOf(blockName.getText())); blockProfile.setBlockStreetAddress(String.valueOf(blockStreetAddress.getText())); blockProfile.setBlockStateCode(String.valueOf(blockState.getSelectedItem())); blockProfile.setBlockZipcode(String.valueOf(blockZipCode.getText())); blockProfile.setBlockSize(Float.parseFloat(blockSize.getText())); blockProfile.setBlockCrop(String.valueOf(blockCrop.getText())); setVisible(false); } private void onCancel() { // add your code here if necessary dispose(); } public static void main(String[] args) { BlockProfileDialog dialog = new BlockProfileDialog(); dialog.pack(); dialog.setVisible(true); System.exit(0); } // private void createUIComponents() { // // TODO: place custom component creation code here // SpinnerModel jModel = new SpinnerNumberModel(0, 0, 1000, .5); // blockSizeSpinner.setModel(jModel); // JSpinner jspinner = new JSpinner(); // // } // } }
[ "gMoBot@users.noreply.github.com" ]
gMoBot@users.noreply.github.com
735b2d2629f1b1ba084687818ea9285063410486
812be6b9d1ba4036652df166fbf8662323f0bdc9
/java/Dddml.Wms.JavaCommon/src/generated/java/org/dddml/wms/domain/order/CreateOrMergePatchOrderShipGroupDto.java
409e5eb8d4d624910a6cb8afbbd84e42ecc0a9b2
[]
no_license
lanmolsz/wms
8503e54a065670b48a15955b15cea4926f05b5d6
4b71afd80127a43890102167a3af979268e24fa2
refs/heads/master
2020-03-12T15:10:26.133106
2018-09-27T08:28:05
2018-09-27T08:28:05
130,684,482
0
0
null
2018-04-23T11:11:24
2018-04-23T11:11:24
null
UTF-8
Java
false
false
17,480
java
package org.dddml.wms.domain.order; import java.util.Date; import org.dddml.wms.domain.*; public class CreateOrMergePatchOrderShipGroupDto extends AbstractOrderShipGroupCommandDto { private String shipmentMethodTypeId; public String getShipmentMethodTypeId() { return this.shipmentMethodTypeId; } public void setShipmentMethodTypeId(String shipmentMethodTypeId) { this.shipmentMethodTypeId = shipmentMethodTypeId; } private String supplierPartyId; public String getSupplierPartyId() { return this.supplierPartyId; } public void setSupplierPartyId(String supplierPartyId) { this.supplierPartyId = supplierPartyId; } private String vendorPartyId; public String getVendorPartyId() { return this.vendorPartyId; } public void setVendorPartyId(String vendorPartyId) { this.vendorPartyId = vendorPartyId; } private String carrierPartyId; public String getCarrierPartyId() { return this.carrierPartyId; } public void setCarrierPartyId(String carrierPartyId) { this.carrierPartyId = carrierPartyId; } private String carrierRoleTypeId; public String getCarrierRoleTypeId() { return this.carrierRoleTypeId; } public void setCarrierRoleTypeId(String carrierRoleTypeId) { this.carrierRoleTypeId = carrierRoleTypeId; } private String facilityId; public String getFacilityId() { return this.facilityId; } public void setFacilityId(String facilityId) { this.facilityId = facilityId; } private String contactMechId; public String getContactMechId() { return this.contactMechId; } public void setContactMechId(String contactMechId) { this.contactMechId = contactMechId; } private String telecomContactMechId; public String getTelecomContactMechId() { return this.telecomContactMechId; } public void setTelecomContactMechId(String telecomContactMechId) { this.telecomContactMechId = telecomContactMechId; } private String trackingNumber; public String getTrackingNumber() { return this.trackingNumber; } public void setTrackingNumber(String trackingNumber) { this.trackingNumber = trackingNumber; } private String shippingInstructions; public String getShippingInstructions() { return this.shippingInstructions; } public void setShippingInstructions(String shippingInstructions) { this.shippingInstructions = shippingInstructions; } private String maySplit; public String getMaySplit() { return this.maySplit; } public void setMaySplit(String maySplit) { this.maySplit = maySplit; } private String giftMessage; public String getGiftMessage() { return this.giftMessage; } public void setGiftMessage(String giftMessage) { this.giftMessage = giftMessage; } private String isGift; public String getIsGift() { return this.isGift; } public void setIsGift(String isGift) { this.isGift = isGift; } private java.sql.Timestamp shipAfterDate; public java.sql.Timestamp getShipAfterDate() { return this.shipAfterDate; } public void setShipAfterDate(java.sql.Timestamp shipAfterDate) { this.shipAfterDate = shipAfterDate; } private java.sql.Timestamp shipByDate; public java.sql.Timestamp getShipByDate() { return this.shipByDate; } public void setShipByDate(java.sql.Timestamp shipByDate) { this.shipByDate = shipByDate; } private java.sql.Timestamp estimatedShipDate; public java.sql.Timestamp getEstimatedShipDate() { return this.estimatedShipDate; } public void setEstimatedShipDate(java.sql.Timestamp estimatedShipDate) { this.estimatedShipDate = estimatedShipDate; } private java.sql.Timestamp estimatedDeliveryDate; public java.sql.Timestamp getEstimatedDeliveryDate() { return this.estimatedDeliveryDate; } public void setEstimatedDeliveryDate(java.sql.Timestamp estimatedDeliveryDate) { this.estimatedDeliveryDate = estimatedDeliveryDate; } private Long pickwaveId; public Long getPickwaveId() { return this.pickwaveId; } public void setPickwaveId(Long pickwaveId) { this.pickwaveId = pickwaveId; } private Boolean active; public Boolean getActive() { return this.active; } public void setActive(Boolean active) { this.active = active; } private CreateOrMergePatchOrderItemShipGroupAssociationDto[] orderItemShipGroupAssociations; public CreateOrMergePatchOrderItemShipGroupAssociationDto[] getOrderItemShipGroupAssociations() { return this.orderItemShipGroupAssociations; } public void setOrderItemShipGroupAssociations(CreateOrMergePatchOrderItemShipGroupAssociationDto[] orderItemShipGroupAssociations) { this.orderItemShipGroupAssociations = orderItemShipGroupAssociations; } private Boolean isPropertyShipmentMethodTypeIdRemoved; public Boolean getIsPropertyShipmentMethodTypeIdRemoved() { return this.isPropertyShipmentMethodTypeIdRemoved; } public void setIsPropertyShipmentMethodTypeIdRemoved(Boolean removed) { this.isPropertyShipmentMethodTypeIdRemoved = removed; } private Boolean isPropertySupplierPartyIdRemoved; public Boolean getIsPropertySupplierPartyIdRemoved() { return this.isPropertySupplierPartyIdRemoved; } public void setIsPropertySupplierPartyIdRemoved(Boolean removed) { this.isPropertySupplierPartyIdRemoved = removed; } private Boolean isPropertyVendorPartyIdRemoved; public Boolean getIsPropertyVendorPartyIdRemoved() { return this.isPropertyVendorPartyIdRemoved; } public void setIsPropertyVendorPartyIdRemoved(Boolean removed) { this.isPropertyVendorPartyIdRemoved = removed; } private Boolean isPropertyCarrierPartyIdRemoved; public Boolean getIsPropertyCarrierPartyIdRemoved() { return this.isPropertyCarrierPartyIdRemoved; } public void setIsPropertyCarrierPartyIdRemoved(Boolean removed) { this.isPropertyCarrierPartyIdRemoved = removed; } private Boolean isPropertyCarrierRoleTypeIdRemoved; public Boolean getIsPropertyCarrierRoleTypeIdRemoved() { return this.isPropertyCarrierRoleTypeIdRemoved; } public void setIsPropertyCarrierRoleTypeIdRemoved(Boolean removed) { this.isPropertyCarrierRoleTypeIdRemoved = removed; } private Boolean isPropertyFacilityIdRemoved; public Boolean getIsPropertyFacilityIdRemoved() { return this.isPropertyFacilityIdRemoved; } public void setIsPropertyFacilityIdRemoved(Boolean removed) { this.isPropertyFacilityIdRemoved = removed; } private Boolean isPropertyContactMechIdRemoved; public Boolean getIsPropertyContactMechIdRemoved() { return this.isPropertyContactMechIdRemoved; } public void setIsPropertyContactMechIdRemoved(Boolean removed) { this.isPropertyContactMechIdRemoved = removed; } private Boolean isPropertyTelecomContactMechIdRemoved; public Boolean getIsPropertyTelecomContactMechIdRemoved() { return this.isPropertyTelecomContactMechIdRemoved; } public void setIsPropertyTelecomContactMechIdRemoved(Boolean removed) { this.isPropertyTelecomContactMechIdRemoved = removed; } private Boolean isPropertyTrackingNumberRemoved; public Boolean getIsPropertyTrackingNumberRemoved() { return this.isPropertyTrackingNumberRemoved; } public void setIsPropertyTrackingNumberRemoved(Boolean removed) { this.isPropertyTrackingNumberRemoved = removed; } private Boolean isPropertyShippingInstructionsRemoved; public Boolean getIsPropertyShippingInstructionsRemoved() { return this.isPropertyShippingInstructionsRemoved; } public void setIsPropertyShippingInstructionsRemoved(Boolean removed) { this.isPropertyShippingInstructionsRemoved = removed; } private Boolean isPropertyMaySplitRemoved; public Boolean getIsPropertyMaySplitRemoved() { return this.isPropertyMaySplitRemoved; } public void setIsPropertyMaySplitRemoved(Boolean removed) { this.isPropertyMaySplitRemoved = removed; } private Boolean isPropertyGiftMessageRemoved; public Boolean getIsPropertyGiftMessageRemoved() { return this.isPropertyGiftMessageRemoved; } public void setIsPropertyGiftMessageRemoved(Boolean removed) { this.isPropertyGiftMessageRemoved = removed; } private Boolean isPropertyIsGiftRemoved; public Boolean getIsPropertyIsGiftRemoved() { return this.isPropertyIsGiftRemoved; } public void setIsPropertyIsGiftRemoved(Boolean removed) { this.isPropertyIsGiftRemoved = removed; } private Boolean isPropertyShipAfterDateRemoved; public Boolean getIsPropertyShipAfterDateRemoved() { return this.isPropertyShipAfterDateRemoved; } public void setIsPropertyShipAfterDateRemoved(Boolean removed) { this.isPropertyShipAfterDateRemoved = removed; } private Boolean isPropertyShipByDateRemoved; public Boolean getIsPropertyShipByDateRemoved() { return this.isPropertyShipByDateRemoved; } public void setIsPropertyShipByDateRemoved(Boolean removed) { this.isPropertyShipByDateRemoved = removed; } private Boolean isPropertyEstimatedShipDateRemoved; public Boolean getIsPropertyEstimatedShipDateRemoved() { return this.isPropertyEstimatedShipDateRemoved; } public void setIsPropertyEstimatedShipDateRemoved(Boolean removed) { this.isPropertyEstimatedShipDateRemoved = removed; } private Boolean isPropertyEstimatedDeliveryDateRemoved; public Boolean getIsPropertyEstimatedDeliveryDateRemoved() { return this.isPropertyEstimatedDeliveryDateRemoved; } public void setIsPropertyEstimatedDeliveryDateRemoved(Boolean removed) { this.isPropertyEstimatedDeliveryDateRemoved = removed; } private Boolean isPropertyPickwaveIdRemoved; public Boolean getIsPropertyPickwaveIdRemoved() { return this.isPropertyPickwaveIdRemoved; } public void setIsPropertyPickwaveIdRemoved(Boolean removed) { this.isPropertyPickwaveIdRemoved = removed; } private Boolean isPropertyActiveRemoved; public Boolean getIsPropertyActiveRemoved() { return this.isPropertyActiveRemoved; } public void setIsPropertyActiveRemoved(Boolean removed) { this.isPropertyActiveRemoved = removed; } public void copyTo(AbstractOrderShipGroupCommand.AbstractCreateOrMergePatchOrderShipGroup command) { ((AbstractOrderShipGroupCommandDto) this).copyTo(command); command.setShipmentMethodTypeId(this.getShipmentMethodTypeId()); command.setSupplierPartyId(this.getSupplierPartyId()); command.setVendorPartyId(this.getVendorPartyId()); command.setCarrierPartyId(this.getCarrierPartyId()); command.setCarrierRoleTypeId(this.getCarrierRoleTypeId()); command.setFacilityId(this.getFacilityId()); command.setContactMechId(this.getContactMechId()); command.setTelecomContactMechId(this.getTelecomContactMechId()); command.setTrackingNumber(this.getTrackingNumber()); command.setShippingInstructions(this.getShippingInstructions()); command.setMaySplit(this.getMaySplit()); command.setGiftMessage(this.getGiftMessage()); command.setIsGift(this.getIsGift()); command.setShipAfterDate(this.getShipAfterDate()); command.setShipByDate(this.getShipByDate()); command.setEstimatedShipDate(this.getEstimatedShipDate()); command.setEstimatedDeliveryDate(this.getEstimatedDeliveryDate()); command.setPickwaveId(this.getPickwaveId()); command.setActive(this.getActive()); } public OrderShipGroupCommand toCommand() { if (getCommandType() == null) { setCommandType(COMMAND_TYPE_MERGE_PATCH); } if (COMMAND_TYPE_CREATE.equals(getCommandType())) { AbstractOrderShipGroupCommand.SimpleCreateOrderShipGroup command = new AbstractOrderShipGroupCommand.SimpleCreateOrderShipGroup(); copyTo((AbstractOrderShipGroupCommand.AbstractCreateOrderShipGroup) command); if (this.getOrderItemShipGroupAssociations() != null) { for (CreateOrMergePatchOrderItemShipGroupAssociationDto cmd : this.getOrderItemShipGroupAssociations()) { command.getOrderItemShipGroupAssociations().add((OrderItemShipGroupAssociationCommand.CreateOrderItemShipGroupAssociation) cmd.toCommand()); } } return command; } else if (COMMAND_TYPE_MERGE_PATCH.equals(getCommandType())) { AbstractOrderShipGroupCommand.SimpleMergePatchOrderShipGroup command = new AbstractOrderShipGroupCommand.SimpleMergePatchOrderShipGroup(); copyTo((AbstractOrderShipGroupCommand.SimpleMergePatchOrderShipGroup) command); if (this.getOrderItemShipGroupAssociations() != null) { for (CreateOrMergePatchOrderItemShipGroupAssociationDto cmd : this.getOrderItemShipGroupAssociations()) { command.getOrderItemShipGroupAssociationCommands().add(cmd.toCommand()); } } return command; } else if (COMMAND_TYPE_REMOVE.equals(getCommandType())) { AbstractOrderShipGroupCommand.SimpleRemoveOrderShipGroup command = new AbstractOrderShipGroupCommand.SimpleRemoveOrderShipGroup(); ((AbstractOrderShipGroupCommandDto) this).copyTo(command); return command; } throw new IllegalStateException("Unknown command type:" + getCommandType()); } public void copyTo(AbstractOrderShipGroupCommand.AbstractCreateOrderShipGroup command) { copyTo((AbstractOrderShipGroupCommand.AbstractCreateOrMergePatchOrderShipGroup) command); } public void copyTo(AbstractOrderShipGroupCommand.AbstractMergePatchOrderShipGroup command) { copyTo((AbstractOrderShipGroupCommand.AbstractCreateOrMergePatchOrderShipGroup) command); command.setIsPropertyShipmentMethodTypeIdRemoved(this.getIsPropertyShipmentMethodTypeIdRemoved()); command.setIsPropertySupplierPartyIdRemoved(this.getIsPropertySupplierPartyIdRemoved()); command.setIsPropertyVendorPartyIdRemoved(this.getIsPropertyVendorPartyIdRemoved()); command.setIsPropertyCarrierPartyIdRemoved(this.getIsPropertyCarrierPartyIdRemoved()); command.setIsPropertyCarrierRoleTypeIdRemoved(this.getIsPropertyCarrierRoleTypeIdRemoved()); command.setIsPropertyFacilityIdRemoved(this.getIsPropertyFacilityIdRemoved()); command.setIsPropertyContactMechIdRemoved(this.getIsPropertyContactMechIdRemoved()); command.setIsPropertyTelecomContactMechIdRemoved(this.getIsPropertyTelecomContactMechIdRemoved()); command.setIsPropertyTrackingNumberRemoved(this.getIsPropertyTrackingNumberRemoved()); command.setIsPropertyShippingInstructionsRemoved(this.getIsPropertyShippingInstructionsRemoved()); command.setIsPropertyMaySplitRemoved(this.getIsPropertyMaySplitRemoved()); command.setIsPropertyGiftMessageRemoved(this.getIsPropertyGiftMessageRemoved()); command.setIsPropertyIsGiftRemoved(this.getIsPropertyIsGiftRemoved()); command.setIsPropertyShipAfterDateRemoved(this.getIsPropertyShipAfterDateRemoved()); command.setIsPropertyShipByDateRemoved(this.getIsPropertyShipByDateRemoved()); command.setIsPropertyEstimatedShipDateRemoved(this.getIsPropertyEstimatedShipDateRemoved()); command.setIsPropertyEstimatedDeliveryDateRemoved(this.getIsPropertyEstimatedDeliveryDateRemoved()); command.setIsPropertyPickwaveIdRemoved(this.getIsPropertyPickwaveIdRemoved()); command.setIsPropertyActiveRemoved(this.getIsPropertyActiveRemoved()); } public static class CreateOrderShipGroupDto extends CreateOrMergePatchOrderShipGroupDto { @Override public String getCommandType() { return COMMAND_TYPE_CREATE; } public OrderShipGroupCommand.CreateOrderShipGroup toCreateOrderShipGroup() { return (OrderShipGroupCommand.CreateOrderShipGroup) toCommand(); } } public static class MergePatchOrderShipGroupDto extends CreateOrMergePatchOrderShipGroupDto { @Override public String getCommandType() { return COMMAND_TYPE_MERGE_PATCH; } public OrderShipGroupCommand.MergePatchOrderShipGroup toMergePatchOrderShipGroup() { return (OrderShipGroupCommand.MergePatchOrderShipGroup) toCommand(); } } }
[ "yangjiefeng@gmail.com" ]
yangjiefeng@gmail.com
1b1e24890afccad5825ebeca89dafc69b6d42e99
6ea6663c55345da830d153ce143ab6d42dc6048e
/src/com/vmatrix/activity/BasicActivity.java
cc68ebd114b6ef7dc04fa5615c6ebb849e153530
[]
no_license
HermanYang/VMatrix
8efb235748d7985beed2d615d045adf500475805
6621e5339e03bcef8fffab0d1f9f10ca6b6d1a3e
refs/heads/master
2021-01-13T01:57:45.179452
2015-04-02T07:44:36
2015-04-02T07:44:36
33,296,114
0
0
null
null
null
null
UTF-8
Java
false
false
1,741
java
package com.vmatrix.activity; import android.app.Activity; import android.content.res.Configuration; import android.os.Bundle; import com.vmatrix.constant.Command; import com.vmatrix.controller.Controller; public class BasicActivity extends Activity { protected Controller mController = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mController = Controller.getInstance(); mController.registerActivity(this); mController.markCurrentActivity(this); } @Override protected void onStart() { super.onStart(); mController.markCurrentActivity(this); mController.proceed(Command.INITIALIZATION); } @Override protected void onDestroy() { super.onDestroy(); mController.unRegisterActivity(this); mController.proceed(Command.DESTORY); } @Override public void onBackPressed() { mController.proceed(Command.BACK); } @Override protected void onRestart() { super.onRestart(); mController.proceed(Command.RESTART); } @Override protected void onPause() { super.onPause(); mController.proceed(Command.PAUSE); } @Override protected void onStop() { super.onStop(); mController.proceed(Command.STOP); } @Override protected void onResume() { super.onResume(); mController.markCurrentActivity(this); mController.proceed(Command.RESUME); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) { mController.proceed(Command.LAYOUT_PORTRAIT); } if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { mController.proceed(Command.LAYOUT_LANDSCAPE); } } }
[ "yxyherman@qq.com" ]
yxyherman@qq.com
3e67054438e968f6bbba40941932268728865d10
630d7a2f8b5b964e5a312df459c1b5f423718af2
/projects/stage-0/user-platform/user-web/src/main/java/org/geektimes/microprofile/config/DefaultConfigProviderResolver.java
7dec9cc4a0ff794877b8232bcaa50877a07f9d87
[ "Apache-2.0" ]
permissive
liugd2018/geekbang-lessons
0c439d107fe5a79fcd738931ec69fff42ce11e0a
b73816807cd78b840e6bf4301b979cb64a20c017
refs/heads/master
2023-03-17T06:01:55.374444
2021-03-17T13:40:38
2021-03-17T13:40:38
344,129,637
0
0
null
null
null
null
UTF-8
Java
false
false
1,278
java
package org.geektimes.microprofile.config; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.spi.ConfigBuilder; import org.eclipse.microprofile.config.spi.ConfigProviderResolver; import java.util.Iterator; import java.util.ServiceLoader; public class DefaultConfigProviderResolver extends ConfigProviderResolver { @Override public Config getConfig() { return getConfig(null); } @Override public Config getConfig(ClassLoader loader) { ClassLoader classLoader = loader; if (classLoader == null) { classLoader = Thread.currentThread().getContextClassLoader(); } ServiceLoader<Config> serviceLoader = ServiceLoader.load(Config.class, classLoader); Iterator<Config> iterator = serviceLoader.iterator(); if (iterator.hasNext()) { // 获取 Config SPI 第一个实现 return iterator.next(); } throw new IllegalStateException("No Config implementation found!"); } @Override public ConfigBuilder getBuilder() { return null; } @Override public void registerConfig(Config config, ClassLoader classLoader) { } @Override public void releaseConfig(Config config) { } }
[ "liugd2020@gmail.com" ]
liugd2020@gmail.com
6bccd7d292008fe6192010ac598cd7a7fda32e33
04a8b70dda6aeecc5d7699da4bd51b6c7043fe94
/src/main/java/com/ccbincidentes/service/IncidentesService.java
511d131244c4050e6830a96f18cd447c9a5d5359
[]
no_license
aannddrree/projIncidentes
00f20ccf5fb9d04fbd8b870d5e8548a46ab2b05d
86030fda3eb4624f85d5c8b51634785266a17fb4
refs/heads/master
2020-03-29T11:40:23.747465
2018-09-22T09:56:59
2018-09-22T09:56:59
149,864,794
0
0
null
null
null
null
UTF-8
Java
false
false
662
java
package com.ccbincidentes.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ccbincidentes.model.Incidentes; import com.ccbincidentes.repository.IncidentesRepository; @Service public class IncidentesService { @Autowired private IncidentesRepository repository; public List<Incidentes> findAll() { return repository.findAll(); } public Incidentes findOne(int id) { return repository.findOne(id); } public Incidentes save(Incidentes post) { return repository.saveAndFlush(post); } public void delete(int id) { repository.delete(id); } }
[ "aannddrree.silva@gmail.com" ]
aannddrree.silva@gmail.com
fd533d2e5c8d90245c07d5f888b3c7064be0af57
7840970f074c6cf1dda71a3a176ba713503a0e0f
/assignments/m4/Assignment-4/Solution.java
d9e19688aae76a3ffaf40b2bad13582d8f04a42e
[]
no_license
MudugantiShivani/6006_CSPP2
b3326adc19070eb7515eb835081e620d4bf399c3
c7923a9110a9c6e8c42fc53f9f7df3ad4fd036f4
refs/heads/master
2020-03-27T08:25:28.133207
2018-09-23T13:20:00
2018-09-23T13:20:00
146,252,794
0
0
null
null
null
null
UTF-8
Java
false
false
1,101
java
import java.util.Scanner; /** * Class for solution. */ public final class Solution { /** * Constructs the object. */ private Solution() { /** * {private class also called constructor}. */ } /** * {main function which prints the reverse of a string}. * * @param args string data type */ public static void main(final String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine(); String reverse = reverseString(s); System.out.println(reverse); } /** * {This is the function where we write code for reverse of string}. * * @param reverse data type is int and reverse of the string is stored * * @return { returns the reversed string } */ static String reverseString(final String reverse) { String result = ""; char[] array1 = reverse.toCharArray(); int len = reverse.length(); for (int i = len - 1; i >= 0; i--) { result += array1[i]; } return result; } }
[ "shivani.muduganti72@msitprogram.net" ]
shivani.muduganti72@msitprogram.net
04bc41d74c0a6bdb779d255a90e4d029fccf82c9
22b7614cf3f152cca0c25651ee914f21dd54699e
/Exercism/reverse-string/ReverseStringTest.java
df5d70f21ec42136137ad792dedc28b314a10d32
[]
no_license
audemed44/Code-Snippets
b5b0a31c726b5a64765412c2bf4520bfaa827b71
b85613e612bb94bc264871ed2b921027e4f3e946
refs/heads/master
2020-06-29T01:55:11.203020
2019-09-25T05:41:46
2019-09-25T05:41:46
200,403,463
0
0
null
null
null
null
UTF-8
Java
false
false
901
java
import org.junit.Ignore; import org.junit.Test; import static org.junit.Assert.assertEquals; public class ReverseStringTest { @Test public void testAnEmptyString() { assertEquals("", new ReverseString().reverse("")); } @Test public void testAWord() { assertEquals("tobor", new ReverseString().reverse("robot")); } @Test public void testACapitalizedWord() { assertEquals("nemaR", new ReverseString().reverse("Ramen")); } @Test public void testASentenceWithPunctuation() { assertEquals("!yrgnuh m'I", new ReverseString().reverse("I'm hungry!")); } @Test public void testAPalindrome() { assertEquals("racecar", new ReverseString().reverse("racecar")); } @Test public void testAnEvenSizedWord() { assertEquals("reward", new ReverseString().reverse("drawer")); } }
[ "aakash1496@gmail.com" ]
aakash1496@gmail.com
dd7c60e872653acbdcd8cef83228059ad2a7400d
633fb7d6b357d3f0a1513070b4c35c1a13ed37b1
/src/test/java/com/zgy/layui/LayuiApplicationTests.java
c473e6a5880667041f37839dd104cbca4afce378
[]
no_license
hupu1dong/layui
e379147eb506af735c7decabda1c5dabd482df34
a387145281e717063652c3ff72d03170879a6d92
refs/heads/master
2023-08-26T17:56:29.841655
2021-10-06T12:10:30
2021-10-06T12:10:30
414,196,970
0
1
null
null
null
null
UTF-8
Java
false
false
213
java
package com.zgy.layui; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class LayuiApplicationTests { @Test void contextLoads() { } }
[ "515783116@qq.com" ]
515783116@qq.com
3ef68e615f1ad3cacd9a886b8a0c142948d4a1e0
f5c7bc475c7fe62c35347f8d9706b5737858d7eb
/PP_MA02_8130144_8130368/src/Game/Management/ListManagement.java
67ffe1ac805db4e1445224fa5cc34c7dc7dd506f
[]
no_license
martiiill/ParadigmasDaProgramacao
123a8c8a6f1423f967a4779474876fb8d547900b
ffc0414111c67af745aad7c149996dcde7aedc43
refs/heads/master
2021-01-18T19:32:47.675705
2017-08-21T09:00:30
2017-08-21T09:00:30
86,901,537
0
0
null
null
null
null
UTF-8
Java
false
false
8,134
java
/** * Nome: Joana Machado Baptista * Número: 8130144 * Turma: 3 * * Nome: Ana Alice Gonçalves Martins * Número: 8130368 * Turma: 3 */ package Game.Management; import Game.Comparator.Comparator; import Game.Store; import Resources.Collection.ListManagementContract; import Resources.Exceptions.FileHandlingException; import java.io.Serializable; import java.util.Arrays; /** * Classe que representa um gestor de objetos. */ public class ListManagement implements Comparator, ListManagementContract, Serializable { /** * {@link ListManagement#numberOfObjects * Numero de bjectos} do {@link ListManagement gestor} de objetos. */ private int numberOfObjects; /** * {@link ListManagement#objects Objetos} do {@link ListManagement gestor}. */ private Object[] objects; /** * Método que permite instanciar uma lista. * @param numberOfObjects {@link ListManagement#numberOfObjects * numero de objectos} do {@link ListManagement gestor}. * @param objects {@link ListManagement#objects Objetos} do * {@link ListManagement gestor}. */ public ListManagement(int numberOfObjects, Object[] objects) { this.numberOfObjects = numberOfObjects; this.objects = objects; } /** * Método que permite instanciar um {@link ListManagement gestor} * tendo em conta um tamanho. * @param size Tamanho que pretende dar. */ public ListManagement(int size) { this.objects = new Object[size]; } /** * Método construtor que permite instanciar um {@link ListManagement gestor} * tendo por base um conjunto de objetos. * @param objects{@link ListManagement#objects Objetos} do * {@link ListManagement gestor}. */ public ListManagement(Object[] objects) { this.objects = objects; } /** * Método construtor que permite instanciar um {@link ListManagement gestor} * tendo por base o seu tamanho por defeito. */ public ListManagement() { this.objects = new Object[DEFAULT_SIZE]; } /** * Método que permite gravar num ficheiro um * {@link ListManagement gestor de objetos}. * @param s O {@link ListManagement gestor de objetos} a gravar. * @param st Ficheiro onde quer guardar. * @throws FileHandlingException Excecao lançada caso ocorra algum erro. */ public void save(ListManagement s, String st) throws FileHandlingException{ Store ss = new Store(); ss.saveToFile(s, st); } /** * Método responsável por retornar a * {@link ListManagement#numberOfObjects número de objetos} * no {@link ListManagement gestor de objetos}. * imagem da animação} * @return {@link ListManagement#numberOfObjects Número de objetos}. */ public int getNumberOfObjects() { return numberOfObjects; } /** * Método responsável por definir o * {@link ListManagement#numberOfObjects número de objetos} no * {@link ListManagement gestor de objetos}. * @param numberOfObjects {@link ListManagement#numberOfObjects * Número de objetos}. */ public void setNumberOfObjects(int numberOfObjects) { this.numberOfObjects = numberOfObjects; } /** * Método responsável por retornar os * {@link ListManagement#objects objetos} * no {@link ListManagement gestor de objetos}. * imagem da animação} * @return {@link ListManagement#objects Objetos}. */ public Object[] getObjects() { return objects; } /** * Método responsável por definir o * {@link ListManagement#objects objetos} no * {@link ListManagement gestor de objetos}. * @param objects {@link ListManagement#objects Objetos}. */ public void setObjects(Object[] objects) { this.objects = objects; } /** * Método responsável por encontrar um {@link ListManagement#objects objeto} * no {@link ListManagement gestor de objetos}. * * @param o objeto a procurar no {@link ListManagement gestor de objetos}. * @return o indice do objeto no vetor. No caso do elemento não existir, * deverá ser retornado o valor -1 */ @Override public int findObject(Object o) { for (int i = 0; i < this.numberOfObjects; i++) { if (this.numberOfObjects != 0 && this.objects[i].equals(o)) { return i; } } return -1; } /** * Método responsável por inserir um {@link ListManagement#objects objeto} * do {@link ListManagement gestor de objetos}. * * @param o objeto a inserir no {@link ListManagement gestor de objetos}. * @return Valor que sinaliza o sucesso/insucesso da operação */ @Override public boolean addObject(Object o) { if (numberOfObjects < this.objects.length) { this.objects[numberOfObjects] = o; numberOfObjects++; return true; } return false; } /** * Método responsável por remover um {@link ListManagement#objects objeto} * do {@link ListManagement gestor de objetos}. * * @param i indice correspondente ao elemento a eliminar * @return o objeto eliminado */ @Override public Object removeObject(int i) { int k = 0; Object objRemoved = null; Object[] tempList = new Object[numberOfObjects - 1]; for (int z = 0; z < numberOfObjects; ++z) { if (z != i) { tempList[k] = objects[z]; k++; } else { objRemoved = this.objects[z]; } } this.numberOfObjects--; this.objects = tempList; return objRemoved; } /** * Método responsável por retornar um {@link ListManagement#objects objeto} * existente numa determinada posição do {@link ListManagement * gestor de objetos}. * * @param i indice do elemento a devolver * @return objeto do tipo Object */ @Override public Object getObject(int i) { return objects[i]; } /** * Método que permite obter uma representação textual de um * {@link ListManagement gestor de objetos}. * @return Representação textual de um {@link ListManagement * gestor de objetos}. */ @Override public String toString() { return "ListManagement{" + "numberOfObjects=" + numberOfObjects + ", objects=" + Arrays.toString(objects) + '}'; } /** * Método que permite comaparar dois {@link ListManagement#objects objetos}, * dizendo se são iguais ou diferentes. * * @param o {@link ListManagement#objects Objeto} a comparar. * @return 0 se os objectos são iguais. 1 se sao diferentes, */ @Override public int comparator(Object o) { if (o instanceof ListManagement) { for (int i = 0; i < numberOfObjects; i++) { if (this.objects[i].equals(o) == true) { return 0; } else { return 1; } } } return -1; } /** * Método que suporta a ordenação por ordem alfabética da coleção. */ @Override public void sort() { ListManagement aux; for (int i = 0; i < this.objects.length; i++) { if (comparator(objects[i + 1]) > 0) { aux = (ListManagement) objects[i]; objects[i] = objects[i + 1]; objects[i + 1] = aux; } } } /** * Método que permite saber se existe ou não um * {@link ListManagement#objects objeto}. * @param o {@link ListManagement#objects Objeto}. * @return valor que sinaliza o sucesso ou insucesso da operação. */ public boolean hasObject(Object o) { for (int i = 0; i < this.numberOfObjects; i++) { return this.objects[i].equals(o); } return false; } }
[ "anaalicemartins@gmail.com" ]
anaalicemartins@gmail.com
3b1d7194cf0a92b3f639e0cf4695589a652927f7
701b2c08dc81847ff3be25256e84d84e4557a92e
/app/src/main/java/loveq/rc/gsondemo/ui/configuration/ExposeActivity.java
e260feedd2df7eff454d666faeb20722edc6ae26
[]
no_license
LoveqLRC/GsonDemo
3429bb11cd720469f3d579dcf42864776a28a4f2
af55e48a4e11a270acdf6270a146897a0b224d5b
refs/heads/master
2021-06-23T01:18:16.515139
2017-08-16T03:11:28
2017-08-16T03:11:28
100,338,191
0
0
null
null
null
null
UTF-8
Java
false
false
1,892
java
package loveq.rc.gsondemo.ui.configuration; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.TextView; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import loveq.rc.gsondemo.R; import loveq.rc.gsondemo.bean.Fruit; public class ExposeActivity extends AppCompatActivity { Button btn; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_example); btn = (Button) findViewById(R.id.btn); textView = (TextView) findViewById(R.id.textView); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { doSomeWork(); } }); } private void doSomeWork() { // {"color":"red","name":"apple","price":"16"} Fruit fruit = new Fruit("apple", "red", "16"); //注意这里的gson创建方式 Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); //因为fruit默认@Expose 的serialize 和deserialize为true //平时如果不写,没什么影响,如果使用了上面的方式创建gson对象,那么必须给每个成员变量标注@Expose String json = gson.toJson(fruit); //因为name设置了 serialize = false 所以name没有序列化出来 textView.setText(json); String newjson = "{\"color\":\"red\", \"name\":\"apple\", \"price\":\"16\"}"; Fruit newFruit = gson.fromJson(newjson, Fruit.class); textView.append("\n"); //因为price 设置了deserialize = false,所以price没有反序列化出来,所以是默认值(null) textView.append(newFruit.toString()); } }
[ "664215432@qq.com" ]
664215432@qq.com
036faaaff98779750695acbf404fcb3f1d6c2aba
47c9b41889e42f24d7c393a6f6c4f24295228cd1
/src/main/java/com/zx/sms/codec/cmpp20/Cmpp20DeliverResponseMessageCodec.java
e8d31c7ffa9c15704699ff5f06bea297326563dd
[]
no_license
hywang-org/cmpp-benchmark
6a545b10f853e2701e9a904060f6c2c034c81d01
13d25fd126786199d4d27cef733f863b55451b13
refs/heads/master
2021-09-25T11:36:25.518091
2019-10-18T13:31:46
2019-10-18T13:31:49
213,648,039
0
0
null
2021-09-24T16:23:38
2019-10-08T13:23:34
Java
UTF-8
Java
false
false
2,444
java
/** * */ package com.zx.sms.codec.cmpp20; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.MessageToMessageCodec; import io.netty.util.ReferenceCountUtil; import java.util.List; import com.zx.sms.codec.cmpp.msg.CmppDeliverResponseMessage; import com.zx.sms.codec.cmpp.msg.Message; import com.zx.sms.codec.cmpp.packet.CmppDeliverResponse; import com.zx.sms.codec.cmpp.packet.PacketType; import com.zx.sms.codec.cmpp20.packet.Cmpp20DeliverResponse; import com.zx.sms.codec.cmpp20.packet.Cmpp20PacketType; import com.zx.sms.common.util.DefaultMsgIdUtil; import static com.zx.sms.common.util.NettyByteBufUtil.*; /** * shifei(shifei@asiainfo.com) * */ public class Cmpp20DeliverResponseMessageCodec extends MessageToMessageCodec<Message, CmppDeliverResponseMessage> { private PacketType packetType; /** * */ public Cmpp20DeliverResponseMessageCodec() { this(Cmpp20PacketType.CMPPDELIVERRESPONSE); } public Cmpp20DeliverResponseMessageCodec(PacketType packetType) { this.packetType = packetType; } @Override protected void decode(ChannelHandlerContext ctx, Message msg, List<Object> out) { long commandId = ((Long) msg.getHeader().getCommandId()).longValue(); if(packetType.getCommandId() != commandId) { //不解析,交给下一个codec out.add(msg); return; } CmppDeliverResponseMessage responseMessage = new CmppDeliverResponseMessage(msg.getHeader()); ByteBuf bodyBuffer = Unpooled.wrappedBuffer(msg.getBodyBuffer()); responseMessage.setMsgId(DefaultMsgIdUtil.bytes2MsgId(toArray(bodyBuffer ,Cmpp20DeliverResponse.MSGID.getLength()))); responseMessage.setResult(bodyBuffer.readUnsignedByte()); ReferenceCountUtil.release(bodyBuffer); out.add(responseMessage); } @Override protected void encode(ChannelHandlerContext ctx, CmppDeliverResponseMessage msg, List<Object> out) { ByteBuf bodyBuffer = ctx.alloc().buffer(Cmpp20DeliverResponse.MSGID.getBodyLength()); bodyBuffer.writeBytes(DefaultMsgIdUtil.msgId2Bytes(msg.getMsgId())); bodyBuffer.writeByte((int) msg.getResult()); msg.setBodyBuffer(toArray(bodyBuffer,bodyBuffer.readableBytes())); msg.getHeader().setBodyLength(msg.getBodyBuffer().length); ReferenceCountUtil.release(bodyBuffer); out.add(msg); } }
[ "326018662@qq.com" ]
326018662@qq.com
140edcae3a490e212d7b89a248884e355307113c
efd20c4174dcc6ec5b2f000e43ee6ed0a9316a70
/task-worker-media-transcode/src/main/java/com/nd/esp/task/worker/buss/media_transcode/support/LifeCircleException.java
4b58f17a9f79eb4add26f246702eead019f621e8
[]
no_license
434480761/develop
12cf03af4622865cc33236a3370a0f2c3a2cc929
124b85e0863d92d1f4fbc8e93bb35784ba836140
refs/heads/master
2021-01-11T07:37:49.332772
2016-10-24T01:16:13
2016-10-24T01:16:13
72,700,800
3
1
null
null
null
null
UTF-8
Java
false
false
1,252
java
package com.nd.esp.task.worker.buss.media_transcode.support; import org.springframework.http.HttpStatus; import com.nd.gaea.rest.exceptions.extendExceptions.WafSimpleException; /** * @title 生命管理周期业务异常处理 * @Desc TODO * @author liuwx * @version 1.0 * @create 2015年1月26日 上午11:33:38 */ public class LifeCircleException extends WafSimpleException{ /** * */ private static final long serialVersionUID = -7171590667016717608L; public LifeCircleException(HttpStatus status, String code, String message) { super(status, code, message); // TODO Auto-generated constructor stub } public LifeCircleException(HttpStatus status, MessageMapper messageMapper) { super(status, messageMapper.getCode(), messageMapper.getMessage()); // TODO Auto-generated constructor stub } public LifeCircleException(String code, String message) { this(HttpStatus.OK,code, message); // TODO Auto-generated constructor stub } public LifeCircleException(String message) { super(message); // TODO Auto-generated constructor stub } public LifeCircleException(MessageMapper messageMapper) { this(messageMapper.getCode(),messageMapper.getMessage()); // TODO Auto-generated constructor stub } }
[ "407051837@qq.com" ]
407051837@qq.com
fe259fc6b9e9edffdb1ef0c7fdff2fb8538ee0e8
bd20db2baa4478b7099392d1fab37a2a66d23913
/Src-Bitmap-Scale/java/utility/BitmapScaler.java
8c09d8cf1befcd7699a643c3a297c1e2ec7ca178
[ "Apache-2.0" ]
permissive
Ygauraw/Android-Templates-And-Utilities
a51e01bc9c823744b0a9bc06e2a9af1f80e324ad
775e33dcd9f1bbe962bd5d7237a240b7448a996e
refs/heads/master
2020-12-25T11:32:09.277487
2015-01-28T23:22:47
2015-01-28T23:22:47
30,013,159
1
0
null
2015-01-29T09:29:32
2015-01-29T09:29:32
null
UTF-8
Java
false
false
1,263
java
package com.example.utility; import android.graphics.Bitmap; public class BitmapScaler { // scale and keep aspect ratio public static Bitmap scaleToFitWidth(Bitmap b, int width) { float factor = width / (float) b.getWidth(); return Bitmap.createScaledBitmap(b, width, (int) (b.getHeight() * factor), true); } // scale and keep aspect ratio public static Bitmap scaleToFitHeight(Bitmap b, int height) { float factor = height / (float) b.getHeight(); return Bitmap.createScaledBitmap(b, (int) (b.getWidth() * factor), height, true); } // scale and keep aspect ratio public static Bitmap scaleToFill(Bitmap b, int width, int height) { float factorH = height / (float) b.getWidth(); float factorW = width / (float) b.getWidth(); float factorToUse = (factorH > factorW) ? factorW : factorH; return Bitmap.createScaledBitmap(b, (int) (b.getWidth() * factorToUse), (int) (b.getHeight() * factorToUse), true); } // scale and don't keep aspect ratio public static Bitmap strechToFill(Bitmap b, int width, int height) { float factorH = height / (float) b.getHeight(); float factorW = width / (float) b.getWidth(); return Bitmap.createScaledBitmap(b, (int) (b.getWidth() * factorW), (int) (b.getHeight() * factorH), true); } }
[ "petr.nohejl@gmail.com" ]
petr.nohejl@gmail.com
0fbbd222e313f41712696dca5795d2273362f8f3
2cc568ca8296784ba0f3c76cd4ad45d45c2d0310
/src/main/java/by/epam/jwd/question2/Date.java
e2ad6d99934ff07f3b0506eedd68a5c12c577226
[]
no_license
AliaksandrAnashkevich/JWD_Task01
fa842ee0a897a5081a85aa44b1116023d02187e7
5f6b4f822e40cf5ab03f4a4cb2f1ab788621c1ea
refs/heads/main
2023-01-23T07:02:47.975035
2020-11-26T13:19:50
2020-11-26T13:19:50
316,234,753
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package by.epam.jwd.question2; public class Date { private static final String[] ARRAY_WITH_NAME_MONTH = {"January","February","March","April", "May","June","July","August","September","October", "November","December"}; public static boolean isLeapYear(int numberYear) { return ((numberYear % 400 == 0) || ((numberYear % 4 == 0) && (numberYear % 100 != 0))); } public static String nameMonth(int numberMonth) { return ((numberMonth<13)&&(numberMonth>0))?ARRAY_WITH_NAME_MONTH[numberMonth-1]:"error"; } }
[ "alexlida98@gmail.com" ]
alexlida98@gmail.com
fb10dbd147eddc72a24d9f273cdf3f3aa0db0233
9ea2f84d5241a4761f5c2c9d3a65bf186502815b
/code/demo/IDesignPattern/create/FactoryMethod/src/main/java/cn/i/xportal/jdp/factorymethod/farm/StrawberryGardener.java
097c5d74de401981414dcf73949a4a8ae4b98475
[]
no_license
icesx/IResearch
ffee22cd5846df11ffc9e4bdd22305b753def2c3
8349098219f062e07fa0eab6122503eb72d94223
refs/heads/master
2022-11-28T22:29:00.062512
2021-09-03T02:04:33
2021-09-03T02:04:33
120,061,918
0
0
null
2022-11-16T00:53:13
2018-02-03T05:19:16
Java
UTF-8
Java
false
false
158
java
package cn.i.xportal.jdp.factorymethod.farm; public class StrawberryGardener implements FruitGardener { public Fruit factory() { return new Apple(); } }
[ "chengtao@ithink" ]
chengtao@ithink
03ecc4bb0a9923eaa7447bdd6b6d52d00ba3fc62
77543e4c1d923b2f048b454fd01dc1ba964f9f14
/app/src/main/java/ru/malroy/mvphelper/PerformReactViewState.java
86926bd5e80e5725c5393b8d12d484d5fcb6886a
[]
no_license
malroy89/MvpHelper
50b435896a19169c397d676e183e6eb70795df6f
7246e598430adf69ec2cf9132a671d2cd5739300
refs/heads/master
2021-01-13T07:52:53.630364
2017-06-21T21:30:42
2017-06-21T21:30:42
94,986,332
0
0
null
null
null
null
UTF-8
Java
false
false
1,152
java
package ru.malroy.mvphelper; import android.support.annotation.NonNull; import ru.malroy.mvphelper.viewstate.ViewState; /** * Created by Dzmitry Lamaka on 18.12.2015. */ public class PerformReactViewState<V extends PerformReactView> implements ViewState<V> { private static final int STATE_SHOW_INIT_VIEW = 0; private static final int STATE_SHOW_LOADING = 1; private static final int STATE_SHOW_ERROR = 2; protected int currentState = STATE_SHOW_INIT_VIEW; @Override public void apply(@NonNull final V view) { switch (currentState) { case STATE_SHOW_INIT_VIEW: view.showInitView(); break; case STATE_SHOW_LOADING: view.showLoading(); break; case STATE_SHOW_ERROR: view.showError(null); break; } } public void setShowInitViewState() { currentState = STATE_SHOW_INIT_VIEW; } public void setShowLoadingState() { currentState = STATE_SHOW_LOADING; } public void setShowErrorState() { currentState = STATE_SHOW_ERROR; } }
[ "dimacat@yandex.ru" ]
dimacat@yandex.ru
2689ab23284925f2a1ac9a4e50f314e193c1947e
38c4451ab626dcdc101a11b18e248d33fd8a52e0
/tokens/lucene-3.6.2/contrib/analyzers/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsBuilder.java
baf53f8c34f0c43c4c63763f3b83456e830611d7
[]
no_license
habeascorpus/habeascorpus-data
47da7c08d0f357938c502bae030d5fb8f44f5e01
536d55729f3110aee058ad009bcba3e063b39450
refs/heads/master
2020-06-04T10:17:20.102451
2013-02-19T15:19:21
2013-02-19T15:19:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,210
java
package TokenNamepackage org TokenNameIdentifier . TokenNameDOT apache TokenNameIdentifier . TokenNameDOT lucene TokenNameIdentifier . TokenNameDOT analysis TokenNameIdentifier . TokenNameDOT ja TokenNameIdentifier . TokenNameDOT util TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT io TokenNameIdentifier . TokenNameDOT FileInputStream TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT io TokenNameIdentifier . TokenNameDOT IOException TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT io TokenNameIdentifier . TokenNameDOT InputStreamReader TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT io TokenNameIdentifier . TokenNameDOT LineNumberReader TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT nio TokenNameIdentifier . TokenNameDOT charset TokenNameIdentifier . TokenNameDOT Charset TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT nio TokenNameIdentifier . TokenNameDOT charset TokenNameIdentifier . TokenNameDOT CharsetDecoder TokenNameIdentifier ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier . TokenNameDOT nio TokenNameIdentifier . TokenNameDOT charset TokenNameIdentifier . TokenNameDOT CodingErrorAction TokenNameIdentifier ; TokenNameSEMICOLON public TokenNamepublic class TokenNameclass ConnectionCostsBuilder TokenNameIdentifier { TokenNameLBRACE private TokenNameprivate ConnectionCostsBuilder TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE } TokenNameRBRACE public TokenNamepublic static TokenNamestatic ConnectionCostsWriter TokenNameIdentifier build TokenNameIdentifier ( TokenNameLPAREN String TokenNameIdentifier filename TokenNameIdentifier ) TokenNameRPAREN throws TokenNamethrows IOException TokenNameIdentifier { TokenNameLBRACE FileInputStream TokenNameIdentifier inputStream TokenNameIdentifier = TokenNameEQUAL new TokenNamenew FileInputStream TokenNameIdentifier ( TokenNameLPAREN filename TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON Charset TokenNameIdentifier cs TokenNameIdentifier = TokenNameEQUAL Charset TokenNameIdentifier . TokenNameDOT forName TokenNameIdentifier ( TokenNameLPAREN "US-ASCII" TokenNameStringLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON CharsetDecoder TokenNameIdentifier decoder TokenNameIdentifier = TokenNameEQUAL cs TokenNameIdentifier . TokenNameDOT newDecoder TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT onMalformedInput TokenNameIdentifier ( TokenNameLPAREN CodingErrorAction TokenNameIdentifier . TokenNameDOT REPORT TokenNameIdentifier ) TokenNameRPAREN . TokenNameDOT onUnmappableCharacter TokenNameIdentifier ( TokenNameLPAREN CodingErrorAction TokenNameIdentifier . TokenNameDOT REPORT TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON InputStreamReader TokenNameIdentifier streamReader TokenNameIdentifier = TokenNameEQUAL new TokenNamenew InputStreamReader TokenNameIdentifier ( TokenNameLPAREN inputStream TokenNameIdentifier , TokenNameCOMMA decoder TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON LineNumberReader TokenNameIdentifier lineReader TokenNameIdentifier = TokenNameEQUAL new TokenNamenew LineNumberReader TokenNameIdentifier ( TokenNameLPAREN streamReader TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON String TokenNameIdentifier line TokenNameIdentifier = TokenNameEQUAL lineReader TokenNameIdentifier . TokenNameDOT readLine TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON String TokenNameIdentifier [ TokenNameLBRACKET ] TokenNameRBRACKET dimensions TokenNameIdentifier = TokenNameEQUAL line TokenNameIdentifier . TokenNameDOT split TokenNameIdentifier ( TokenNameLPAREN "\s+" TokenNameStringLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON assert TokenNameassert dimensions TokenNameIdentifier . TokenNameDOT length TokenNameIdentifier == TokenNameEQUAL_EQUAL 2 TokenNameIntegerLiteral ; TokenNameSEMICOLON int TokenNameint forwardSize TokenNameIdentifier = TokenNameEQUAL Integer TokenNameIdentifier . TokenNameDOT parseInt TokenNameIdentifier ( TokenNameLPAREN dimensions TokenNameIdentifier [ TokenNameLBRACKET 0 TokenNameIntegerLiteral ] TokenNameRBRACKET ) TokenNameRPAREN ; TokenNameSEMICOLON int TokenNameint backwardSize TokenNameIdentifier = TokenNameEQUAL Integer TokenNameIdentifier . TokenNameDOT parseInt TokenNameIdentifier ( TokenNameLPAREN dimensions TokenNameIdentifier [ TokenNameLBRACKET 1 TokenNameIntegerLiteral ] TokenNameRBRACKET ) TokenNameRPAREN ; TokenNameSEMICOLON assert TokenNameassert forwardSize TokenNameIdentifier > TokenNameGREATER 0 TokenNameIntegerLiteral && TokenNameAND_AND backwardSize TokenNameIdentifier > TokenNameGREATER 0 TokenNameIntegerLiteral ; TokenNameSEMICOLON ConnectionCostsWriter TokenNameIdentifier costs TokenNameIdentifier = TokenNameEQUAL new TokenNamenew ConnectionCostsWriter TokenNameIdentifier ( TokenNameLPAREN forwardSize TokenNameIdentifier , TokenNameCOMMA backwardSize TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON while TokenNamewhile ( TokenNameLPAREN ( TokenNameLPAREN line TokenNameIdentifier = TokenNameEQUAL lineReader TokenNameIdentifier . TokenNameDOT readLine TokenNameIdentifier ( TokenNameLPAREN ) TokenNameRPAREN ) TokenNameRPAREN != TokenNameNOT_EQUAL null TokenNamenull ) TokenNameRPAREN { TokenNameLBRACE String TokenNameIdentifier [ TokenNameLBRACKET ] TokenNameRBRACKET fields TokenNameIdentifier = TokenNameEQUAL line TokenNameIdentifier . TokenNameDOT split TokenNameIdentifier ( TokenNameLPAREN "\s+" TokenNameStringLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON assert TokenNameassert fields TokenNameIdentifier . TokenNameDOT length TokenNameIdentifier == TokenNameEQUAL_EQUAL 3 TokenNameIntegerLiteral ; TokenNameSEMICOLON int TokenNameint forwardId TokenNameIdentifier = TokenNameEQUAL Integer TokenNameIdentifier . TokenNameDOT parseInt TokenNameIdentifier ( TokenNameLPAREN fields TokenNameIdentifier [ TokenNameLBRACKET 0 TokenNameIntegerLiteral ] TokenNameRBRACKET ) TokenNameRPAREN ; TokenNameSEMICOLON int TokenNameint backwardId TokenNameIdentifier = TokenNameEQUAL Integer TokenNameIdentifier . TokenNameDOT parseInt TokenNameIdentifier ( TokenNameLPAREN fields TokenNameIdentifier [ TokenNameLBRACKET 1 TokenNameIntegerLiteral ] TokenNameRBRACKET ) TokenNameRPAREN ; TokenNameSEMICOLON int TokenNameint cost TokenNameIdentifier = TokenNameEQUAL Integer TokenNameIdentifier . TokenNameDOT parseInt TokenNameIdentifier ( TokenNameLPAREN fields TokenNameIdentifier [ TokenNameLBRACKET 2 TokenNameIntegerLiteral ] TokenNameRBRACKET ) TokenNameRPAREN ; TokenNameSEMICOLON costs TokenNameIdentifier . TokenNameDOT add TokenNameIdentifier ( TokenNameLPAREN forwardId TokenNameIdentifier , TokenNameCOMMA backwardId TokenNameIdentifier , TokenNameCOMMA cost TokenNameIdentifier ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE return TokenNamereturn costs TokenNameIdentifier ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE
[ "pschulam@gmail.com" ]
pschulam@gmail.com
57ba6c930d634c07ae4dbc4c6139511151428cbe
a9a0ae4e681193f39285d206d09f7fa6d26658dd
/recengine-core/src/main/java/com/qingchao/recengine/core/plugin/precontextfiller/AbstractPreContextFiller.java
f799569a25f8d4154ac54d3db3fc04fefe91d867
[]
no_license
qingchao-kong/recengine
414b676dae99ac9eadbdc7cd75484312fa1093fd
e2bb1745022144b1bcec5c02a93a0dd07c293001
refs/heads/main
2023-04-19T09:43:28.199361
2021-04-26T07:08:25
2021-04-26T07:08:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,143
java
package com.qingchao.recengine.core.plugin.precontextfiller; import com.dianping.cat.Cat; import com.qingchao.recengine.core.bean.context.AbstractRecPluginContext; import com.qingchao.recengine.core.bean.context.AbstractRecRequestContext; import com.qingchao.recengine.core.bean.loginfo.LogInfo; import com.qingchao.recengine.core.bean.request.DefaultRecRequest; import com.qingchao.recengine.core.config.RecEngineConfig; import com.qingchao.recengine.core.enums.StageEnum; import com.qingchao.recengine.core.plugin.AbstractRecPlugin; import lombok.extern.slf4j.Slf4j; import java.util.HashSet; import java.util.Objects; import java.util.Set; /** * 描述: * * @author kongqingchao * @create 2021-03-19 10:30 上午 */ @Slf4j public abstract class AbstractPreContextFiller<PC extends AbstractRecPluginContext, RC extends AbstractRecRequestContext, R extends DefaultRecRequest> extends AbstractRecPlugin<PC> implements IPreContextFiller<PC, RC, R> { protected Class<RC> requestContextClass = null; public final RC doFill(R recRequest, RecEngineConfig recEngineConfig, boolean normalFlow) { long start = System.currentTimeMillis(); RC requestContext = null; Throwable err = null; String msg = null; try { requestContext = fillContext(recRequest, recEngineConfig, normalFlow); } catch (Throwable throwable) { msg = String.format("RecEngine. AbstractPreContextFiller.doFill error, error:%s, recRequest:%s, recEngineConfig:%s, normalflow:%s", throwable, recRequest, recEngineConfig, normalFlow); log.error(msg, throwable); Cat.logError(msg, throwable); err = throwable; } LogInfo.builder() .explainLog(true) .normalFlow(normalFlow) .requestId(requestContext.getRecRequest().getRequestId()) .uid(recRequest.getUid()) .scene(recEngineConfig.getScene()) .startTime(start) .costTime(System.currentTimeMillis() - start) .stage(StageEnum.preContextFiller) .success(Objects.nonNull(requestContext)) .msg(msg) .throwable(err) .build() .log(); return requestContext; } private final RC fillContext(R recRequest, RecEngineConfig recEngineConfig, boolean normalFlow) { //1.requestContext初始化 RC requestContext = null; try { requestContext = (RC) this.requestContextClass.newInstance(); } catch (Throwable throwable) { final String format = String.format("RecEngine. Create request context error, error:%s, request:%s, recEngineConfig:%s", throwable, recRequest, recEngineConfig); Cat.logError(format, throwable); log.error(format, throwable); return null; } requestContext.setRecRequest(recRequest); requestContext.setRecEngineConfig(recEngineConfig); requestContext.setNormalFlow(normalFlow); //2.fill,上下文信息填充,使用方自行实现 final boolean fill = fill((RC) requestContext); if (!fill) { final String format = String.format("RecEngine. Pre context fill false, request:%s, recEngineConfig:%s", recRequest, recEngineConfig); Cat.logError(format, new Exception(format)); log.error(format); return null; } //3.load filter id set,加载过滤id集合,使用方自行实现 Set<String> filterIdSet = new HashSet<>(); final boolean loadFilterIdSet = loadFilterIdSet((RC) requestContext, filterIdSet); if (!loadFilterIdSet) { final String format = String.format("RecEngine. Pre context load filter id set false, request:%s, recEngineConfig:%s", recRequest, recEngineConfig); Cat.logError(format, new Exception(format)); log.error(format); return null; } requestContext.setFilterIdSet(filterIdSet); return requestContext; } }
[ "kongqingchao@bixin.cn" ]
kongqingchao@bixin.cn
088817e05552b813e75c670a4943d0b4462c22d0
b799f86ebcd9832833470b99f9c92e1351d01d97
/app/src/main/java/com/pu/gouthelper/base/BaseFragment.java
32a1ff57cfd3ed34a9185dd2314ab5a2398e79d2
[]
no_license
gongyaju/gout
4916c2fb1c585e433e629fb532288ff0cbadc460
01f9f415d65b17f2ebb01594c8ec6495dcc0bc40
refs/heads/master
2020-05-22T04:15:45.253732
2016-11-26T01:58:07
2016-11-26T01:58:07
61,945,568
1
0
null
null
null
null
UTF-8
Java
false
false
786
java
package com.pu.gouthelper.base; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import org.xutils.x; /** * Created by Requiem on 16/03/05. */ public class BaseFragment extends Fragment { private boolean injected = false; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { injected = true; return x.view().inject(this, inflater, container); } @Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!injected) { x.view().inject(this, this.getView()); } } }
[ "359451222@qq.com" ]
359451222@qq.com
83a4bdcc0c062a139d7dcb5cbe65bd17727b38ad
a79d0a2194e07f7362d5f1e71dad11d506dcc365
/src/main/java/com/example/finalproject/services/MarkService.java
d09c31b2b218299e5b21d3e5441cfacc81e1093b
[]
no_license
PavleSt/e-Dnevnik-BackEnd
972fe18b21baf0d4e5dcaf268755b9611f9b290c
aaf2421825c8e87af83890e61b61eb08a15b39d7
refs/heads/master
2020-03-25T00:42:56.839654
2018-08-01T20:48:18
2018-08-01T20:48:18
143,201,821
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.example.finalproject.services; import java.security.Principal; import java.util.List; import org.springframework.http.ResponseEntity; import com.example.finalproject.entities.LectureEntity; import com.example.finalproject.entities.dto.MarkDTO; public interface MarkService { ResponseEntity<?> addNewMark(MarkDTO newMark, Principal principal); }
[ "stanojkovicpavle@gmail.com" ]
stanojkovicpavle@gmail.com
663eb846cb6ff8c3c16deb76096e00761fdd33b3
63b4643b2bae0fd6e94c6ae61b7cc4615c1fa2e2
/capture-library/src/main/java/com/github/jasonwangdev/capture/VideoCapture.java
8c8633ba77101aba488e06d095ca61722e5f2dfb
[]
no_license
JasonWangDev/capture-android
a7f82e2048d57ac0b81ea549830bd3412f2b7d20
edce75d9a1effbc9e5f921186c4cca344b4edeba
refs/heads/master
2020-12-03T00:20:07.252323
2017-07-02T21:37:39
2017-07-02T21:37:39
96,016,707
0
0
null
null
null
null
UTF-8
Java
false
false
4,679
java
package com.github.jasonwangdev.capture; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.ThumbnailUtils; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.support.v4.content.FileProvider; import com.github.jasonwangdev.capture.utils.FileUtils; import com.github.jasonwangdev.capture.utils.HardwareUtils; import com.github.jasonwangdev.capture.utils.PermissionResult; import com.github.jasonwangdev.capture.utils.PermissionUtils; import java.io.File; import java.util.Date; import java.util.List; /** * Created by Jason on 2017/7/2. */ public class VideoCapture { private static final String CAMERA_HARDWARE = PackageManager.FEATURE_CAMERA; private static final String STORAGE_PERMISSIONS = Manifest.permission.WRITE_EXTERNAL_STORAGE; private static final String FOLDER_PATH = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getPath(); private static final String FILE_NAME_FORMAT = "VIDEO_%tC%<ty%<tm%<td-%<tL.mp4"; private static final int REQUEST_CAMERA = 0x02; private OnCaptureListener listener; private Fragment fragment; private File file; public void capture(Fragment fragment) { this.fragment = fragment; if (!HardwareUtils.checkHardware(fragment, CAMERA_HARDWARE)) { if (null != listener) listener.onCaptureError(Error.CAMERA_NOT_SUPPORT); return; } if (!PermissionUtils.checkPermission(fragment, STORAGE_PERMISSIONS)) PermissionUtils.requestPermission(fragment, STORAGE_PERMISSIONS); else startCapture(); } public Bitmap getThumbnail() { return file.exists() ? ThumbnailUtils.createVideoThumbnail(file.getPath(), MediaStore.Video.Thumbnails.MICRO_KIND) : null; } public void setOnCaptureListener(OnCaptureListener listener) { this.listener = listener; } public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) { List<PermissionResult> permissionResults = PermissionUtils.getPermissionResults(fragment, requestCode, permissions, grantResults); for(PermissionResult permissionResult : permissionResults) { if (!permissionResult.isGrant()) { if (STORAGE_PERMISSIONS.equals(permissionResult.getPermission())) { if (null != listener) listener.onCaptureError(permissionResult.isChoseNeverAskAgain() ? Error.STORAGE_PERMISSION_NEVER_DENIED : Error.STORAGE_PERMISSION_DENIED); return; } } } startCapture(); } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (REQUEST_CAMERA == requestCode) { // 部分裝置如三星手機設置 MediaStore.EXTRA_OUTPUT 參數時會有衝突,導致第三方攝影 APP 在 // 錄製完畢後無法正常返回,需要使用者按下 Back 鍵,也因此 resultCode 永遠為 Cancel ,所 // 改採用檔案是否存在來做為判斷基準 if (file.exists()) { if (null != listener) listener.onCaptured(file); } } } private void startCapture() { file = FileUtils.createFile(FOLDER_PATH, String.format(FILE_NAME_FORMAT, new Date().getTime())); if (null == file) { if (null != listener) listener.onCaptureError(Error.FILE_FAILED); } openCamera(); } private void openCamera() { if (null == fragment || null == file) return; Uri uri; try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) uri = FileProvider.getUriForFile(fragment.getContext(), fragment.getContext().getPackageName() + ".fileProvider", file); else uri = Uri.fromFile(file); } catch (NullPointerException e) { return; } Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); fragment.startActivityForResult(intent, REQUEST_CAMERA); } }
[ "test@gmail.com" ]
test@gmail.com
81ce44a3be6b67353f02385098483cf7447852b6
28439267a6fa7c3b6f568e9b482be2df2032b2f3
/kodilla-patterns/src/test/java/com/kodilla/patterns/factory/tasks/TaskFactoryTestSuite.java
61d7edd437fa9ae310d5f9c993691e51be7cb6f1
[]
no_license
bartosz-kedziora/bartosz-kedziora-kodilla-java
ee31f8b13bcd187b689f3cd90baedda7976d2989
623fac2a1c6ce337fadb262a42f150d568d38ebd
refs/heads/master
2023-06-11T23:37:36.277487
2021-07-07T16:35:46
2021-07-07T16:35:46
308,262,488
0
0
null
null
null
null
UTF-8
Java
false
false
1,189
java
package com.kodilla.patterns.factory.tasks; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; public class TaskFactoryTestSuite { @Test void testFactoryShoppingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task shoppingTask = factory.makeTask(TaskFactory.SHOPPING_TASK); //Then assertTrue(shoppingTask.isTaskExecuted()); assertEquals("Shopping List", shoppingTask.getTaskName()); } @Test void testFactoryPaintingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task paintingTask = factory.makeTask(TaskFactory.PAINTING_TASK); //Then assertTrue(paintingTask.isTaskExecuted()); assertEquals("Painitng challenge", paintingTask.getTaskName()); } @Test void testFactoryDrivingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task drivingTask = factory.makeTask(TaskFactory.DRIVING_TASK); //Then assertTrue(drivingTask.isTaskExecuted()); assertEquals("Holiday route", drivingTask.getTaskName()); } }
[ "bartosz.kedziora89@gmail.com" ]
bartosz.kedziora89@gmail.com
60d951f39507fde196de6dd3dfd893f39eb328b1
1c1b5f607b0a58462cbba98d7c89cadbfbf8f344
/src/org/usfirst/frc/team3695/robot/commands/ExampleCommand.java
f1af359df93776850e427805086a7d79c21e6d54
[]
no_license
3695StephenJohnson/Stronghold-2016
336e419a4cbc4ac5d19d8d4b43c6eb01016905c7
342ec19916ac55915839a1eef33f857f98b137e6
refs/heads/master
2020-12-11T01:40:14.309753
2016-01-16T21:10:49
2016-01-16T21:10:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
933
java
package org.usfirst.frc.team3695.robot.commands; import edu.wpi.first.wpilibj.command.Command; import org.usfirst.frc.team3695.robot.Robot; /** * */ public class ExampleCommand extends Command { public ExampleCommand() { // Use requires() here to declare subsystem dependencies //requires(Robot.exampleSubsystem); } // Called just before this Command runs the first time protected void initialize() { } // Called repeatedly when this Command is scheduled to run protected void execute() { } // Make this return true when this Command no longer needs to run execute() protected boolean isFinished() { return false; } // Called once after isFinished returns true protected void end() { } // Called when another command which requires one or more of the same // subsystems is scheduled to run protected void interrupted() { } }
[ "Program@10.110.59.136" ]
Program@10.110.59.136
9ff11453c34dc641857ce242c0d14148cd7c41f3
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/alibaba--druid/b01273ce00b466d8da7c4fb21eff77a2ce3919b8/after/OracleWallPermitTableTest.java
af746864c3a48993a4ada4d20a60de51526b2658
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
2,255
java
/* * Copyright 1999-2101 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.alibaba.druid.bvt.filter.wall.oracle; import junit.framework.TestCase; import org.junit.Assert; import com.alibaba.druid.wall.WallUtils; public class OracleWallPermitTableTest extends TestCase { public void test_permitTable() throws Exception { Assert.assertFalse(WallUtils.isValidateOracle("SELECT * FROM T UNION select * from TAB")); Assert.assertFalse(WallUtils.isValidateOracle("SELECT * FROM T UNION select * from tab")); Assert.assertFalse(WallUtils.isValidateOracle("SELECT * FROM T UNION select * from SYS.TAB")); Assert.assertFalse(WallUtils.isValidateOracle("SELECT * FROM T UNION select * from SYS.\"TAB\"")); Assert.assertFalse(WallUtils.isValidateOracle("SELECT * FROM T UNION select * from all_users")); } public void test_permitTable_subquery() throws Exception { Assert.assertTrue(WallUtils.isValidateOracle("select * from(select * from TAB) a")); Assert.assertTrue(WallUtils.isValidateOracle("select * from(select * from tab) a")); Assert.assertTrue(WallUtils.isValidateOracle("select * from(select * from SYS.TAB) a")); Assert.assertTrue(WallUtils.isValidateOracle("select * from(select * from SYS.\"TAB\") a")); } public void test_permitTable_join() throws Exception { Assert.assertTrue(WallUtils.isValidateOracle("select * from t1, TAB")); Assert.assertTrue(WallUtils.isValidateOracle("select * from t1, tab")); Assert.assertTrue(WallUtils.isValidateOracle("select * from t1, SYS.TAB")); Assert.assertTrue(WallUtils.isValidateOracle("select * from t1, SYS.\"TAB\"")); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
5c055c954a0f3432eb14778e7009dc89299ca66e
0340eef5c401d83e05dd16f2dcfe1cf1841466df
/src/com/zw/EdgeMapper.java
22c22721c13d2046ee2161f2c25ec6b27c8c9de3
[]
no_license
wangrush/traffic_demo
e2d9efe740458c281deec23c0d6df4f6f56e4c0e
d45bfc870d4291145090900a9441e6a52c528f3c
refs/heads/master
2020-03-20T17:33:42.204390
2018-06-16T06:57:26
2018-06-16T06:57:26
137,560,183
0
0
null
null
null
null
UTF-8
Java
false
false
613
java
package com.zw; import org.springframework.jdbc.core.RowMapper; import java.sql.ResultSet; import java.sql.SQLException; /** * Created by ZhangWang on 2018/6/15. */ public class EdgeMapper implements RowMapper<Edge> { @Override public Edge mapRow(ResultSet resultSet, int i) throws SQLException { Node nodeA = new Node(); Node nodeB = new Node(); nodeA.setName(resultSet.getString("d1")); nodeB.setName(resultSet.getString("d2")); Edge edge = new Edge(nodeA, nodeB); edge.setType(resultSet.getMetaData().getColumnName(3)); return edge; } }
[ "1012963709@qq.com" ]
1012963709@qq.com
d2135db2e38db90fefb35ca5deb1fa78f2b62985
18b81a1f005320deb87d11160a80b51440211256
/src/Packet.java
80236b5ffbf46ccc1e7827746c71e3b60c3c25c9
[]
no_license
tony2times2times/460_project_one
79a61a5fc2b940e691a25ce930b560eef0611ead
74e361fcf789145e357b5e8f0922ba4664d0308d
refs/heads/master
2021-09-12T14:53:33.825307
2018-04-17T23:12:30
2018-04-17T23:12:30
118,695,418
0
0
null
2018-04-10T19:12:43
2018-01-24T01:45:45
Java
UTF-8
Java
false
false
879
java
import java.nio.ByteBuffer; public class Packet { protected short checksum; protected short length; protected int ackno; protected static short getShort(byte[] dataSegment, int pointer) { byte[] shortArray = new byte[2]; System.arraycopy(dataSegment, pointer, shortArray, 0, 2); ByteBuffer wrappedNum = ByteBuffer.wrap(shortArray); return wrappedNum.getShort(); } protected static int getInt(byte[] dataSegment, int pointer) { byte[] shortArray = new byte[4]; System.arraycopy(dataSegment, pointer, shortArray, 0, 4); ByteBuffer wrappedNum = ByteBuffer.wrap(shortArray); return wrappedNum.getInt(); } public boolean isValid() { if (checksum == 0) { return true; } else { return false; } } public short getChecksum() { return checksum; } public short getLength() { return length; } public int getAckno() { return ackno; } }
[ "tony.peraza86@gmail.com" ]
tony.peraza86@gmail.com
d9eb2d554fe5f5918ace8d69d2949a28fd888653
95b10905bd683e94d1ab80621975fd0674ecf3d3
/src/main/java/com/supermy/designpatterns/command/Producer.java
bf55116c47059894aaec3e7d9b93fd135bd5f690
[]
no_license
supermy/rest-api
8c019b6e686c750e161ca3b0736ee78ff29ed049
90344b6379adbb2bb92ec7f8072ebad6125f091a
refs/heads/master
2020-05-21T20:27:46.753081
2017-04-20T10:51:19
2017-04-20T10:51:19
61,520,859
21
17
null
null
null
null
UTF-8
Java
false
false
392
java
package com.supermy.designpatterns.command; import java.util.ArrayList; import java.util.List; /** * Created by moyong on 17/2/22. */ public class Producer { public static List produceRequests() { List queue = new ArrayList(); queue.add( new Engineer() ); queue.add( new Politician() ); queue.add( new Programmer() ); return queue; } }
[ "springclick@gmail.com" ]
springclick@gmail.com
dc32f538fc1fc653e352b415b4863a94b3e59ae3
d0c05441530b49c03a9c35ef73c57854e85b9a23
/dubbo/productpage/src/main/java/com/example/productpage/DemoApplication.java
680da1581fa7d641e2cff7d112b0590a5a501e2c
[]
no_license
otecteng/bookinfo
cb7924bac99d25892b3de528075808285ff4cdbe
3230d3215470460979f9d61b094b36165ebe61ff
refs/heads/master
2023-07-16T22:19:12.681631
2021-05-12T02:56:58
2021-05-12T02:56:58
272,407,843
2
1
null
2020-06-22T04:19:45
2020-06-15T10:22:27
Java
UTF-8
Java
false
false
312
java
package com.example.productpage; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "otec.teng@gmail.com" ]
otec.teng@gmail.com
144917dda23bb3f54b2815e93fecfd28f5b4092b
4992109a4c4d37d77822a03443a38b9f91f28469
/app/src/main/java/com/kelompok/haqi/Metode.java
16aeb10ac841f86fc23fe4b875dd262a4b11388e
[]
no_license
viaaprillya/HAQI
468b713a9d6beb3d66357254dd1c2aa7e7f2c894
93fb99adfb37114c9ed7414a3d768eb7afc2a988
refs/heads/master
2020-08-28T06:42:39.136251
2019-10-25T22:46:21
2019-10-25T22:46:21
217,624,993
0
0
null
null
null
null
UTF-8
Java
false
false
1,191
java
package com.kelompok.haqi; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.ImageButton; public class Metode extends AppCompatActivity { ImageButton metodeIqra, metodeTilawati; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_metode); metodeIqra = (ImageButton) findViewById(R.id.iqra); metodeTilawati = (ImageButton) findViewById(R.id.tilawati); metodeIqra.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Metode.this,metodeIqra.class); Metode.this.startActivity(intent); } }); metodeTilawati.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Metode.this,metodeTilawati.class); Metode.this.startActivity(intent); } }); } }
[ "viaaprillya28@gmail.com" ]
viaaprillya28@gmail.com
5d6db148bf496a61242bdd55da4e114e7e88a354
c6e62164f340a33226931c1960008a6e63063144
/src/main/java/com/coolplay/user/security/exception/AuthBusinessException.java
cbafb5cd255e8f45c55550814fabafdfc21e72ac
[]
no_license
bjmajiancheng/coolplay-user-service
b6d8b02b76e6cfd8e4932b2bab1300d0d30cbea4
7df9c64e058c44aafe427b18752384e442e115c4
refs/heads/master
2022-12-22T07:42:36.387909
2020-03-26T07:25:50
2020-03-26T07:25:50
215,578,530
0
0
null
2022-12-16T11:36:03
2019-10-16T15:10:58
Java
UTF-8
Java
false
false
493
java
package com.coolplay.user.security.exception; import com.coolplay.user.common.exception.BusinessException; /** * Created by cgj on 2016/4/10. */ public class AuthBusinessException extends BusinessException { @Override protected String getPropertiesPath() { return "/properties/business_code.properties"; } public AuthBusinessException(int errCode) { super(errCode); } public AuthBusinessException(String message) { super(message); } }
[ "majiancheng@davdian.com" ]
majiancheng@davdian.com
9c06cb8442f4b232c58da3badf78392bf79a6ac0
6269a1abd23c2b1e0305b8f74cb9c54627903797
/Miwok/app/src/main/java/com/example/miwok/FamilyActivity.java
c2aa55006a2096421c73b3d80143d3a7c21d749c
[]
no_license
dk241294/Android-samples
a8a0b60dec48e383fedb4cf344041c9b544b2f9b
ea1fb569c708a2d5c3afba34ff5b5268091f7607
refs/heads/master
2020-06-07T04:44:27.498399
2019-09-24T14:48:03
2019-09-24T14:48:03
192,926,775
0
0
null
null
null
null
UTF-8
Java
false
false
2,058
java
package com.example.miwok; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ListView; import java.util.ArrayList; public class FamilyActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_family); getSupportActionBar().setTitle("family"); ArrayList<Word> words = new ArrayList<Word>(); words.add(new Word("father", "әpә",R.drawable.family_father)); words.add(new Word("mother", "әṭa",R.drawable.family_mother)); words.add(new Word("son", "angsi",R.drawable.family_son)); words.add(new Word("daughter", "tune",R.drawable.family_daughter)); words.add(new Word("older brother", "taachi",R.drawable.family_older_brother)); words.add(new Word("younger brother", "chalitti",R.drawable.family_older_sister)); words.add(new Word("older sister", "teṭe",R.drawable.family_older_brother)); words.add(new Word("younger sister", "kolliti",R.drawable.family_younger_sister)); words.add(new Word("grandmother ", "ama",R.drawable.family_grandmother)); words.add(new Word("grandfather", "paapa",R.drawable.family_grandfather)); // Create an {@link WordAdapter}, whose data source is a list of {@link Word}s. The // adapter knows how to create list items for each item in the list. WordAdapter adapter = new WordAdapter(this, words); // Find the {@link ListView} object in the view hierarchy of the {@link Activity}. // There should be a {@link ListView} with the view ID called list, which is declared in the // word_list.xml layout file. ListView listView = (ListView) findViewById(R.id.list); // Make the {@link ListView} use the {@link WordAdapter} we created above, so that the // {@link ListView} will display list items for each {@link Word} in the list. listView.setAdapter(adapter); } }
[ "49711366+dk241294@users.noreply.github.com" ]
49711366+dk241294@users.noreply.github.com
1f5b23a5d5e970190a7968196a7b1cc120df3a59
640f1729b931c856ff1b13c39dbdca168b0bb2f8
/axel-db/src/test/java/org/xmlactions/db/query/TestQueryBuilder.java
2074bd2635d43be423154d6cd0f369efcce420d6
[ "Apache-2.0" ]
permissive
mwjmurphy/Axel-Framework
469ad68d1c1ec9dd0d9967e946dbab36764e412f
2b58769c48d642a6d3f24ec0622e87f2118ecef4
refs/heads/master
2022-12-23T18:57:02.359663
2020-05-05T13:46:21
2020-05-05T13:46:21
41,671,109
3
1
Apache-2.0
2022-12-16T00:44:51
2015-08-31T11:08:16
Roff
UTF-8
Java
false
false
2,766
java
package org.xmlactions.db.query; import static org.junit.Assert.*; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.HashMap; import org.junit.Before; import org.junit.Test; import org.xmlactions.action.Action; import org.xmlactions.action.NestedActionException; import org.xmlactions.action.actions.BaseAction; import org.xmlactions.action.config.IExecContext; import org.xmlactions.action.config.NoPersistenceExecContext; import org.xmlactions.common.xml.BadXMLException; import org.xmlactions.common.xml.XMLObject; import org.xmlactions.db.StorageContainer; import org.xmlactions.db.actions.Storage; import org.xmlactions.db.actions.UtilsTestHelper; import org.xmlactions.db.config.StorageConfig; import org.xmlactions.db.env.EnvironmentAccess; import org.xmlactions.db.query.Query; import org.xmlactions.db.query.QueryBuilder; import org.xmlactions.db.sql.mysql.MySqlSelectQuery; import junit.framework.TestCase; import org.xmlactions.mapping.xml_to_bean.XmlToBean; public class TestQueryBuilder { private XmlToBean xmlToBean; @Before public void beforeMethod() { org.junit.Assume.assumeTrue(EnvironmentAccess.runDatabaseTests()); } @Test public void testLoadAndPopulate() throws Exception { Action action = new Action(); String page = Action.loadPage("src/test/resources", "db/storage.xml"); BaseAction[] actions = action.processXML(UtilsTestHelper.getExecContext(), page); assertEquals("Invalid number of actions returned from processXML", 1, actions.length); assertTrue("Action [" + action.getClass().getName() + "] should be a Storage class", actions[0] instanceof Storage); IExecContext execContext = UtilsTestHelper.getExecContext(); Storage storage = (Storage) actions[0]; StorageConfig storageConfig = new StorageConfig(); StorageContainer storageContainer = new StorageContainer("/db/storage.xml", execContext); storageConfig.setDatabaseName("test"); storageConfig.setSqlBuilder(new MySqlSelectQuery()); storageConfig.setStorageContainer(storageContainer); HashMap<String, Object> map = new HashMap<String, Object>(); map.put("address.id", "16"); execContext.addNamedMap("row", map); //StorageConfig storageConfig = (StorageConfig) execContext.get("storageConfig"); QueryBuilder qb = new QueryBuilder(); Query query = qb.loadQuery("/config/query/query.xml"); XMLObject xo = qb.buildQuery(UtilsTestHelper.getExecContext(), storageConfig, query); String xml = xo.mapXMLObject2XML(xo); assertNotNull(query); } }
[ "mike.murphy@travelsmart.co.uk" ]
mike.murphy@travelsmart.co.uk
0b077bb0824128f6782d5c7ed85a0ae5e6433a9a
7108abe90fbc24218dc580465f1ab95ee183e27a
/src/GenerateParantheses.java
0970955ffa00b95f68a9da89c69619ae16a4dcbc
[]
no_license
surbhi-singh/leetcode-solutions
255616d6248bbc0a3f858124ecf3064adf7acc86
c52b9b50ab72310e3cf0385665b3ae53679d3461
refs/heads/master
2021-01-20T05:36:45.057715
2018-02-06T23:07:10
2018-02-06T23:07:10
101,454,780
2
0
null
null
null
null
UTF-8
Java
false
false
1,034
java
class Solution { List<String> result; private void check(int n, int countOpenBr, int numberOfChars, String s) { StringBuilder str = new StringBuilder(s); if(numberOfChars == 2*n) { result.add(s); } else if(countOpenBr == 0) { str.append("("); check(n, ++countOpenBr, numberOfChars+1, str.toString()); } else if(countOpenBr == n) { str.append(")"); check(n, countOpenBr, numberOfChars+1, str.toString()); } else { str.append("("); check(n, countOpenBr+1, numberOfChars+1, str.toString()); str.deleteCharAt(str.length()-1); if((numberOfChars/2) != countOpenBr) { str.append(")"); check(n, countOpenBr, numberOfChars+1, str.toString()); } } } public List<String> generateParenthesis(int n) { result = new ArrayList<>(); check(n, 0, 0, new String()); return result; } }
[ "surbhi.chauhan011@gmail.com" ]
surbhi.chauhan011@gmail.com
b378b621785aa569e40d12979c2797b8cf77f606
b00c54389a95d81a22e361fa9f8bdf5a2edc93e3
/external/glide/library/src/main/java/com/bumptech/glide/request/RequestListener.java
e3ceda891ffcaac916b58544bcb4fe8c37487b24
[ "BSD-2-Clause-Views" ]
permissive
mirek190/x86-android-5.0
9d1756fa7ff2f423887aa22694bd737eb634ef23
eb1029956682072bb7404192a80214189f0dc73b
refs/heads/master
2020-05-27T01:09:51.830208
2015-10-07T22:47:36
2015-10-07T22:47:36
41,942,802
15
20
null
2020-03-09T00:21:03
2015-09-05T00:11:19
null
UTF-8
Java
false
false
2,934
java
package com.bumptech.glide.request; import com.bumptech.glide.request.target.Target; /** * A class for monitoring the status of a request while images load. * * @param <T> The type of the model being loaded. * @param <R> The type of resource being loaded. */ public interface RequestListener<T, R> { /** * Called when an exception occurs during a load. Will only be called if we currently want to display an image * for the given model in the given target. It is recommended to create a single instance per activity/fragment * rather than instantiate a new object for each call to {@code Glide.load()} to avoid object churn. * * <p> * It is safe to reload this or a different model or change what is displayed in the target at this point. * For example: * <pre> * <code> * public void onException(Exception e, ModelType model, Target target) { * target.setPlaceholder(R.drawable.a_specific_error_for_my_exception); * Glide.load(model).into(target); * } * </code> * </pre> * </p> * * <p> * Note - if you want to reload this or any other model after an exception, you will need to include all * relevant builder calls (like centerCrop, placeholder etc). * </p> * * @param e The exception, or null * @param model The model we were trying to load when the exception occurred * @param target The {@link Target} we were trying to load the image into * @return True if the listener has handled updating the target for the given exception, false to allow * Glide's request to update the target. */ public abstract boolean onException(Exception e, T model, Target target, boolean isFirstImage); /** * Called when a load completes successfully, immediately after {@link Target#onResourceReady(Object)}. * * @param resource The resource that was loaded for the target. * @param model The specific model that was used to load the image. * @param target The target the model was loaded into. * @param isFromMemoryCache True if the load completed synchronously (useful for determining whether or not to * animate) * @param isFirstResource True if this is the first resource to in this load to be loaded into the target. For * example when loading a thumbnail and a fullsize image, this will be true for the first * image to load and false for the second. * @return True if the listener has handled setting the resource on the target (including any animations), false to * allow Glide's request to update the target (again including animations). */ public abstract boolean onResourceReady(R resource, T model, Target target, boolean isFromMemoryCache, boolean isFirstResource); }
[ "mirek190@gmail.com" ]
mirek190@gmail.com
c2b08e74edc163b08a029a95f49e767932a0362d
27828ab380d647b3a613a707dc28bbe69161f054
/src/main/java/com/thoughtworks/XMLReader.java
6cae1d0e3b19ef1919c76529ff8e30c8270bba56
[]
no_license
subodhkumarjha/Split-wise
5c69e3a28f35da28e65fdb50fd9d31cd15f6b676
4c6102ab6f98a4248e5261f257f437dc1f378a69
refs/heads/master
2020-05-17T22:27:34.911264
2019-05-16T15:49:46
2019-05-16T15:49:46
184,002,018
0
0
null
null
null
null
UTF-8
Java
false
false
2,939
java
package com.thoughtworks; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.File; public class XMLReader implements Reader { @Override public String read (Transactions transactions) { try { int count=1; DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); // root elements Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("Splitwise"); doc.appendChild(rootElement); for (Transaction transaction : transactions.transactionList) { // staff elements Element staff = doc.createElement ("Transaction"); rootElement.appendChild (staff); // set attribute to staff element Attr attr = doc.createAttribute ("id"); attr.setValue (String.valueOf (count)); count++; staff.setAttributeNode (attr); // Payer elements Element payer = doc.createElement ("Payer"); payer.appendChild (doc.createTextNode (transaction.payer.getName ())); staff.appendChild (payer); // Amount elements Element amount = doc.createElement ("Amount"); amount.appendChild (doc.createTextNode (String.valueOf (transaction.amount))); staff.appendChild (amount); // Payee elements Element payee = doc.createElement ("Payee"); payee.appendChild (doc.createTextNode (transaction.payee.getName ())); staff.appendChild (payee); } // write the content into xml file TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File ("file.xml")); // Output to console for testing // StreamResult result = new StreamResult(System.out); transformer.transform(source, result); System.out.println("File saved!"); } catch (ParserConfigurationException pce) { pce.printStackTrace(); } catch (TransformerException tfe) { tfe.printStackTrace(); } return "XML file reader"; } }
[ "subodh.jha@thoughtworks.com" ]
subodh.jha@thoughtworks.com
9dbea2e49878e08f69e81928d495f4bcd71a0e39
0a93a4d9d190b7ea4fdf41bb2fe6cae01f430d50
/src/main/java/com/excel/eom/util/ExcelSheetUtil.java
8161ea1c82e78fbb38f4d5e2baf9b9f998944704
[]
no_license
sdm-java-tutorial-organization/sdm-java-eom
e077e824cbab3114136b73d3fc3af7501dc33525
fb851241cb48a72b4811e2e56be1fe02762850a2
refs/heads/master
2021-06-14T04:07:46.503103
2019-12-11T04:44:17
2019-12-11T04:44:17
201,831,514
0
0
null
2021-06-07T18:38:17
2019-08-12T00:42:12
Java
UTF-8
Java
false
false
6,599
java
package com.excel.eom.util; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.xssf.usermodel.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class ExcelSheetUtil { private static final Logger logger = LoggerFactory.getLogger(ExcelSheetUtil.class); /** * print * * @param sheet */ public static void print(Sheet sheet) { int rowCount = sheet.getPhysicalNumberOfRows(); Row firstRow = sheet.getRow(0); if(firstRow != null) { int columnCount = sheet.getRow(0).getPhysicalNumberOfCells(); for (int i = 0; i < rowCount; i++) { Row row = sheet.getRow(i); List<Object> rowStorage = new ArrayList<>(); for (int j = 0; j < columnCount; j++) { Cell cell = row.getCell(j); if (cell != null) { Object value = ExcelCellUtil.getCellValue(cell); rowStorage.add(value); } else { rowStorage.add(null); } } System.out.println(Arrays.asList(rowStorage.toArray())); } } } /** * initSheet * * @param book * @param name */ public static Sheet initSheet(Workbook book, String name) { return book.createSheet(name); } /** * getSheet * * @param book * @param name */ public static Sheet getSheet(Workbook book, String name) { return book.getSheet(name); } /** * getSheet * * @param book * @param index */ public static Sheet getSheet(Workbook book, int index) { return book.getSheetAt(index); } /** * getSheets * * @param book * */ public static List<Sheet> getSheets(Workbook book) { List<Sheet> result = new ArrayList<>(); int sheetCount = book.getNumberOfSheets(); for(int i=0; i<sheetCount; i++) { result.add(ExcelSheetUtil.getSheet(book, i)); } return result; } /** * getSheetNames * * @param book * */ public static List<String> getSheetNames(Workbook book) { List<String> result = new ArrayList<>(); int sheetCount = book.getNumberOfSheets(); for(int i=0; i<sheetCount; i++) { result.add(ExcelSheetUtil.getSheet(book, i).getSheetName()); } return result; } /** * getSheetName * * @param sheet * */ public static String getSheetName(Sheet sheet) { return sheet.getSheetName(); } /** * getSheetHeight * * @param sheet */ public static int getSheetHeight(Sheet sheet) { int rowCount = sheet.getPhysicalNumberOfRows(); return rowCount; /*for (int i = 0; i < rowCount; i++) { Row row = ExcelRowUtil.getRow(sheet, i); if (row != null) { Cell cell = ExcelCellUtil.getCell(row, 0); if (cell != null) { String value = (String) ExcelCellUtil.getCellValue(cell); if (value == null || value.equals("")) { CellRangeAddress area = getMergedRegion(sheet, i, 0); if (area == null || area.getFirstRow() == i) { return i; } } } else { return i; } } else { return i; } } return rowCount;*/ } /** * getMergedRegion * * @param sheet * @param rowIdx * @param colIdx */ public static CellRangeAddress getMergedRegion(Sheet sheet, int rowIdx, int colIdx) { for (int i = 0; i < sheet.getNumMergedRegions(); ++i) { CellRangeAddress range = sheet.getMergedRegion(i); if ( rowIdx >= range.getFirstRow() && rowIdx <= range.getLastRow() && colIdx >= range.getFirstColumn() && colIdx <= range.getLastColumn() ) { return range; } } return null; } /** * addRegion * * @param sheet * @param firstRow * @param lastRow * @param firstColumn * @param lastColumn */ public static void addRegion(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn) { CellRangeAddress area = new CellRangeAddress(firstRow, lastRow, firstColumn, lastColumn); sheet.addMergedRegion(area); } public static CellRangeAddressList getRegion(int firstRow, int lastRow, int firstColumn, int lastColumn) { return new CellRangeAddressList(firstRow, lastRow, firstColumn, lastColumn); } public static DataValidationConstraint getDropdown(DataValidationHelper dvHelper, String[] items) { return dvHelper.createExplicitListConstraint(items); } public static void setDropdown(Sheet sheet, DataValidationHelper dvHelper, DataValidationConstraint dropdown, CellRangeAddressList regions) { DataValidation inputDataValidation = dvHelper.createValidation(dropdown, regions); inputDataValidation.setShowErrorBox(true); inputDataValidation.setSuppressDropDownArrow(true); sheet.addValidationData(inputDataValidation); } public static void createFreezePane(Sheet sheet, int fixedColumnCount, int fixedRowCount) { sheet.createFreezePane(fixedColumnCount, fixedRowCount); } }
[ "supermoon@nexon.co.kr" ]
supermoon@nexon.co.kr
0edfce1e61a25f98306949cbf6760d6c71c23308
7fe8b5cb6aa75b2b53463735df587c609e8cf738
/src/test/java/no/java/wiki/atompub/BlogPostTest.java
afba51bb764f62a76df3c43e9e5ef67a2c0d3316
[]
no_license
olemoy/javabin-confluence-tuesdayworkshop
795f203189546412f5b99ae8e425865cad266e40
86e4a9bf5de6541b1f4dc23d79422d0c18974ec9
refs/heads/master
2021-01-22T11:37:08.069119
2012-02-28T22:08:24
2012-02-28T22:08:24
3,575,807
0
0
null
null
null
null
UTF-8
Java
false
false
1,068
java
package no.java.wiki.atompub; import static org.junit.Assert.assertEquals; import org.apache.abdera.model.Entry; import org.joda.time.DateTimeConstants; import org.joda.time.LocalDate; import org.junit.Test; public class BlogPostTest { @Test public void createBasicEntryPostTest() { BlogPost bp = new BlogPost(); LocalDate localNow = new LocalDate(); LocalDate nextTuesday = localNow.plusWeeks(1).withDayOfWeek(DateTimeConstants.TUESDAY); Entry entry = bp.createEntry(nextTuesday); String month = Integer.toString(nextTuesday.getMonthOfYear()); if (nextTuesday.getMonthOfYear() < 10) { month = "0" + nextTuesday.getMonthOfYear(); } String day = Integer.toString(nextTuesday.getDayOfMonth()); if (nextTuesday.getDayOfMonth() < 10) { day = "0" + nextTuesday.getDayOfMonth(); } String title = String.format("Tirsdagsmøte %d-%d-%d",nextTuesday.getYear(),month,day); entry.setContent("Mark\n up"); assertEquals("Title:", title, entry.getTitle()); assertEquals("Content", "Mark\n up", entry.getContent()); } }
[ "olemoy@gmail.com" ]
olemoy@gmail.com
e5004e5f1f2b550c23d5692439c83b9497ae9aef
7e3c91341fd544c3167bfdea28dd72a4aa649268
/docs/smartbuilding/ACM_GeneSIS_Demo_SmartBuilding/ENACTProducer/src/ENACTProducer/model/smoolcore/impl/LogicalLocation.java
4dc947c073eec31c0dc753216cd4cb13ce110e9f
[ "Apache-2.0" ]
permissive
Smart-IoT-Systems/genesis-uca
ab288d77c3a06f0edcc9467321d5666e2176131d
2bc5c30d1197f9b918756fe0d58769e39efea4ab
refs/heads/master
2023-04-16T18:35:47.876190
2021-04-16T04:25:49
2021-04-16T04:25:49
362,912,517
0
0
null
null
null
null
UTF-8
Java
false
false
5,019
java
/******************************************************************************* * Copyright (c) 2018 Tecnalia Research and Innovation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * This file is a result of OWL 2 java transformation using EMF * Contributors: * Enas Ashraf (inas@itida.gov.eg) - creation of level 2 metamodel and transformation to java classes * Adrian Noguero (Tecnalia Research and Innovation - Software Systems Engineering) - creation of level 1 metamodel by creating ... *******************************************************************************/ package ENACTProducer.model.smoolcore.impl; import org.smool.kpi.model.smart.AbstractOntConcept; import org.smool.kpi.model.smart.KPProducer; import org.smool.kpi.model.smart.KPConsumer; import org.smool.kpi.model.smart.slots.FunctionalDatatypeSlot; import org.smool.kpi.model.smart.slots.FunctionalObjectSlot; import ENACTProducer.model.smoolcore.ILogicalLocation; import ENACTProducer.model.smoolcore.impl.LogicalLocation; /** * This class implements the ontology concept LogicalLocation * including all its properties. * @author Genrated via EMF OWL to java transformation * @version 1.0 */ public class LogicalLocation extends AbstractOntConcept implements ILogicalLocation, KPProducer, KPConsumer{ //Not needed.. public static String CLASS_NAMESPACE = "http://com.tecnalia.smool/core/smoolcore#"; //Not needed.. public static String CLASS_ID = "LogicalLocation"; public static String CLASS_IRI = "http://com.tecnalia.smool/core/smoolcore#LogicalLocation"; /** * The Constructor */ public LogicalLocation() { super(); init(); } /** * The Constructor * @param id the Actuator identifier */ public LogicalLocation(String id) { /** Call superclass to establish the identifier */ super(id); init(); } /** * Inits the fields associated to a ontology concept */ public void init() { /** Sets the context of this ontology concept */ this._setClassContext("smoolcore", CLASS_IRI); /** Sets the individual context */ this._setDefaultIndividualContext(); // Creates the dataID property String dataIDIRI = "http://com.tecnalia.smool/core/smoolcore#dataID"; String dataIDPrefix = "smoolcore"; FunctionalDatatypeSlot < String > dataIDSlot= new FunctionalDatatypeSlot<String>(String.class); dataIDSlot._setIRI(dataIDIRI); dataIDSlot._setPrefix(dataIDPrefix); dataIDSlot.setRange("xsd:String"); this._addProperty(dataIDSlot); // Creates the timestamp property String timestampIRI = "http://com.tecnalia.smool/core/smoolcore#timestamp"; String timestampPrefix = "smoolcore"; FunctionalDatatypeSlot < String > timestampSlot= new FunctionalDatatypeSlot<String>(String.class); timestampSlot._setIRI(timestampIRI); timestampSlot._setPrefix(timestampPrefix); timestampSlot.setRange("xsd:String"); this._addProperty(timestampSlot); // Creates the logicalLoc property String logicalLocIRI = "http://com.tecnalia.smool/core/smoolcore#logicalLoc"; String logicalLocPrefix = "smoolcore"; FunctionalObjectSlot < LogicalLocation > logicalLocSlot= new FunctionalObjectSlot<LogicalLocation>(LogicalLocation.class); logicalLocSlot._setIRI(logicalLocIRI); logicalLocSlot._setPrefix(logicalLocPrefix); this._addProperty(logicalLocSlot); } /* * PROPERTIES: GETTERS AND SETTERS */ /** * Sets the dataID property. * @param dataID String value */ public LogicalLocation setDataID(String dataID) { this.updateAttribute("dataID",dataID); return this; } /** * Gets the dataID property. * @return a String value */ public String getDataID() { return (String) this._getFunctionalProperty("dataID").getValue(); } /** * Sets the timestamp property. * @param timestamp String value */ public LogicalLocation setTimestamp(String timestamp) { this.updateAttribute("timestamp",timestamp); return this; } /** * Gets the timestamp property. * @return a String value */ public String getTimestamp() { return (String) this._getFunctionalProperty("timestamp").getValue(); } /** * Sets the logicalLoc property. * @param logicalLoc ILogicalLocation value */ public LogicalLocation setLogicalLoc(ILogicalLocation logicalLoc) { this.updateAttribute("logicalLoc",logicalLoc); return this; } /** * Gets the logicalLoc property. * @return a ILogicalLocation value */ public ILogicalLocation getLogicalLoc() { return (ILogicalLocation) this._getFunctionalProperty("logicalLoc").getValue(); } }
[ "nguyenhongphu@gmail.com" ]
nguyenhongphu@gmail.com
731ea5e4f050cfaaa41fad7e8a40a1ddb300b3e7
ab3790c35cc9d2c26104805eba957fb001e1e657
/app/src/test/java/jiun/com/panda/ExampleUnitTest.java
5908a87e511de2661fde4d316722147f35bc25b0
[]
no_license
H1701/PanDa
53f96dee8597014df68c62de443aecc68d2c39ee
e626b088bb8d994e45f10f8cae7edb22dbeb9244
refs/heads/master
2021-05-16T06:15:40.103218
2017-09-13T13:22:23
2017-09-13T13:22:23
103,402,619
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package jiun.com.panda; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "1455801637@qq.com" ]
1455801637@qq.com
e25b0c0675a18dcd1520fe74cec57c56007e8aef
cfc60fc1148916c0a1c9b421543e02f8cdf31549
/src/testcases/CWE134_Uncontrolled_Format_String/CWE134_Uncontrolled_Format_String__listen_tcp_printf_31.java
2bfd8f95c9907789e33d145dc49fb065564325bf
[ "LicenseRef-scancode-public-domain" ]
permissive
zhujinhua/GitFun
c77c8c08e89e61006f7bdbc5dd175e5d8bce8bd2
987f72fdccf871ece67f2240eea90e8c1971d183
refs/heads/master
2021-01-18T05:46:03.351267
2012-09-11T16:43:44
2012-09-11T16:43:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,422
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__listen_tcp_printf_31.java Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-31.tmpl.java */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: listen_tcp Read data using a listening tcp connection * GoodSource: A hardcoded string * Sinks: printf * GoodSink: dynamic printf format with string defined * BadSink : dynamic printf without validation * Flow Variant: 31 Data flow: make a copy of data within the same method * * */ package testcases.CWE134_Uncontrolled_Format_String; import testcasesupport.*; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; import java.net.Socket; import java.net.ServerSocket; import java.util.logging.Logger; public class CWE134_Uncontrolled_Format_String__listen_tcp_printf_31 extends AbstractTestCase { public void bad() throws Throwable { String data_copy; { String data; Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ /* Read data using a listening tcp connection */ ServerSocket listener = null; Socket sock = null; BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from socket */ listener = new ServerSocket(39543); sock = listener.accept(); instrread = new InputStreamReader(sock.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } /* clean up socket objects */ try { if( sock != null ) { sock.close(); } } catch( IOException e ) { log_bad.warning("Error closing sock"); } finally { try { if( listener != null ) { listener.close(); } } catch( IOException e ) { log_bad.warning("Error closing listener"); } } } data_copy = data; } { String data = data_copy; /* POTENTIAL FLAW: uncontrolled string formatting */ System.out.printf(data); } } public void good() throws Throwable { goodG2B(); goodB2G(); } /* goodG2B() - use goodsource and badsink */ private void goodG2B() throws Throwable { String data_copy; { String data; java.util.logging.Logger log_good = java.util.logging.Logger.getLogger("local-logger"); /* FIX: Use a hardcoded string */ data = "foo"; data_copy = data; } { String data = data_copy; /* POTENTIAL FLAW: uncontrolled string formatting */ System.out.printf(data); } } /* goodB2G() - use badsource and goodsink */ private void goodB2G() throws Throwable { String data_copy; { String data; Logger log_bad = Logger.getLogger("local-logger"); data = ""; /* init data */ /* Read data using a listening tcp connection */ ServerSocket listener = null; Socket sock = null; BufferedReader buffread = null; InputStreamReader instrread = null; try { /* read input from socket */ listener = new ServerSocket(39543); sock = listener.accept(); instrread = new InputStreamReader(sock.getInputStream()); buffread = new BufferedReader(instrread); data = buffread.readLine(); } catch( IOException ioe ) { log_bad.warning("Error with stream reading"); } finally { /* clean up stream reading objects */ try { if( buffread != null ) { buffread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing buffread"); } finally { try { if( instrread != null ) { instrread.close(); } } catch( IOException ioe ) { log_bad.warning("Error closing instrread"); } } /* clean up socket objects */ try { if( sock != null ) { sock.close(); } } catch( IOException e ) { log_bad.warning("Error closing sock"); } finally { try { if( listener != null ) { listener.close(); } } catch( IOException e ) { log_bad.warning("Error closing listener"); } } } data_copy = data; } { String data = data_copy; /* FIX: explicitly defined string formatting */ System.out.printf("%s\n", data); } } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
[ "amitf@chackmarx.com" ]
amitf@chackmarx.com
ecedb86720db428e24901b9866bd17d5baa8b40f
5069d48b4a18f5cd9ffd1842ae4131295ecba0ed
/dionysus/src/main/java/com/aliniribeiro/dionysus/controller/events/contracts/LastSearchDTO.java
e94eef54c3c1a40810469e50aec239fc32fdff9c
[]
no_license
liniribeiro/dionysus
7296446e0cf4d5115d94306f41e117e255d346b2
94309cfbb111dd5e8e9a0d2b9f67315732fd06dc
refs/heads/master
2022-01-08T20:40:16.666792
2019-05-02T22:43:58
2019-05-02T22:43:58
183,855,758
0
1
null
null
null
null
UTF-8
Java
false
false
192
java
package com.aliniribeiro.dionysus.controller.events.contracts; import java.time.LocalDate; public class LastSearchDTO { public String date; public EstablishmentDTO establishment; }
[ "aliniribeiroo@gmail.com" ]
aliniribeiroo@gmail.com
4c8278815052d3764d0bdcbd26434cbf73b287e0
7169ebd69cf098f3e8be2bd5d986d7e55625a949
/app/src/main/java/com/dasteam/quiz/quizgame/gui/quiz/base/BaseFragment.java
155eade9b74c3538dd02eb120d13eeaee13ef032
[]
no_license
mihaiAdascalitei/QuizGame
c14614e714a0807a2e54360dce055e28098c2452
57eebb7b3e8a2dc887265d0628211327be6fbfca
refs/heads/master
2020-04-02T22:08:07.261770
2018-12-29T17:46:32
2018-12-29T17:46:32
154,822,641
0
0
null
2018-12-10T18:12:11
2018-10-26T11:15:06
Java
UTF-8
Java
false
false
888
java
package com.dasteam.quiz.quizgame.gui.quiz.base; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import com.dasteam.quiz.quizgame.gui.quiz.QuizActivity; import com.dasteam.quiz.quizgame.gui.quiz.base.manager.FragmentNavigator; import java.util.Objects; public class BaseFragment extends Fragment { private FragmentNavigator navigator; @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); navigator = new FragmentNavigator(this.getContext()); } protected FragmentNavigator fragmentNavigator() { return this.navigator; } protected void showDelayedAlert(String message) { ((QuizActivity) Objects.requireNonNull(getContext())).showDelayedAlert(message); } }
[ "adascalitei.mihai96@gmail.comn" ]
adascalitei.mihai96@gmail.comn
70b6685728157c02e02bc566749c63371f039baa
b1881a7d7f51c5400c24e393cece7068c68587fd
/chpl/chpl-service/src/main/java/gov/healthit/chpl/certifiedProduct/validation/CertifiedProduct2014Validator.java
d90efcb2f4cb070e3e4527058b4fa92ce6b1e892
[ "BSD-3-Clause", "BSD-2-Clause-Views" ]
permissive
designreuse/chpl-api
2f30e2f4d21bad42ba1906112e4ce05d954f27a3
ef6f199516b457c8f05ccc56d4baa45501ee668b
refs/heads/master
2020-12-24T07:47:32.260908
2016-10-21T13:43:22
2016-10-21T13:43:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,527
java
package gov.healthit.chpl.certifiedProduct.validation; import org.springframework.stereotype.Component; import org.springframework.util.StringUtils; import gov.healthit.chpl.domain.CQMResultDetails; import gov.healthit.chpl.domain.CertificationResult; import gov.healthit.chpl.domain.CertificationResultTestTask; import gov.healthit.chpl.domain.CertifiedProductSearchDetails; import gov.healthit.chpl.dto.PendingCertificationResultDTO; import gov.healthit.chpl.dto.PendingCertifiedProductDTO; import gov.healthit.chpl.dto.PendingCqmCriterionDTO; import gov.healthit.chpl.util.CertificationResultRules; @Component("certifiedProduct2014Validator") public class CertifiedProduct2014Validator extends CertifiedProductValidatorImpl { private static final String[] g1ComplementaryCerts = {"170.314 (a)(1)", "170.314 (a)(3)", "170.314 (a)(4)", "170.314 (a)(5)", "170.314 (a)(6)", "170.314 (a)(7)", "170.314 (a)(9)", "170.314 (a)(11)", "170.314 (a)(12)", "170.314 (a)(13)", "170.314 (a)(14)", "170.314 (a)(15)", "170.314 (a)(18)", "170.314 (a)(19)", "170.314 (a)(20)", "170.314 (b)(2)", "170.314 (b)(3)", "170.314 (b)(4)", "170.314 (e)(1)"}; private static final String[] g2ComplementaryCerts = {"170.314 (a)(1)", "170.314 (a)(3)", "170.314 (a)(4)", "170.314 (a)(5)", "170.314 (a)(6)", "170.314 (a)(7)", "170.314 (a)(9)", "170.314 (a)(11)", "170.314 (a)(12)", "170.314 (a)(13)", "170.314 (a)(14)", "170.314 (a)(15)", "170.314 (a)(18)", "170.314 (a)(19)", "170.314 (a)(20)", "170.314 (b)(2)", "170.314 (b)(3)", "170.314 (b)(4)", "170.314 (e)(1)"}; private static final String[] cqmRequiredCerts = {"170.314 (c)(1)", "170.314 (c)(2)", "170.314 (c)(3)"}; private static final String[] g3ComplementaryCerts = {"170.314 (a)(1)", "170.314 (a)(2)", "170.314 (a)(6)", "170.314 (a)(7)", "170.314 (a)(8)", "170.314 (a)(16)", "170.314 (a)(18)", "170.314 (a)(19)", "170.314 (a)(20)", "170.314 (b)(3)", "170.314 (b)(4)", "170.314 (b)(9)"}; public String[] getG1ComplimentaryCerts() { return g1ComplementaryCerts; } public String[] getG2ComplimentaryCerts() { return g2ComplementaryCerts; } @Override public void validate(PendingCertifiedProductDTO product) { super.validate(product); if(product.getPracticeTypeId() == null) { product.getErrorMessages().add("Practice setting is required but was not found."); } if(product.getProductClassificationId() == null) { product.getErrorMessages().add("Product classification is required but was not found."); } if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("Test Report URL is required but was not found."); } // else if(urlRegex.matcher(product.getReportFileLocation()).matches() == false) { // product.getErrorMessages().add("Test Report URL provided is not a valid URL format."); // } // check cqms boolean isCqmRequired = false; for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { for(int i = 0; i < cqmRequiredCerts.length; i++) { if(cert.getNumber().equals(cqmRequiredCerts[i]) && cert.getMeetsCriteria()) { isCqmRequired = true; } } } if(isCqmRequired) { boolean hasOneCqmWithVersion = false; for(PendingCqmCriterionDTO cqm : product.getCqmCriterion()) { if(cqm.isMeetsCriteria() && !StringUtils.isEmpty(cqm.getVersion())) { hasOneCqmWithVersion = true; } } if(!hasOneCqmWithVersion) { product.getErrorMessages().add("At least one CQM/version is required but was not found."); } } //g4 check boolean hasG4 = false; for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { if(cert.getNumber().equals("170.314 (g)(4)") && cert.getMeetsCriteria()) { hasG4 = true; } } if(!hasG4) { product.getErrorMessages().add("Required certification criteria 170.314 (g)(4) was not found."); } //g3 check boolean hasG3 = false; for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { if(cert.getNumber().equals("170.314 (g)(3)") && cert.getMeetsCriteria()) { hasG3 = true; } } boolean hasG3Complement = false; for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { for(int i = 0; i < g3ComplementaryCerts.length; i++) { if(cert.getNumber().equals(g3ComplementaryCerts[i]) && cert.getMeetsCriteria()) { hasG3Complement = true; } } } if(hasG3 && !hasG3Complement) { product.getErrorMessages().add("(g)(3) was found without a required related certification."); } if(hasG3Complement && !hasG3) { product.getErrorMessages().add("A certification that requires (g)(3) was found but (g)(3) was not."); } } @Override protected void validateDemographics(PendingCertifiedProductDTO product) { super.validateDemographics(product); if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("A test result summary URL is required."); } for(PendingCertificationResultDTO cert : product.getCertificationCriterion()) { if(cert.getMeetsCriteria() != null && cert.getMeetsCriteria() == Boolean.TRUE) { boolean gapEligibleAndTrue = false; if(certRules.hasCertOption(cert.getNumber(), CertificationResultRules.GAP) && cert.getGap() == Boolean.TRUE) { gapEligibleAndTrue = true; } if(certRules.hasCertOption(cert.getNumber(), CertificationResultRules.SED) && cert.getSed() == null) { product.getErrorMessages().add("SED is required for certification " + cert.getNumber() + "."); } if(!gapEligibleAndTrue && certRules.hasCertOption(cert.getNumber(), CertificationResultRules.TEST_DATA) && (cert.getTestData() == null || cert.getTestData().size() == 0)) { product.getErrorMessages().add("Test Data is required for certification " + cert.getNumber() + "."); } } } } @Override public void validate(CertifiedProductSearchDetails product) { super.validate(product); if(product.getPracticeType() == null || product.getPracticeType().get("id") == null) { product.getErrorMessages().add("Practice setting is required but was not found."); } if(product.getClassificationType() == null || product.getClassificationType().get("id") == null) { product.getErrorMessages().add("Product classification is required but was not found."); } if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("Test Report URL is required but was not found."); } // else if(urlRegex.matcher(product.getReportFileLocation()).matches() == false) { // product.getErrorMessages().add("Test Report URL provided is not a valid URL format."); // } //check sed/ucd/tasks for(CertificationResult cert : product.getCertificationResults()) { if(cert.isSed() != null && cert.isSed().booleanValue() == true) { for(CertificationResult certCriteria : product.getCertificationResults()) { if (certCriteria.getTestTasks() != null && certCriteria.getTestTasks().size() > 0){ for(CertificationResultTestTask task : certCriteria.getTestTasks()) { if(task.getTestParticipants() == null || task.getTestParticipants().size() < 5) { product.getWarningMessages().add("A test task for certification " + certCriteria.getNumber() + " requires at least 5 participants."); } } } } } } // check cqms boolean isCqmRequired = false; for(CertificationResult cert : product.getCertificationResults()) { for(int i = 0; i < cqmRequiredCerts.length; i++) { if(cert.getNumber().equals(cqmRequiredCerts[i]) && cert.isSuccess()) { isCqmRequired = true; } } } if(isCqmRequired) { boolean hasOneCqmWithVersion = false; for(CQMResultDetails cqm : product.getCqmResults()) { if(cqm.isSuccess() && cqm.getSuccessVersions() != null && cqm.getSuccessVersions().size() > 0) { hasOneCqmWithVersion = true; } } if(!hasOneCqmWithVersion) { product.getErrorMessages().add("At least one CQM/version is required but was not found."); } } //g4 check boolean hasG4 = false; for(CertificationResult cert : product.getCertificationResults()) { if(cert.getNumber().equals("170.314 (g)(4)") && cert.isSuccess()) { hasG4 = true; } } if(!hasG4) { product.getErrorMessages().add("(g)(4) is required but was not found."); } //g3 check boolean hasG3 = false; for(CertificationResult cert : product.getCertificationResults()) { if(cert.getNumber().equals("170.314 (g)(3)") && cert.isSuccess()) { hasG3 = true; } } boolean hasG3Complement = false; for(CertificationResult cert : product.getCertificationResults()) { for(int i = 0; i < g3ComplementaryCerts.length; i++) { if(cert.getNumber().equals(g3ComplementaryCerts[i]) && cert.isSuccess()) { hasG3Complement = true; } } } if(hasG3 && !hasG3Complement) { product.getErrorMessages().add("(g)(3) was found without a required related certification."); } if(hasG3Complement && !hasG3) { product.getErrorMessages().add("A certification that requires (g)(3) was found but (g)(3) was not."); } } @Override protected void validateDemographics(CertifiedProductSearchDetails product) { super.validateDemographics(product); if(StringUtils.isEmpty(product.getReportFileLocation())) { product.getErrorMessages().add("A test result summary URL is required."); } //this is not supposed to matcht the list of things checked for pending products } }
[ "kekey@ainq.com" ]
kekey@ainq.com
7d90134945ea3eaf89a5f6c04adc1a73abe4ec64
caa294ed781762ea51eae4363ef965e5bef9429f
/src/main/java/com/lee/mybatisplus/generator/extension/injector/methods/additional/AlwaysUpdateSomeColumnById.java
6be65c380a5f34566621b9222c8f00430bf356d8
[]
no_license
l848168/mybatis-generator
e854d877b9cb552aff87d6de284af09141954298
fecb19f476685208c0f797fd8a226c739c99c26a
refs/heads/master
2022-12-26T07:05:10.908962
2019-09-10T09:27:10
2019-09-10T09:27:10
207,206,709
0
0
null
2022-12-15T23:49:36
2019-09-09T02:23:20
Java
UTF-8
Java
false
false
3,110
java
/* * Copyright (c) 2011-2020, baomidou (jobob@qq.com). * <p> * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * <p> * https://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package com.lee.mybatisplus.generator.extension.injector.methods.additional; import com.lee.mybatisplus.generator.core.enums.SqlMethod; import com.lee.mybatisplus.generator.core.injector.AbstractMethod; import com.lee.mybatisplus.generator.core.metadata.TableFieldInfo; import com.lee.mybatisplus.generator.core.metadata.TableInfo; import com.lee.mybatisplus.generator.core.toolkit.sql.SqlScriptUtils; import lombok.AllArgsConstructor; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.experimental.Accessors; import org.apache.ibatis.mapping.MappedStatement; import org.apache.ibatis.mapping.SqlSource; import java.util.function.Predicate; /** * 根据 ID 更新固定的那几个字段(但是不包含逻辑删除) * * <p> * 自己的通用 mapper 如下使用: * <pre> * int alwaysUpdateSomeColumnById(@Param(Constants.ENTITY) T entity); * </pre> * </p> * * <p> 如何筛选字段参考请 {@link InsertBatchSomeColumn} 里面的注释 </p> * * @author hubin * @since 2019-04-12 */ @NoArgsConstructor @AllArgsConstructor public class AlwaysUpdateSomeColumnById extends AbstractMethod { /** * mapper 对应的方法名 */ private static final String MAPPER_METHOD = "alwaysUpdateSomeColumnById"; /** * 字段筛选条件 */ @Setter @Accessors(chain = true) private Predicate<TableFieldInfo> predicate; @Override public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) { SqlMethod sqlMethod = SqlMethod.UPDATE_BY_ID; final String additional = optlockVersion() + tableInfo.getLogicDeleteSql(true, false); String sqlSet = this.filterTableFieldInfo(tableInfo.getFieldList(), getPredicate(), i -> i.getSqlSet(true, ENTITY_DOT), NEWLINE); sqlSet = SqlScriptUtils.convertSet(sqlSet); String sql = String.format(sqlMethod.getSql(), tableInfo.getTableName(), sqlSet, tableInfo.getKeyColumn(), ENTITY_DOT + tableInfo.getKeyProperty(), additional); SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass); return addUpdateMappedStatement(mapperClass, modelClass, MAPPER_METHOD, sqlSource); } private Predicate<TableFieldInfo> getPredicate() { Predicate<TableFieldInfo> noLogic = t -> !t.isLogicDelete(); if (predicate != null) { return noLogic.and(predicate); } return noLogic; } }
[ "you@example.com" ]
you@example.com
3d9c07c8caaa7c07ab7ab732e4d5ec0b966d975e
003be987f36ed4f2c7f5d697f3e601ba62b27a59
/src/main/java/modelo/EvolucaoProposta.java
bf5acf9bd7cc4e03d26bb80a53610f26ff3b4d40
[]
no_license
rdarski/bempromotorabackend
f3a810c9b5df201f0daf6e15dca75754f0a9a72a
ff74816d39adc41ca554d2e2bd26ce356e4b5317
refs/heads/master
2020-06-29T03:54:50.962377
2019-09-21T15:23:46
2019-09-21T15:23:46
200,433,606
3
0
null
2019-08-04T00:35:21
2019-08-04T00:35:20
null
UTF-8
Java
false
false
51
java
package modelo; public class EvolucaoProposta { }
[ "rinaldo@centos2016" ]
rinaldo@centos2016
46e3b7fdf164af4fe18c47a078a8f014479933e9
24240cda715e820b48aa6dc786f8c97aeab1e66d
/src/main/java/com/durga/service/TheaterService.java
1391a036e519bb9c928f08b9827e5eb79bc3e875
[]
no_license
durga-git/theaterseating
61244c164efbe34eec576345338ceae8826a517b
62fe76b7d820b618d6773d72617dbe42a6af3cb2
refs/heads/master
2020-03-23T03:42:42.070379
2018-07-15T17:43:11
2018-07-15T17:43:11
141,044,975
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package com.durga.service; import com.durga.domain.Row; import java.util.List; public interface TheaterService { List<Row> getListOfRows(); int getTheaterCapacity(); TheaterService buildTheater(int[][] theaterBluePrint); void printElements(int[][] layout); int availableSeats(TheaterService theaterService); boolean splitNeeded(int seatsRequested, TheaterService theaterService); @Override String toString(); }
[ "durga.git2018@gmail.com" ]
durga.git2018@gmail.com
7fbe8fedaf488ea63846755d96dd9915de29b4e2
f07858bba0d1a6f5b2df9ecea6cbf96c6136a736
/src/main/java/com/gstrial/matchodds/service/MatchService.java
d6c02002ad90a5f682bea5c3b2963ee291da2df6
[]
no_license
giso360/matchapp
cb13737d6387e3408b8d4f9138cbdd7394100a13
acf9290d43d13a73facbfd6e9034010991ab0d4a
refs/heads/master
2023-04-08T22:48:59.816977
2021-04-27T11:24:07
2021-04-27T11:24:07
362,086,540
0
0
null
null
null
null
UTF-8
Java
false
false
538
java
package com.gstrial.matchodds.service; import com.gstrial.matchodds.dto.MatchInfo; import com.gstrial.matchodds.dto.MatchOddInfo; import com.gstrial.matchodds.entity.Match; import java.util.List; public interface MatchService { List<MatchInfo> getAllMatches(); List<MatchOddInfo> getAllMatchesWithOdds(); MatchOddInfo getOneMatchOddInfo(int matchId); MatchInfo getOneMatchInfo(int matchId); Match addNewMatch(MatchInfo matchInfo); Match updateMatch(Match match, MatchOddInfo matchOddInfo, int matchId); }
[ "gskoufias@cognity.gr" ]
gskoufias@cognity.gr
deaa39cffa37375bdfb57d5fe5685a5515f932e9
121dd1dacec2ac976a20fc489837129d2c65b5ab
/src/com/syntax/class12/StringManipulations.java
9496985037ada506a783dcf8886093696f80e652
[]
no_license
sabah1983/JavaBasic
3797304fd25a04d33e786172aedfb9a1a3fa0646
0051a7fc09312a6a1215b65cf1ad22fdb2e2582f
refs/heads/master
2022-11-07T07:08:16.329128
2020-06-28T22:01:45
2020-06-28T22:01:45
275,675,324
0
0
null
null
null
null
UTF-8
Java
false
false
1,334
java
package com.syntax.class12; public class StringManipulations { public static void main(String[] args) { String str="Good Morning Students!"; System.out.println("----- charAt() FUNCTION -----"); char letter1=str.charAt(0); System.out.println(letter1); char letter5=str.charAt(4); System.out.println("Letter at index 4 is "+letter5+"."); // char someLetter=str.charAt(55);// RunTime Exception --> StringIndexOutOfBoundsException // System.out.println(someLetter); //get all characters 1 by 1 from a String? char letter; for(int i=0; i<str.length(); i++) { letter=str.charAt(i); System.out.print(letter+" "); } System.out.println(); System.out.println("----- indexOf() FUNCTION -----"); String name="Syntax Technologies"; int index=name.indexOf("y"); System.out.println(index); index=name.indexOf(" "); System.out.println(index); index=name.indexOf("Syntax"); System.out.println(index); index=name.indexOf("!"); System.out.println("Index of not existing character="+index); index=name.indexOf("Technologies"); System.out.println("Index of substring Technologies="+index); index=name.indexOf("o"); System.out.println("Index of first o="+index); index=name.indexOf("o", 13); System.out.println("Index of second o="+index); } }
[ "sabahabdaullah@MacBook-Air.hsd1.va.comcast.net" ]
sabahabdaullah@MacBook-Air.hsd1.va.comcast.net
c59d15bd33bec94b9799e08bcc76e51935275ace
d825f39bf2283fc254eaf9f0949945839ae94f1e
/bonal/src/main/java/br/com/empresa/bonal/entidades/Conta.java
845afc52e7b15e7552d9542a2471e24efc2ee657
[]
no_license
joablima/bonal
84f13634c847159128870e1fa6af1c8f206f6de2
a9b2b54d24d3c3c25cd38ef36613f20fe0f03798
refs/heads/master
2021-09-06T17:33:58.997210
2018-02-09T03:30:23
2018-02-09T03:30:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,081
java
package br.com.empresa.bonal.entidades; import java.io.Serializable; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; import javax.validation.constraints.NotNull; import br.com.empresa.bonal.util.enums.EnumStatusPagamento; import br.com.empresa.bonal.util.enums.EnumTipoPagamento; @Entity public class Conta implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotNull @Enumerated(EnumType.STRING) private EnumTipoPagamento tipoDePagamento; @NotNull @Enumerated(EnumType.STRING) private EnumStatusPagamento statusPagamento; private Date vencimento; private String tipo; private BigDecimal precoTotal; @Temporal(TemporalType.DATE) @Column(name = "data_cadastro") private Calendar dataCadastro = Calendar.getInstance(); @Version private Integer version; private Boolean status; public EnumTipoPagamento getTipoDePagamento() { return tipoDePagamento; } public void setTipoDePagamento(EnumTipoPagamento tipoDePagamento) { this.tipoDePagamento = tipoDePagamento; } public String getVencimento() { Calendar c = Calendar.getInstance(); c.setTime(vencimento); SimpleDateFormat fmt = new SimpleDateFormat("dd-MM-yyyy"); fmt.setCalendar(c); String dateFormatted = fmt.format(c.getTime()); return dateFormatted; } public void setVencimento(Date vencimento) { this.vencimento = vencimento; } public BigDecimal getPrecoTotal() { return precoTotal; } public void setPrecoTotal(BigDecimal precoTotal) { this.precoTotal = precoTotal; } public Boolean getStatus() { return status; } public void setStatus(Boolean status) { this.status = status; } public Long getId() { return id; } public Calendar getDataCadastro() { return dataCadastro; } public Integer getVersion() { return version; } public String getTipo() { return tipo; } public void setTipo(String tipo) { this.tipo = tipo; } public EnumStatusPagamento getStatusPagamento() { return statusPagamento; } public void setStatusPagamento(EnumStatusPagamento statusPagamento) { this.statusPagamento = statusPagamento; } @Override public String toString() { return "Conta [id="+ ", tipoDePagamento=" + tipoDePagamento.toString() + ", statusPagamento=" + statusPagamento.toString() + ", vencimento=" + vencimento.toString() + ", precoTotal=" + precoTotal.toString() + ", dataCadastro=" + dataCadastro.toString() + ", version=" + version + ", status=" + status + "]"; } }
[ "vitorhug97@gmail.com" ]
vitorhug97@gmail.com
12d96247ef472dbde0a9bdf6f166db129e73f105
980d0731914e553bcc378d513df11d19ce3bec79
/ICEP/src/main/java/ee/ut/cs/dsg/d2ia/condition/RelativeConditionNew.java
738d50fd466c77ac7e29aaad1277d426115ee1ce
[]
no_license
DataSystemsGroupUT/ICEP
77d9131c538bdfe322d54912d3f50729c055d833
304afbedc5cf184f6a0dbc326274d9a4562be1c9
refs/heads/master
2021-08-04T03:06:54.238924
2021-07-23T18:20:02
2021-07-23T18:20:02
150,234,487
3
2
null
2020-09-04T12:02:54
2018-09-25T08:47:41
Java
UTF-8
Java
false
false
623
java
package ee.ut.cs.dsg.d2ia.condition; public class RelativeConditionNew extends RelativeCondition{ private Expression internalRelativeExpression; public RelativeConditionNew(Expression internalExpression, Expression internalRelativeExpression) { super(internalExpression); this.internalRelativeExpression=internalRelativeExpression; } @Override public Expression getInternalExpression() { return internalRelativeExpression; } @Override public AbsoluteCondition getStartCondition() { return new AbsoluteConditionNew(super.getInternalExpression()); } }
[ "samuele.langhi@mail.polimi.it" ]
samuele.langhi@mail.polimi.it
2d5bba53af799d85f85629be159086a81b817b54
3ddd9780e54a0ae4ee57e5583f2eb359ceb9cadb
/mahasiswa.java
b8bc5a488a1511308f4c248cff72d8ae591ac4f8
[]
no_license
han17/PBO.Basic-Class
d3f5264f1183d160c2b95e2dee8be2ed168aa9ab
235c667c13f5fb46e71c7f77be5287f4b681e887
refs/heads/master
2020-04-25T10:13:06.110694
2015-05-19T16:39:05
2015-05-19T16:39:05
35,894,905
0
0
null
null
null
null
UTF-8
Java
false
false
508
java
public class mahasiswa { private String nama; private int umur; public mahasiswa(String a, int b){ nama = a; umur = b; } public void tampilkanBiodata(){ System.out.println("===BIODATA==="); System.out.println("Nama Mahasiswa ="+nama); System.out.println("Umur Mahasiswa ="+umur); } public String getNama(){ return nama; } public void setNama(String a){ this.nama = a; } public int getUmur(){ return umur; } public void setUmur(int b){ this.umur = b; } }
[ "haniffurqon3@gmail.com" ]
haniffurqon3@gmail.com
3157b98f37023e87de66490df0b329c25bf474a2
8172cbd9661c401c13f684ffb22f8c4fcdaaeead
/BST/src/Node.java
ce42903bcf470ebb57248c8e316260f06a5780ab
[]
no_license
mukthadir/InterviewPreparations
e57d58f9de3570e5f96492e2aea57b93f6f72aee
0ebd15ee9b203b04e11cf75e6419cfb3114fd4a7
refs/heads/master
2021-01-10T06:50:33.683812
2015-12-30T10:41:25
2015-12-30T10:41:25
48,796,133
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
public class Node { private int data; private Node leftChild; private Node rightChild; public Node() { this.data = 0; this.leftChild = null; this.rightChild = null; } public Node(int data) { this.data = data; this.leftChild = null; this.rightChild = null; } public int getData() { return data; } public void setData(int data) { this.data = data; } public Node getLeftChild() { return leftChild; } public void setLeftChild(Node leftChild) { this.leftChild = leftChild; } public Node getRightChild() { return rightChild; } public void setRightChild(Node rightChild) { this.rightChild = rightChild; } }
[ "mukthadir.0611@gmail.com" ]
mukthadir.0611@gmail.com
4422c81e8990fdc294921ab63050fa5a35eb954f
632d5a2828145c4a644861e38d2238292c742cd4
/simplebook_cp_mybatis/src/main/java/com/company/book/BookClient.java
4a66f57436ffce480947448a11dbc5fd2f255508
[]
no_license
ejoo1109/springsource
18801995e5a799d93d4aba943e2676cc44446abd
c4e50849b64430927ceb94be6de5cfc3f41ac10c
refs/heads/master
2023-03-02T06:33:28.475931
2021-02-04T03:56:37
2021-02-04T03:56:37
325,456,514
0
0
null
null
null
null
UTF-8
Java
false
false
1,433
java
package com.company.book; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.company.domain.BookVO; import com.company.service.BookService; import lombok.extern.log4j.Log4j2; @Log4j2 public class BookClient { public static void main(String[] args) { log.info("BookClient 실행"); ApplicationContext ctx = new ClassPathXmlApplicationContext("book_config2.xml"); BookService service = (BookService) ctx.getBean("service"); //도서정보입력 BookVO insertVO = new BookVO(1006,"자바스크립트","정인용",28000); if(service.insertBook(insertVO)) { System.out.println("도서 입력 성공"); } //전체 리스트 가져오기 // List<BookVO> list = service.getList(); // for(BookVO vo:list) { // System.out.println(vo); // } // // 수정 // BookVO vo = new BookVO(); // vo.setCode(1007); // vo.setPrice(10000); // // if (service.updateBook(vo)) { // System.out.println("수정 성공"); // } else { // System.out.println("수정 실패"); // } // // // 삭제 // int deleteBook = 1006; // if (service.deleteBook(deleteBook)) { // System.out.println("삭제 성공"); // } else { // System.out.println("삭제 실패"); // } // // // 개별조회 // BookVO selectBook = service.getRow(1004); // System.out.println("개별조회 : " + selectBook.toString()); } }
[ "you@example.com" ]
you@example.com
4bbf1cbc9899cc8b367247366cf877fa54e0046f
8b292a05ccd21914ee2cbf76a5548f00de1ded77
/src/abc/practice/ABC172/C.java
5eb4f9176766a331f0a5090f53c6d0281fa15ac0
[]
no_license
chiiia12/proconstudy
48fdf077ee10a20f49678e43bd43e533d762b8ab
71d1a78b33735202e34397608f5e02179d5a29d8
refs/heads/master
2023-01-19T10:30:27.402471
2020-11-26T13:18:54
2020-11-26T13:18:54
115,788,057
0
0
null
null
null
null
UTF-8
Java
false
false
1,323
java
package abc.practice.ABC172; import java.util.Scanner; public class C { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); int m = sc.nextInt(); long k = sc.nextLong(); long[] a = new long[n + 1]; long[] b = new long[m + 1]; int max = 0; for (int i = 1; i < n + 1; i++) { a[i] = a[i - 1] + sc.nextLong(); } for (int i = 1; i < m + 1; i++) { b[i] = b[i - 1] + sc.nextLong(); } for (int i = 0; i < n + 1; i++) { long diff = k - a[i]; if (diff > 0) { int ans = binarySearch(0, b.length - 1, diff, b); max = Math.max(i + ans, max); } } System.out.println(max); } private static int binarySearch(int left, int right, long target, long[] arr) { if (right - left <= 1) { if (arr[right] <= target) { return right; } else { return left; } } int mid = left + ((right - left) / 2); if (arr[mid] > target) { return binarySearch(left, mid - 1, target, arr); } else { return binarySearch(mid, right, target, arr); } } }
[ "chiakiyokoo@gmail.com" ]
chiakiyokoo@gmail.com
3e22ce274128bc2e6c60895ee96733de9e1744e6
6511e034b9078be018cb17e7e495128cd4691992
/src/core/Task.java
a6c7111fbf005339b4c4b1fc07e45098874b4d6b
[]
no_license
fallicemoon/jBPM6
64f7d8e2d0a5688e9bb815a3f10e383a5dc3f698
3ac511d6d4f3da0765b950ccf571c385847af9f0
refs/heads/master
2021-01-01T20:41:07.368350
2014-11-26T03:56:17
2014-11-26T03:56:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,506
java
package core; import java.io.BufferedReader; import java.io.IOException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class Task { private JbpmRestEntity jbpmRestEntity; private String baseURL; public Task (JbpmRestEntity jbpmRestEntity) { this.jbpmRestEntity = jbpmRestEntity; this.baseURL = jbpmRestEntity.getBaseURL(); } public JSONObject getAllTasks() throws JSONException { String url = String.format("%s/task/query", baseURL); BufferedReader reader = jbpmRestEntity.connect(url, "GET"); JSONObject json; try { json = new JSONObject(reader.readLine().toString()); } catch (IOException e) { json = new JSONObject(); System.out.println("BufferReader has error......"); json.put("success", "false"); e.printStackTrace(); } JSONObject responseJson = new JSONObject(); JSONArray taskSummaryList = json.getJSONArray("taskSummaryList"); for (int i = 0; i < taskSummaryList.length(); i++) { JSONObject j = taskSummaryList.getJSONObject(i).getJSONObject("task-summary"); responseJson.put(String.valueOf(i+1), j); } return responseJson; } public JSONObject getAllTasks(String ...querys) throws JSONException { String url = null; for (int i = 0; i < querys.length; i++) { String query = querys[i]; url = String.format("%s/task/query?"+query, baseURL); if (i == querys.length-1) break; url = url+"&"; } BufferedReader reader = jbpmRestEntity.connect(url, "GET"); JSONObject json; try { json = new JSONObject(reader.readLine().toString()); } catch (IOException e) { json = new JSONObject(); System.out.println("BufferReader has error......"); json.put("success", "false"); e.printStackTrace(); } JSONObject responseJson = new JSONObject(); JSONArray taskSummaryList = json.getJSONArray("taskSummaryList"); for (int i = 0; i < taskSummaryList.length(); i++) { JSONObject j = taskSummaryList.getJSONObject(i).getJSONObject("task-summary"); responseJson.put(String.valueOf(i+1), j); } return responseJson; } // public JSONObject getAllTasks(String deploymentId, String processDefId) throws JSONException{ // JSONObject json = getAllTasks(); // JSONObject responseJson = new JSONObject(); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // if (!json.getJSONObject(index).getString("deployment-id").equals(deploymentId)){ // continue; // } // if (!json.getJSONObject(index).getString("process-id").equals(processDefId)){ // continue; // } // responseJson.put(String.valueOf(responseJson.length()+1), json.getJSONObject(index)); // } // // return responseJson; // } // public JSONObject getAllTasksByVar(String deploymentId, String processDefId, String key, String value) throws JSONException, IOException{ // JSONObject json = getAllTasks(); // JSONObject tempJson = new JSONObject(); // JSONObject responseJson = new JSONObject(); // Variables variables = new Variables(jbpmRestEntity); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // if (!json.getJSONObject(index).getString("deployment-id").equals(deploymentId)){ // continue; // } // if (!json.getJSONObject(index).getString("process-id").equals(processDefId)){ // continue; // } // tempJson.put(String.valueOf(tempJson.length()+1), json.getJSONObject(index)); // // } // System.out.println(tempJson); // for (int i = 1; i <= tempJson.length(); i++) { // String index = String.valueOf(i); // String taskId = String.valueOf(tempJson.getJSONObject(index).getInt("id")); // // String var = String.valueOf(variables.getTaskVar(deploymentId, taskId).get(key)); // if (var.equals(value)) { // responseJson.put(String.valueOf(responseJson.length()+1), tempJson.getJSONObject(index)); // } // // } // // return responseJson; // } // public JSONObject getAllTasksByTaskName(String deploymentId, String processDefId, String taskName) throws JSONException{ // JSONObject json = getAllTasks(); // JSONObject responseJson = new JSONObject(); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // if (!json.getJSONObject(index).getString("name").equals(taskName)) // continue; // // responseJson.put(String.valueOf(responseJson.length()+1), json.getJSONObject(index)); // } // // return responseJson; // } // public JSONObject getAllTasksByTaskName(String deploymentId, String processDefId, String taskName, TaskStatus status) throws JSONException{ // JSONObject json = getAllTasksByTaskName(deploymentId, processDefId, taskName); // JSONObject responseJson = new JSONObject(); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // if (!json.getJSONObject(index).getString("status").equals(status.toString())) // continue; // // responseJson.put(String.valueOf(responseJson.length()+1), json.getJSONObject(index)); // } // // return responseJson; // } // public JSONObject getAllTasksByApprover(String deploymentId, String processDefId, String approver) throws JSONException{ // JSONObject json = getAllTasks(); // JSONObject responseJson = new JSONObject(); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // String actualOwner; // try { // actualOwner = json.getJSONObject(index).getString("actual-owner"); // } catch (JSONException e) { // actualOwner = ""; // } // // if (!approver.equals(actualOwner)) // continue; // // responseJson.put(String.valueOf(responseJson.length()+1), json.getJSONObject(index)); // } // // return responseJson; // } // // public JSONObject getAllTasksByApprover(String deploymentId, String processDefId, String approver, TaskStatus status) throws JSONException{ // JSONObject json = getAllTasksByTaskName(deploymentId, processDefId, approver); // JSONObject responseJson = new JSONObject(); // // for (int i = 1; i <= json.length(); i++) { // String index = String.valueOf(i); // if (!json.getJSONObject(index).getString("status").equals(status.toString())) // continue; // // responseJson.put(String.valueOf(responseJson.length()+1), json.getJSONObject(index)); // } // // return responseJson; // } public JSONArray getTaskIdsByProcessInstanceId(String processInstanceId) throws IOException, JSONException { JSONObject json = getAllTasks("processInstanceId="+processInstanceId); JSONArray taskIds = new JSONArray(); for(int i=1; i<=json.length(); i++){ JSONObject object = json.getJSONObject(String.valueOf(i)); String procInstId = String.valueOf(object.getInt("process-instance-id")); if(procInstId.equals(processInstanceId)) taskIds.put(String.valueOf(object.getInt("id"))); } return taskIds; } public JSONArray getTaskIdsByProcessInstanceId(String processInstanceId, TaskStatus taskStatus) throws IOException, JSONException { JSONObject json = getAllTasks("processInstanceId="+processInstanceId); JSONArray taskIds = new JSONArray(); for(int i=1; i<=json.length(); i++){ JSONObject object = json.getJSONObject(String.valueOf(i)); String procInstId = String.valueOf(object.getInt("process-instance-id")); if(procInstId.equals(processInstanceId)&&object.getString("status").equals(taskStatus.toString())) taskIds.put(String.valueOf(object.getInt("id"))); } return taskIds; } public JSONObject getTasksByProcessInstanceId(String processInstanceId) throws JSONException, IOException { JSONObject json = getAllTasks("processInstanceId="+processInstanceId); return json; } public JSONObject getTask(String taskId) throws JSONException { String url = String.format("%s/task/%s", baseURL, taskId); BufferedReader reader = jbpmRestEntity.connect(url, "GET"); JSONObject json; try { json = new JSONObject(reader.readLine().toString()); } catch (IOException e) { json = new JSONObject(); System.out.println("BufferReader has error......"); json.put("success", "false"); e.printStackTrace(); } return json; } public JSONObject test() throws JSONException, IOException { String url = String.format("%s/runtime/%s/process/%s/start", baseURL, "com.newegg.fixedAssets:fixedAssets:1.0", "fixedAssets.three_one"); BufferedReader reader = jbpmRestEntity.connect(url, "POST"); JSONObject json = new JSONObject(reader.readLine().toString()); return json; } }
[ "Henry.H.Wu@newegg.com" ]
Henry.H.Wu@newegg.com
b54000ada9bd66a1e6c850d49c5839decebb1226
6358a4a3045de451d9c854dc7c52809dc170f7fa
/src/main/java/spyke/database/repository/UploadRepository.java
b9373ca5ee31ec9ed50b5557a8b2aa0a1689f31e
[ "MIT" ]
permissive
surething-project/spyke
99ad5fd66de9debffd0dfc8d65b53de4a4a13971
738ef194316d998751a0a60571735963d40f6307
refs/heads/master
2023-05-24T21:27:29.085603
2020-03-09T21:00:48
2020-03-09T21:14:07
206,364,917
1
2
MIT
2022-02-10T03:11:34
2019-09-04T16:32:25
Java
UTF-8
Java
false
false
272
java
package spyke.database.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import spyke.database.model.Upload; @Repository public interface UploadRepository extends JpaRepository<Upload, String> { }
[ "shenggwangg@gmail.com" ]
shenggwangg@gmail.com
83102cbf97f38734b3fb5e403b17ed4320fa597b
ccfcc3f6e1f0769a04b249d6faeccb80c6e8fb77
/Chapter 8 Demos/src/ClothingItem.java
5c6fe404f1816000cf5abeb580800530a89998c0
[]
no_license
nnapier/2150demos-s14
49e6fb98541684b039ff3cb324f04b25333c01a8
2a1c34cc21a17684e1bf2a07897bdedbfa3f40e0
refs/heads/master
2016-09-05T16:52:19.056759
2014-04-16T13:27:57
2014-04-16T13:27:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,213
java
/** * Class: ClothingItem * * @author Nannette Napier * @version 1.0 Course: ITEC 2150 Spring 2014 Written: January 10, 2014 * * * This class represents an item of clothing that can be sold in our * store * * Purpose: Represent an item of clothing */ public class ClothingItem { // Instance Variables private String brand; // Brands such as Nike, Addias private String size; // Sizes such as S, M, L, XL private double price; // Price of the clothing item private String color; // Color of the item (such as Red, blue) private String material; // Material of the item (such as cotton) // Constructor(s) public ClothingItem() // No argument constructor { // Initialize all the instance variables brand = "Unknown"; size = "M"; price = 10.34; color = "Red"; material = "cotton"; } // 1) Create a constructor that has only 1 parameter: aBrand. // Set the other instance variables to reasonable default values public ClothingItem(String aBrand) { brand = aBrand; size = "M"; price = 10.34; color = "Red"; material = "cotton"; } // 2) Create a constructor that has 5 parameter variables -- // one for each of the instance variables public ClothingItem(String aBrand, String aSize, double aPrice, String aColor, String aMaterial) { brand = aBrand; size = aSize; price = aPrice; color = aColor; material = aMaterial; } // Getters and Setters /** * @return the brand */ public String getBrand() { return brand; } /** * @return the size */ public String getSize() { return size; } /** * @return the price */ public double getPrice() { return price; } /** * @return the color */ public String getColor() { return color; } /** * @return the material */ public String getMaterial() { return material; } /** * @param brand * the brand to set */ public void setBrand(String brand) { this.brand = brand; } /** * @param size * the size to set */ public void setSize(String size) { this.size = size; } /** * @param price * the price to set */ public void setPrice(double price) { this.price = price; } /** * @param color * the color to set */ public void setColor(String color) { this.color = color; } /** * @param material * the material to set */ public void setMaterial(String material) { this.material = material; } // Instance methods public String toString() { String value = "Brand is " + brand + "\n"; value += "\tSize is " + size + "\n"; value += "\tPrice is " + price + "\n"; value += "\tColor is " + color + "\n"; value += " \tMaterial is " + material + "\n"; return value; } // Create an instance method called computeDiscount. // It takes as a parameter the percentage of the discount // It returns the discounted price. It does not // modify any of the instance variables. public double computeDiscount(double percentage) { // 1 - compute the discounted amount double discount = price * percentage; // 2 - Subtract the discount from the original price // return this value return price - discount; } }
[ "nnapier@ggc.edu" ]
nnapier@ggc.edu
19b5f38ec5f7d6767480e230ec49ad772c9b8832
cba7ac975ec9846ba8ebe14d6c86da407f8fb286
/ObfuscatorPlugin/app/src/main/java/com/helen/obfuscatorplugin/TestAnnotationKeepAll.java
7cf93f1df5994e9fe89818826c9148da4c30a32c
[]
no_license
Hengle/obfuscator-plugin
50616f23a3fb3d428e4c8a10d7e07a74a722de3f
0f6e866fbd75a1cbf77a7d0269cc04ea1552384a
refs/heads/master
2020-06-30T07:36:46.806017
2017-07-19T07:48:33
2017-07-19T07:48:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
847
java
package com.helen.obfuscatorplugin; import com.helen.obfuscator.ObfuscateKeepAll; @ObfuscateKeepAll public class TestAnnotationKeepAll { public String name; public static String sName; private int value; private static int sValue; public String getName() { return name; } public void setName(String name) { this.name = name; } public static String getsName() { return sName; } public static void setsName(String sName) { TestAnnotationKeepAll.sName = sName; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } public static int getsValue() { return sValue; } public static void setsValue(int sValue) { TestAnnotationKeepAll.sValue = sValue; } }
[ "xx.cx@qq.com" ]
xx.cx@qq.com
c423ba50754e6031a81c42016f4fd39780460228
bd877324303e7a3814b047d8673bccba4a437cca
/src/com/kh/mb/member/model/exception/InsertFailException.java
b470ffd9505d882a8b62b46dd06d62f6128d5e79
[]
no_license
JY0819/myBatis
0aef0c7b28d80d759ad41f1f3d527a876eb4c85e
4c4b0014e0f6f8335d0346009689e0648b1b3a22
refs/heads/master
2020-04-17T03:08:18.511092
2019-01-22T01:29:08
2019-01-22T01:29:08
166,168,316
0
0
null
null
null
null
UTF-8
Java
false
false
164
java
package com.kh.mb.member.model.exception; public class InsertFailException extends Exception { public InsertFailException(String msg) { super(msg); } }
[ "user1@KH_C" ]
user1@KH_C
0bb820d0eb5033a36919489646d41720f57a2877
4a66999204cf885b90d5c748cdfd951867cb38e6
/automotive-gateway/src/test/java/com/automotive/gateway/AutomotiveGatewayApplicationTests.java
7b3943152a4b77e68f485d0870336470f775c9d1
[]
no_license
BassamAZ/automotive
252ffe01ec1c2db408a4992f850e204bf3d14e9d
18bdea3cac019c1b7cb80e8dc656d9e79f5c59bd
refs/heads/master
2020-09-11T17:11:38.009401
2019-11-16T13:31:53
2019-11-16T13:31:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.automotive.gateway; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class AutomotiveGatewayApplicationTests { @Test void contextLoads() { } }
[ "mohamed.m.ibrahim84@gmail.com" ]
mohamed.m.ibrahim84@gmail.com
b8da9828e9e2639e41a6455d169f007b34a7d4de
f67798328d748f4f348d6a85c250477745304a9f
/Uri1074.java
f91ed9f8d471682bc3c4b370d698be9866145764
[]
no_license
laislaram/cursojavaitau
6b6e105896175ae02b6c05ac6445c7af91f7038c
76f123a0f7b071d6d769331266033f99c325a891
refs/heads/master
2023-01-25T05:18:13.382409
2020-12-04T18:40:29
2020-12-04T18:40:29
318,600,995
0
0
null
null
null
null
UTF-8
Java
false
false
743
java
import java.util.Scanner; public class Uri1074{ public static void main(String args[]){ Scanner teclado = new Scanner(System.in); int qtd,valor; qtd = teclado.nextInt(); for (int cont=1; cont<=qtd; cont++){ valor = teclado.nextInt(); if ( (valor > 0) && (valor%2 == 0) ){ System.out.println("EVEN POSITIVE");} else if ( (valor < 0) && (valor%2 == 0) ){ System.out.println("EVEN NEGATIVE");} else if ( (valor > 0) && (valor%2 != 0) ){ System.out.println("ODD POSITIVE");} else if ( (valor < 0) && (valor%2 != 0) ){ System.out.println("ODD NEGATIVE");} else if ( valor == 0 ){ System.out.println("NULL");} }}}
[ "987287136@itaud.des.ihf" ]
987287136@itaud.des.ihf
7697dc731e7bf9fe6d0767bc4fce3d1d8a103752
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/DeleteStreamRequest.java
e657625f61388b2d53570075974f07e3194019d3
[ "Apache-2.0" ]
permissive
aws/aws-sdk-java
2c6199b12b47345b5d3c50e425dabba56e279190
bab987ab604575f41a76864f755f49386e3264b4
refs/heads/master
2023-08-29T10:49:07.379135
2023-08-28T21:05:55
2023-08-28T21:05:55
574,877
3,695
3,092
Apache-2.0
2023-09-13T23:35:28
2010-03-22T23:34:58
null
UTF-8
Java
false
false
7,775
java
/* * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.kinesisvideo.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.AmazonWebServiceRequest; /** * * @see <a href="http://docs.aws.amazon.com/goto/WebAPI/kinesisvideo-2017-09-30/DeleteStream" target="_top">AWS API * Documentation</a> */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class DeleteStreamRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable { /** * <p> * The Amazon Resource Name (ARN) of the stream that you want to delete. * </p> */ private String streamARN; /** * <p> * Optional: The version of the stream that you want to delete. * </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. * </p> */ private String currentVersion; /** * <p> * The Amazon Resource Name (ARN) of the stream that you want to delete. * </p> * * @param streamARN * The Amazon Resource Name (ARN) of the stream that you want to delete. */ public void setStreamARN(String streamARN) { this.streamARN = streamARN; } /** * <p> * The Amazon Resource Name (ARN) of the stream that you want to delete. * </p> * * @return The Amazon Resource Name (ARN) of the stream that you want to delete. */ public String getStreamARN() { return this.streamARN; } /** * <p> * The Amazon Resource Name (ARN) of the stream that you want to delete. * </p> * * @param streamARN * The Amazon Resource Name (ARN) of the stream that you want to delete. * @return Returns a reference to this object so that method calls can be chained together. */ public DeleteStreamRequest withStreamARN(String streamARN) { setStreamARN(streamARN); return this; } /** * <p> * Optional: The version of the stream that you want to delete. * </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. * </p> * * @param currentVersion * Optional: The version of the stream that you want to delete. </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. */ public void setCurrentVersion(String currentVersion) { this.currentVersion = currentVersion; } /** * <p> * Optional: The version of the stream that you want to delete. * </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. * </p> * * @return Optional: The version of the stream that you want to delete. </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. */ public String getCurrentVersion() { return this.currentVersion; } /** * <p> * Optional: The version of the stream that you want to delete. * </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. * </p> * * @param currentVersion * Optional: The version of the stream that you want to delete. </p> * <p> * Specify the version as a safeguard to ensure that your are deleting the correct stream. To get the stream * version, use the <code>DescribeStream</code> API. * </p> * <p> * If not specified, only the <code>CreationTime</code> is checked before deleting the stream. * @return Returns a reference to this object so that method calls can be chained together. */ public DeleteStreamRequest withCurrentVersion(String currentVersion) { setCurrentVersion(currentVersion); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getStreamARN() != null) sb.append("StreamARN: ").append(getStreamARN()).append(","); if (getCurrentVersion() != null) sb.append("CurrentVersion: ").append(getCurrentVersion()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DeleteStreamRequest == false) return false; DeleteStreamRequest other = (DeleteStreamRequest) obj; if (other.getStreamARN() == null ^ this.getStreamARN() == null) return false; if (other.getStreamARN() != null && other.getStreamARN().equals(this.getStreamARN()) == false) return false; if (other.getCurrentVersion() == null ^ this.getCurrentVersion() == null) return false; if (other.getCurrentVersion() != null && other.getCurrentVersion().equals(this.getCurrentVersion()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getStreamARN() == null) ? 0 : getStreamARN().hashCode()); hashCode = prime * hashCode + ((getCurrentVersion() == null) ? 0 : getCurrentVersion().hashCode()); return hashCode; } @Override public DeleteStreamRequest clone() { return (DeleteStreamRequest) super.clone(); } }
[ "" ]
1f22b69165dcbd4d07c4e195d8bfc0463c2f847e
f0c8d1c3aea28146a8d78de5e78c00891733ebe5
/src/main/java/pl/edu/pw/mini/sozpw/webinterface/ui/dialogs/NoteDetailsGenerated.java
3bec375876082defd4f5c0771945e69bc05aa351
[]
no_license
pawel001/sozpwinterface
27d8799c994fa7e30f2e458f8c80196bb28e8db3
954bb66e18da04bb6ff98d558be95026b1dd7484
refs/heads/master
2021-01-11T18:19:33.939508
2013-01-09T10:38:11
2013-01-09T10:38:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,019
java
package pl.edu.pw.mini.sozpw.webinterface.ui.dialogs; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlexTable; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.TextBox; public class NoteDetailsGenerated extends Composite { private TextBox dedicationTextBox; private TextBox latLngTextBox; private TextBox locationTextBox; private FlowPanel attachmentDiv; private Button okButton; private TextBox categoryTextBox; private TextBox expiryDateTextBox; private TextBox createDateTextBox; public NoteDetailsGenerated() { FlowPanel flowPanel = new FlowPanel(); initWidget(flowPanel); FlexTable flexTable_1 = new FlexTable(); flowPanel.add(flexTable_1); FlexTable flexTable = new FlexTable(); flexTable.setStyleName("gwt-NoteDetailsTopTable"); flexTable_1.setWidget(0, 0, flexTable); Label lblWsprzdne = new Label("Współrzędne"); lblWsprzdne.setStyleName("gwt-LabelCustom"); lblWsprzdne.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); flexTable.setWidget(0, 0, lblWsprzdne); flexTable.getCellFormatter().setWidth(0, 0, "100px"); latLngTextBox = new TextBox(); latLngTextBox.setStyleName("gwt-TextArea300"); latLngTextBox.setReadOnly(true); flexTable.setWidget(0, 1, latLngTextBox); latLngTextBox.setWidth("100%"); Label lblLokacja = new Label("Lokacja"); lblLokacja.setStyleName("gwt-LabelCustom"); lblLokacja.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); flexTable.setWidget(1, 0, lblLokacja); locationTextBox = new TextBox(); locationTextBox.setStyleName("gwt-TextArea300"); locationTextBox.setReadOnly(true); flexTable.setWidget(1, 1, locationTextBox); locationTextBox.setWidth("100%"); flexTable.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT); FlexTable flexTable_2 = new FlexTable(); flexTable_2.setStyleName("gwt-NoteDetailsMiddleTable"); flexTable_1.setWidget(1, 0, flexTable_2); Label lblKategoria = new Label("Kategoria"); flexTable_2.setWidget(0, 0, lblKategoria); flexTable_2.getCellFormatter().setWidth(0, 0, "100px"); lblKategoria.setStyleName("gwt-LabelCustom"); lblKategoria.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); categoryTextBox = new TextBox(); flexTable_2.setWidget(0, 1, categoryTextBox); categoryTextBox.setReadOnly(true); categoryTextBox.setStyleName("gwt-TextArea300"); categoryTextBox.setWidth("100%"); Label lblStworzona = new Label("Stworzona"); flexTable_2.setWidget(1, 0, lblStworzona); lblStworzona.setStyleName("gwt-LabelCustom"); lblStworzona.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); createDateTextBox = new TextBox(); flexTable_2.setWidget(1, 1, createDateTextBox); createDateTextBox.setReadOnly(true); createDateTextBox.setStyleName("gwt-TextArea300"); createDateTextBox.setWidth("100%"); Label lblWygasa = new Label("Wygasa"); flexTable_2.setWidget(2, 0, lblWygasa); lblWygasa.setStyleName("gwt-LabelCustom"); lblWygasa.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); expiryDateTextBox = new TextBox(); flexTable_2.setWidget(2, 1, expiryDateTextBox); expiryDateTextBox.setReadOnly(true); expiryDateTextBox.setStyleName("gwt-TextArea300"); expiryDateTextBox.setWidth("100%"); Label lblSkierowanaDo = new Label("Skierowana do"); flexTable_2.setWidget(3, 0, lblSkierowanaDo); lblSkierowanaDo.setStyleName("gwt-LabelCustom"); lblSkierowanaDo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); dedicationTextBox = new TextBox(); flexTable_2.setWidget(3, 1, dedicationTextBox); dedicationTextBox.setStyleName("gwt-TextArea300"); dedicationTextBox.setReadOnly(true); dedicationTextBox.setWidth("100%"); Label lblZacznik = new Label("Załącznik"); flexTable_2.setWidget(4, 0, lblZacznik); lblZacznik.setStyleName("gwt-LabelCustom"); lblZacznik.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); attachmentDiv = new FlowPanel(); attachmentDiv.setStyleName("gwt-NoteDetailsAttachment"); flexTable_2.setWidget(4, 1, attachmentDiv); okButton = new Button("OK"); okButton.setStyleName("gwt-ButtonCustom"); flexTable_1.setWidget(2, 0, okButton); okButton.setSize("100%", "30px"); } public TextBox getDedicationTextBox() { return dedicationTextBox; } public TextBox getLatLngTextBox() { return latLngTextBox; } public TextBox getLocationTextBox() { return locationTextBox; } public FlowPanel getAttachmentDiv() { return attachmentDiv; } public Button getOkButton() { return okButton; } public TextBox getCategoryTextBox() { return categoryTextBox; } public TextBox getExpiryDateTextBox() { return expiryDateTextBox; } public TextBox getCreateDateTextBox() { return createDateTextBox; } }
[ "klimekpawel@gmail.com" ]
klimekpawel@gmail.com
d3172f4811c5f9bd1884817fb9048afa9da9667f
b64fd29d2a81b8661bbb17bca2dd528f9b2c95e4
/app/src/main/java/com/wanguanjinrong/mobile/wanguan/main/my/zhuanrang/ZhuanrangDetailFragment.java
4987cb3434235517a01cde483397fb20481b525e
[]
no_license
scimmia/Wan
4016266f7514d19831bd9334bd2af058f7347c9d
dba2077acaf4a083f49317fdee26ce8a25d0eee6
refs/heads/master
2020-04-06T07:10:40.035369
2017-07-12T01:13:46
2017-07-12T01:13:46
62,292,580
0
0
null
null
null
null
UTF-8
Java
false
false
7,063
java
package com.wanguanjinrong.mobile.wanguan.main.my.zhuanrang; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; import android.widget.Button; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; import com.google.gson.Gson; import com.squareup.otto.Subscribe; import com.wanguanjinrong.mobile.wanguan.R; import com.wanguanjinrong.mobile.wanguan.bean.Login; import com.wanguanjinrong.mobile.wanguan.bean.UcTransfer; import com.wanguanjinrong.mobile.wanguan.uitls.Global; import com.wanguanjinrong.mobile.wanguan.uitls.Utils; import com.wanguanjinrong.mobile.wanguan.uitls.eventbus.event.FragmentFinishEvent; import com.wanguanjinrong.mobile.wanguan.uitls.http.HttpListener; import com.wanguanjinrong.mobile.wanguan.uitls.ui.BaseFragment; import org.apache.commons.lang3.StringUtils; import java.util.HashMap; /** * Created by A on 2016/8/31. */ public class ZhuanrangDetailFragment extends BaseFragment { String title; String url; protected Unbinder unbinder; @BindView(R.id.tb_dingqi_detail) Toolbar mToolbar; @BindView(R.id.wv_dingqi_detail) WebView mWvDingqiDetail; @BindView(R.id.btn_dingqi_buy) Button mBtnDingqiBuy; private UcTransfer.ItemBean mItemBean; int mFragmentType; public static ZhuanrangDetailFragment newInstance(UcTransfer.ItemBean itemBean,int fragmentType) { ZhuanrangDetailFragment fragment = new ZhuanrangDetailFragment(); Bundle args = new Bundle(); args.putString("args", new Gson().toJson(itemBean)); args.putInt("fragmenttype",fragmentType); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = getArguments(); if (bundle != null &&bundle.containsKey("args")){ mItemBean = new Gson().fromJson(bundle.getString("args"),UcTransfer.ItemBean.class); title = mItemBean.getName(); url = mItemBean.getApp_url(); } if (bundle != null &&bundle.containsKey("fragmenttype")){ mFragmentType = bundle.getInt("fragmenttype",Global.typeTransferMyList); } } private void initView(View view) { mToolbar.setTitle(title); mToolbar.setBackgroundColor(Global.Toolbar_Color_Red); mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pop(); } }); mWvDingqiDetail.loadUrl(url); mBtnDingqiBuy.setVisibility(View.GONE); if (mFragmentType == Global.typeTransferMyList){ switch (mItemBean.getTras_status_op()){ case 1: mBtnDingqiBuy.setText("转让"); mBtnDingqiBuy.setVisibility(View.VISIBLE); break; case 2: mBtnDingqiBuy.setText("还款完毕"); break; case 3: mBtnDingqiBuy.setText("逾期还款"); break; case 4: mBtnDingqiBuy.setText("重转让"); mBtnDingqiBuy.setVisibility(View.VISIBLE); break; case 5: mBtnDingqiBuy.setText("完成"); break; case 6: mBtnDingqiBuy.setText("撤销"); mBtnDingqiBuy.setVisibility(View.VISIBLE); break; } mBtnDingqiBuy.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { switch (mItemBean.getTras_status_op()){ case 1: case 4: start(ZhuanrangSellFragment.newInstance(mItemBean)); break; case 6: Login login = Utils.getLoginInfo(_mActivity); if (login != null) { HashMap<String, String> map = new HashMap<>(); map.put("uid", login.getId() + ""); map.put("email", login.getUser_name()); map.put("pwd", login.getUser_pwd()); map.put("dltid", mItemBean.getDltid()); http(Global.uc_do_reback_MSG, Global.uc_do_reback_TAG, new Gson().toJson(map), new HttpListener() { @Override public void onSuccess(String tag, String content) { if (StringUtils.isEmpty(content)) { showToast("网络连接错误,请稍后重试。"); } else { Login bean = new Gson().fromJson(content, Login.class); if (bean.getResponse_code() != 1) { showToast(bean.getShow_err()); } else { if (bean.getUser_login_status() != 1) { showToast(bean.getShow_err()); } else { showToast(bean.getShow_err()); popResult(Global.popEvent.MyZhuanrangDetail); } } } } }); } break; } } }); } } @Subscribe public void onPopEvent(FragmentFinishEvent event) { if (event != null) { switch (event.getPopEvent()){ case MyZhuanrangSell: popResult(Global.popEvent.MyZhuanrangDetail); break; } } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_dingqi_detail, container, false); unbinder = ButterKnife.bind(this, view); initView(view); return view; } @Override public void onDestroyView() { super.onDestroyView(); if (unbinder != null) { unbinder.unbind(); } } }
[ "affe@live.cn" ]
affe@live.cn
2f00eb986b83dbdad918947cc545333ee0fd7979
dda6f2dd858614a7f3a4cffcda7f955ef1fa9a06
/Local/src/Local/EmailSendingServlet.java
04bbb3e9b0f523ff9a1d1d81120ae784b3ff134a
[]
no_license
guravkrishna/inventdial
aa19dfcf4869c2f89f046bb4be58e6f8065cf70d
0a34e69ce25a736babba5a819b2fcf4f145f066b
refs/heads/master
2020-03-25T05:07:43.652307
2018-08-11T12:33:22
2018-08-11T12:33:22
143,430,570
0
0
null
null
null
null
UTF-8
Java
false
false
2,330
java
package Local; import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class EmailSendingServlet */ //@WebServlet("/EmailSendingServlet") public class EmailSendingServlet extends HttpServlet { private String host; private String port; private String user; private String pass; public void init() { // reads SMTP server setting from web.xml file ServletContext context = getServletContext(); host = context.getInitParameter("host"); port = context.getInitParameter("port"); user = context.getInitParameter("user"); pass = context.getInitParameter("pass"); } private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EmailSendingServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub String recipient = request.getParameter("recipient"); String subject = request.getParameter("subject"); String content = request.getParameter("content"); String resultMessage = ""; try { EmailUtility.sendEmail(host, port, user, pass, recipient, subject, content); resultMessage = "The e-mail was sent successfully"; } catch (Exception ex) { ex.printStackTrace(); resultMessage = "There were an error: " + ex.getMessage(); } finally { request.setAttribute("Message", resultMessage); getServletContext().getRequestDispatcher("/Result.jsp").forward( request, response); } } }
[ "admin@Rahul_Rock" ]
admin@Rahul_Rock
8124cfe95a73e948159ff511f58015a26b51332d
e6970ded4d351213daf7a688286cfd31a1413055
/src/model/Kava.java
882e3b59424a391252ebbff5a6a4eef9b99ecd7b
[]
no_license
eimataras/Kavos_aparatas
0bf8f13509188d5e4e81ae932d630aad2e4cdaa6
02788f4fd20aab2590a35d3c811ec243bda07a33
refs/heads/master
2020-12-09T12:38:07.083064
2020-01-11T22:36:16
2020-01-11T22:36:16
233,305,766
0
0
null
null
null
null
UTF-8
Java
false
false
893
java
package model; public class Kava { private String name; private Float sugar; private Float water; private Float coffee; public Kava(String parName, Float parSugar, Float parWater, Float parCoffee) { this.name = parName; this.sugar = parSugar; this.water = parWater; this.coffee = parCoffee; } public String getName() { return name; } public Float getCoffee() { return coffee; } public Float getWater() { return water; } public Float getSugar() { return sugar; } public void setName(String name) { this.name = name; } public void setCoffee(Float coffee) { this.coffee = coffee; } public void setSugar(Float sugar) { this.sugar = sugar; } public void setWater(Float water) { this.water = water; } }
[ "eimataras@gmail.com" ]
eimataras@gmail.com
32f747e57abe69038958165119046f8c6938b348
318e7b7c1148982fc70cfe0f9fb2a52ad83b4cb2
/src/main/java/com/cg/exception/ValidateException.java
815821d48da030d25143931ca38021c6887e3003
[]
no_license
sudheersai87/test
2962199a5f8c8486f3b11716245cdb538755ad24
f45cc22037d4d28189ea0a70aa83ccfe89b4a020
refs/heads/master
2021-01-06T12:30:21.648294
2020-02-18T13:14:28
2020-02-18T13:14:28
241,326,487
0
0
null
null
null
null
UTF-8
Java
false
false
161
java
package com.cg.exception; public class ValidateException extends Exception{ public ValidateException(String message) { super(message); } }
[ "HP@172.26.130.195" ]
HP@172.26.130.195
f609b3f9109bfaa2528fc281e65b069523482c5a
a164ade08549ff3dc6fa14901a035c9dd1933a3e
/src/main/java/com/demo/thalisson/service/mapper/ClienteMapper.java
0b28c0e8a34bab94828c5bb8cd3df8ced713a1c8
[]
no_license
salusou/demo-jhipster
4cad7a90bf20e8ff6686765d885fc49d8cf156f1
bbc6f6f8df4771ba2621158f4685409b36fbcf7c
refs/heads/main
2023-06-25T16:31:04.988069
2021-07-28T13:57:42
2021-07-28T13:57:42
390,366,717
0
0
null
2021-07-28T13:57:42
2021-07-28T13:45:44
Java
UTF-8
Java
false
false
487
java
package com.demo.thalisson.service.mapper; import com.demo.thalisson.domain.*; import com.demo.thalisson.service.dto.ClienteDTO; import org.mapstruct.*; /** * Mapper for the entity {@link Cliente} and its DTO {@link ClienteDTO}. */ @Mapper(componentModel = "spring", uses = { CompraMapper.class }) public interface ClienteMapper extends EntityMapper<ClienteDTO, Cliente> { @Mapping(target = "compra", source = "compra", qualifiedByName = "id") ClienteDTO toDto(Cliente s); }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
22077f338ccdd3449b75e7dba332ee1df1eb1fe8
3fd66b43698a89035f63c1acecb4cdfe9d531b55
/br.ufes.inf.sml.generate/src/br/ufes/inf/sml/generate/Activator.java
cb4fb071534db3025bb324688ead70878494a170
[]
no_license
jpalmeida/SML
7266c7182c28e9ce08b32044c7b6cd3b65236d99
9caa8f0b0a0b112d3dd46accf1e802b5d6fc29af
refs/heads/master
2021-01-18T00:12:35.046247
2012-09-11T11:40:43
2012-09-11T11:40:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,664
java
/******************************************************************************* * Copyright (c) 2008, 2011 Obeo. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Obeo - initial API and implementation *******************************************************************************/ package br.ufes.inf.sml.generate; import org.eclipse.core.runtime.Plugin; import org.osgi.framework.BundleContext; /** * The activator class controls the plug-in life cycle. */ public class Activator extends Plugin { /** * The plug-in ID. */ public static final String PLUGIN_ID = "br.inf.ufes.br.sml"; /** * The shared instance. */ private static Activator plugin; /** * The constructor. */ public Activator() { } /** * {@inheritDoc} * * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) */ public void start(BundleContext context) throws Exception { super.start(context); plugin = this; } /** * {@inheritDoc} * * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) */ public void stop(BundleContext context) throws Exception { plugin = null; super.stop(context); } /** * Returns the shared instance. * * @return the shared instance */ public static Activator getDefault() { return plugin; } }
[ "izontm@gmail.com" ]
izontm@gmail.com
6a73a38908a53c7eef210250282f748a843f42c9
cd6ba5bcfbcde0719d7f965571576fd82c8608fa
/HybridFrameWork/src/test/java/com/guru99bank/utilities/ConfigReader.java
534d0714050ca28e54b4f0ff0bb2836496350591
[]
no_license
kunal7384/HybridFramework
e5cb6d7767bcb547d862eacb90cf084f5cac9e41
a2d21ae8068c1768ba7482f0a78b904c286cec59
refs/heads/master
2020-03-31T20:22:11.090511
2018-12-14T10:39:21
2018-12-14T10:39:21
152,537,149
0
0
null
null
null
null
UTF-8
Java
false
false
1,290
java
package com.guru99bank.utilities; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; public class ConfigReader { File file ; FileInputStream fis ; Properties pro; public ConfigReader() { try { file = new File("F:\\Selemnium Practice code Aug 2018\\HybridFrameWork\\config\\config.properties"); fis = new FileInputStream(file); pro = new Properties(); pro.load(fis); } catch (IOException e) { e.printStackTrace(); } } public String getUsername() { String name = pro.getProperty("Username"); return name; } public String getPassword() { String Pass = pro.getProperty("Password"); return Pass; } public String getBaseurl() { String url = pro.getProperty("baseUrl"); return url; } // For Extent Report public String gextentReport() { String extent_report_path =pro.getProperty("extentpath"); if(extent_report_path!= null) return extent_report_path; else throw new RuntimeException("Report Config Path not specified in the Configuration.properties file for the Key:extent_report_path"); } }
[ "kunal.dhote7799@gmail.com" ]
kunal.dhote7799@gmail.com
e53de2b4fc6d3bde56e5b27e0b5d025ea31432f7
c9903bec3b62796578639f027541075eadde19d8
/app/src/main/java/com/example/mike/mta_testing/MainActivity.java
b4e196a58d92a7401682135e1468db65fcf4a0e8
[]
no_license
mpersaud/mtaApp
25af0a8f3b0d263280c5c35ca9547bfe2bd4668f
3e4c9aa1c1582b1a33b9c23033c36c98c01b4265
refs/heads/master
2021-03-19T15:31:12.272996
2017-11-13T12:05:06
2017-11-13T12:05:06
110,539,429
0
0
null
null
null
null
UTF-8
Java
false
false
1,774
java
package com.example.mike.mta_testing; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.List; public class MainActivity extends AppCompatActivity { List<String> complaints= new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent i = getIntent(); String s = i.getStringExtra("markerTitle"); setContentView(R.layout.activity_main2); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); toolbar.setTitle(s); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(true); ListView mylist = (ListView)findViewById(R.id.listView); for(int j =0; j<100;j++){ complaints.add(String.valueOf(j)); } ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(getApplicationContext(), android.R.layout.simple_expandable_list_item_1,complaints); mylist.setAdapter(arrayAdapter); } @Override public boolean onOptionsItemSelected(MenuItem item) { // handle arrow click here if (item.getItemId() == android.R.id.home) { finish(); // close this activity and return to preview activity (if there is any) } return super.onOptionsItemSelected(item); } }
[ "michaelpersaud711@gmail.com" ]
michaelpersaud711@gmail.com
37b41008034192dda9886485dd0e001c7a392082
c03cdbfa5ec5016fb15362266464ffa22d03010d
/module_aliyun/src/main/java/com/wxjz/module_aliyun/NineGridView/gallery/VersionedGestureDetector.java
61c211dcb7d9209d2c56810ddf26bf76f8fded07
[]
no_license
yangyuqi/mvp-demo-co
7263c0a8876fe3938c76ed83397436913a7d7fd6
663484ded65daa611341c0bfd31f552a5d2d7154
refs/heads/master
2020-12-02T12:27:59.174932
2019-12-31T01:48:22
2019-12-31T01:48:22
231,006,261
0
0
null
null
null
null
UTF-8
Java
false
false
7,477
java
package com.wxjz.module_aliyun.NineGridView.gallery; /******************************************************************************* * Copyright 2011, 2012 Chris Banes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ import android.annotation.TargetApi; import android.content.Context; import android.os.Build; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector.OnScaleGestureListener; import android.view.VelocityTracker; import android.view.ViewConfiguration; public abstract class VersionedGestureDetector { static final String LOG_TAG = "VersionedGestureDetector"; OnGestureListener mListener; public static VersionedGestureDetector newInstance(Context context, OnGestureListener listener) { final int sdkVersion = Build.VERSION.SDK_INT; VersionedGestureDetector detector = null; if (sdkVersion < Build.VERSION_CODES.ECLAIR) { detector = new CupcakeDetector(context); } else if (sdkVersion < Build.VERSION_CODES.FROYO) { detector = new EclairDetector(context); } else { detector = new FroyoDetector(context); } detector.mListener = listener; return detector; } public abstract boolean onTouchEvent(MotionEvent ev); public abstract boolean isScaling(); public static interface OnGestureListener { public void onDrag(float dx, float dy); public void onFling(float startX, float startY, float velocityX, float velocityY); public void onScale(float scaleFactor, float focusX, float focusY); } private static class CupcakeDetector extends VersionedGestureDetector { float mLastTouchX; float mLastTouchY; final float mTouchSlop; final float mMinimumVelocity; public CupcakeDetector(Context context) { final ViewConfiguration configuration = ViewConfiguration.get(context); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mTouchSlop = configuration.getScaledTouchSlop(); } private VelocityTracker mVelocityTracker; private boolean mIsDragging; float getActiveX(MotionEvent ev) { return ev.getX(); } float getActiveY(MotionEvent ev) { return ev.getY(); } public boolean isScaling() { return false; } @Override public boolean onTouchEvent(MotionEvent ev) { switch (ev.getAction()) { case MotionEvent.ACTION_DOWN: { mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(ev); mLastTouchX = getActiveX(ev); mLastTouchY = getActiveY(ev); mIsDragging = false; break; } case MotionEvent.ACTION_MOVE: { final float x = getActiveX(ev); final float y = getActiveY(ev); final float dx = x - mLastTouchX, dy = y - mLastTouchY; if (!mIsDragging) { // Use Pythagoras to see if drag length is larger than // touch slop mIsDragging = Math.sqrt((dx * dx) + (dy * dy)) >= mTouchSlop; } if (mIsDragging) { mListener.onDrag(dx, dy); mLastTouchX = x; mLastTouchY = y; if (null != mVelocityTracker) { mVelocityTracker.addMovement(ev); } } break; } case MotionEvent.ACTION_CANCEL: { // Recycle Velocity Tracker if (null != mVelocityTracker) { mVelocityTracker.recycle(); mVelocityTracker = null; } break; } case MotionEvent.ACTION_UP: { if (mIsDragging) { if (null != mVelocityTracker) { mLastTouchX = getActiveX(ev); mLastTouchY = getActiveY(ev); // Compute velocity within the last 1000ms mVelocityTracker.addMovement(ev); mVelocityTracker.computeCurrentVelocity(1000); final float vX = mVelocityTracker.getXVelocity(), vY = mVelocityTracker.getYVelocity(); // If the velocity is greater than minVelocity, call // listener if (Math.max(Math.abs(vX), Math.abs(vY)) >= mMinimumVelocity) { mListener.onFling(mLastTouchX, mLastTouchY, -vX, -vY); } } } // Recycle Velocity Tracker if (null != mVelocityTracker) { mVelocityTracker.recycle(); mVelocityTracker = null; } break; } } return true; } } @TargetApi(5) private static class EclairDetector extends CupcakeDetector { private static final int INVALID_POINTER_ID = -1; private int mActivePointerId = INVALID_POINTER_ID; private int mActivePointerIndex = 0; public EclairDetector(Context context) { super(context); } @Override float getActiveX(MotionEvent ev) { try { return ev.getX(mActivePointerIndex); } catch (Exception e) { return ev.getX(); } } @Override float getActiveY(MotionEvent ev) { try { return ev.getY(mActivePointerIndex); } catch (Exception e) { return ev.getY(); } } @Override public boolean onTouchEvent(MotionEvent ev) { final int action = ev.getAction(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: mActivePointerId = ev.getPointerId(0); break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: mActivePointerId = INVALID_POINTER_ID; break; case MotionEvent.ACTION_POINTER_UP: final int pointerIndex = (ev.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; final int pointerId = ev.getPointerId(pointerIndex); if (pointerId == mActivePointerId) { // This was our active pointer going up. Choose a new // active pointer and adjust accordingly. final int newPointerIndex = pointerIndex == 0 ? 1 : 0; mActivePointerId = ev.getPointerId(newPointerIndex); mLastTouchX = ev.getX(newPointerIndex); mLastTouchY = ev.getY(newPointerIndex); } break; } mActivePointerIndex = ev.findPointerIndex(mActivePointerId != INVALID_POINTER_ID ? mActivePointerId : 0); return super.onTouchEvent(ev); } } @TargetApi(8) private static class FroyoDetector extends EclairDetector { private final ScaleGestureDetector mDetector; // Needs to be an inner class so that we don't hit // VerifyError's on API 4. private final OnScaleGestureListener mScaleListener = new OnScaleGestureListener() { @Override public boolean onScale(ScaleGestureDetector detector) { mListener.onScale(detector.getScaleFactor(), detector.getFocusX(), detector.getFocusY()); return true; } @Override public boolean onScaleBegin(ScaleGestureDetector detector) { return true; } @Override public void onScaleEnd(ScaleGestureDetector detector) { // NO-OP } }; public FroyoDetector(Context context) { super(context); mDetector = new ScaleGestureDetector(context, mScaleListener); } @Override public boolean isScaling() { return mDetector.isInProgress(); } @Override public boolean onTouchEvent(MotionEvent ev) { mDetector.onTouchEvent(ev); return super.onTouchEvent(ev); } } }
[ "1261602584@qq.com" ]
1261602584@qq.com
aee58627d9a559cb77efb2d967bf6ee790c55e13
eb069224e0f72326c86aa6dafc33bb5a1cdd1263
/problem1/src/problem1/girl.java
96f795de92d0b6d3bfc5951c36ba914fb561c4c5
[]
no_license
PPL-IIITA/ppl-assignment-Surya165
88abaa4c6f8e3045f3e900e9325bcd07345e7dc0
7ba99487e250ab81e54b816ad1d940d0a42dfae3
refs/heads/master
2021-01-11T14:12:09.800498
2017-04-09T19:01:57
2017-04-09T19:01:57
81,587,708
0
0
null
null
null
null
UTF-8
Java
false
false
489
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package problem1; /** * * @author iiita */ public class girl { String Name; double Attr; double Intel; double Maint; String Pref; String Type; int check(boy b) { if(this.Maint <= b.budget) { return 1; } return 0; } }
[ "anudeep.anjaneyulu@gmail.com" ]
anudeep.anjaneyulu@gmail.com
36dc8c60cd20cb7ad5065b246a72e99ac3a48fa1
34864aab3334eb7acf6acd44078f4cad674af236
/com.ibm.team.build.hjplugin-rtc/src/test/java/com/ibm/team/build/internal/hjplugin/rtc/tests/BuildConfigurationTests.java
622c4149dd4eae26ef9714987b2863b6960199aa
[]
no_license
shilpakallaganad19/teamconcert-plugin
8fdf1db4f07db3a0eb611dbf454f5958b9a47e70
4eed73e8e7a5e53a2f5e69f443196ccdb545229e
refs/heads/master
2023-05-09T01:38:52.421875
2021-05-27T02:56:03
2021-05-27T02:56:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
263,751
java
/******************************************************************************* * Copyright © 2013, 2020 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package com.ibm.team.build.internal.hjplugin.rtc.tests; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import com.ibm.team.build.client.ClientFactory; import com.ibm.team.build.common.BuildItemFactory; import com.ibm.team.build.common.model.IBuildDefinition; import com.ibm.team.build.common.model.IBuildEngineHandle; import com.ibm.team.build.common.model.IBuildProperty; import com.ibm.team.build.common.model.IBuildRequest; import com.ibm.team.build.common.model.IBuildRequestParams; import com.ibm.team.build.common.model.IBuildResult; import com.ibm.team.build.common.model.IBuildResultHandle; import com.ibm.team.build.internal.common.builddefinition.IJazzScmConfigurationElement; import com.ibm.team.build.internal.hjplugin.rtc.BuildConfiguration; import com.ibm.team.build.internal.hjplugin.rtc.BuildConnection; import com.ibm.team.build.internal.hjplugin.rtc.BuildSnapshotDescriptor; import com.ibm.team.build.internal.hjplugin.rtc.BuildStreamDescriptor; import com.ibm.team.build.internal.hjplugin.rtc.Constants; import com.ibm.team.build.internal.hjplugin.rtc.IConsoleOutput; import com.ibm.team.build.internal.hjplugin.rtc.Messages; import com.ibm.team.build.internal.hjplugin.rtc.NonValidatingLoadRuleFactory; import com.ibm.team.build.internal.hjplugin.rtc.RTCConfigurationException; import com.ibm.team.build.internal.hjplugin.rtc.RTCSnapshotUtils; import com.ibm.team.build.internal.hjplugin.rtc.RTCWorkspaceUtils; import com.ibm.team.build.internal.hjplugin.rtc.RepositoryConnection; import com.ibm.team.build.internal.scm.BuildWorkspaceDescriptor; import com.ibm.team.build.internal.scm.ComponentLoadRules; import com.ibm.team.build.internal.scm.LoadComponents; import com.ibm.team.build.internal.scm.RepositoryManager; import com.ibm.team.filesystem.common.IFileItem; import com.ibm.team.filesystem.common.IFileItemHandle; import com.ibm.team.process.common.IProcessAreaHandle; import com.ibm.team.process.common.IProjectArea; import com.ibm.team.repository.client.IItemManager; import com.ibm.team.repository.client.ITeamRepository; import com.ibm.team.repository.common.IContributor; import com.ibm.team.repository.common.IItemHandle; import com.ibm.team.repository.common.ItemNotFoundException; import com.ibm.team.repository.common.TeamRepositoryException; import com.ibm.team.repository.common.UUID; import com.ibm.team.scm.client.IFlowNodeConnection.IComponentAdditionOp; import com.ibm.team.scm.client.IWorkspaceConnection; import com.ibm.team.scm.client.IWorkspaceManager; import com.ibm.team.scm.client.SCMPlatform; import com.ibm.team.scm.common.BaselineSetFlags; import com.ibm.team.scm.common.IBaselineSet; import com.ibm.team.scm.common.IBaselineSetHandle; import com.ibm.team.scm.common.IChangeSetHandle; import com.ibm.team.scm.common.IComponent; import com.ibm.team.scm.common.IComponentHandle; import com.ibm.team.scm.common.IWorkspace; import com.ibm.team.scm.common.IWorkspaceHandle; @SuppressWarnings({ "nls", "restriction" }) public class BuildConfigurationTests { private RepositoryConnection connection; public BuildConfigurationTests(RepositoryConnection repositoryConnection) { this.connection = repositoryConnection; } public Map<String, String> setupComponentLoading(String workspaceName, String buildDefinitionId, String testName, String hjPath, String buildPath) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = SCMUtil.createWorkspace(workspaceManager, workspaceName); Map<String, IItemHandle> pathToHandle = SCMUtil.addComponent(workspaceManager, buildWorkspace, testName, new String[] { "/", "/f/", "/f/a.txt", }); pathToHandle.putAll(SCMUtil.addComponent(workspaceManager, buildWorkspace, testName + "2", new String[] { "/", "/g/", "/g/b.txt", })); pathToHandle.putAll(SCMUtil.addComponent(workspaceManager, buildWorkspace, testName + "3", new String[] { "/", "/h/", "/h/c.txt", })); IComponentHandle component = (IComponentHandle) pathToHandle.get(testName); // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component.getItemId().getUuidValue()); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "true", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, "", IJazzScmConfigurationElement.PROPERTY_INCLUDE_COMPONENTS, "true", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.singletonList(component)).getBuildProperty() ); BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testComponentLoading(String workspaceName, String buildDefinitionId, String testName, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertTrue("Should be a list of components to include", buildConfiguration.includeComponents()); AssertUtil.assertTrue("Should be creating a folder for the component", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(0, buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(1, buildConfiguration.getComponents().size()); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID), buildConfiguration.getComponents().iterator().next().getItemId().getUuidValue()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertFalse("Deletion should not be needed", buildConfiguration.isDeleteNeeded()); } public Map<String, String> setupNewLoadRules(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath) throws Exception { // create a build definition with new format load rules // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildStream = SCMUtil.createWorkspace(workspaceManager, workspaceName + "_stream"); Map<String, IItemHandle> pathToHandle = SCMUtil.addComponent(workspaceManager, buildStream, componentName, new String[] { "/", "/f/", "/f/a.txt", "/g/", "/g/b.txt", "/h/", "/h/c.txt", }); IComponent component = (IComponent) pathToHandle.get(componentName); IChangeSetHandle cs = buildStream.createChangeSet(component, null); SCMUtil.addVersionables(buildStream, component, cs, pathToHandle, new String[] {"/h/new.loadRule"}, new String[] {getNewLoadRule(componentName, "f")}, "setupNewLoadRules"); // load rule to load f directory buildStream.closeChangeSets(Collections.singletonList(cs), null); IFileItemHandle loadRuleFile = (IFileItemHandle) pathToHandle.get("/h/new.loadRule"); Map<IComponentHandle, IFileItemHandle> loadRuleFiles = Collections.singletonMap((IComponentHandle) component, loadRuleFile); ComponentLoadRules loadRule = new ComponentLoadRules(loadRuleFiles); artifactIds.put("LoadRuleProperty", loadRule.getBuildPropertySetting()); IWorkspaceConnection buildWorkspace = SCMUtil.createBuildWorkspace(workspaceManager, buildStream, workspaceName); // cs1 adds h.txt & i.txt IChangeSetHandle cs1 = buildStream.createChangeSet(component, null); SCMUtil.addVersionables(buildStream, component, cs1, pathToHandle, new String[] { "/f/h.txt", "/g/i.txt" }, "SetupNewLoadRules"); buildStream.closeChangeSets(Collections.singletonList(cs1), null); // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID, buildStream.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component.getItemId().getUuidValue()); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, loadRule.getBuildPropertySetting(), IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle>emptyList()).getBuildProperty() ); BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } private String getNewLoadRule(String componentName, String folderName) { return getNewLoadRule(componentName, folderName, false); } private String getNewLoadRule(String componentName, String folderName, boolean createFoldersForComponents) { String loadRule = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--Built from the sandbox \"C:\\BuildPlugin3\" and the workspace \"JenkinsInitiation Development Workspace\"-->\n" + "<!--Generated: 2013-04-02 14.49.08-->\n" + "<scm:sourceControlLoadRule version=\"1\" xmlns:scm=\"http://com.ibm.team.scm\">\n" + " <parentLoadRule>\n" + " <component name=\"" + componentName + "\" />\n" + " <parentFolder repositoryPath=\"/" + folderName + "\" />\n" + (createFoldersForComponents? "<sandboxRelativePath includeComponentName=\"true\"/>":"") + " </parentLoadRule>\n" + "</scm:sourceControlLoadRule>\n"; return loadRule; } public void testNewLoadRules(String workspaceName, String testName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(1, buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); } public Map<String, String> setupOldLoadRules(String workspaceName, String componentName, String hjPath) throws Exception { // Create build definition with old style load rules // load directory missing // don't delete directory before loading (dir has other stuff that will(not) be deleted) // don't accept changes before loading // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildStream = SCMUtil.createWorkspace(workspaceManager, workspaceName + "_stream"); Map<String, IItemHandle> pathToHandle = SCMUtil.addComponent(workspaceManager, buildStream, componentName, new String[] { "/", "/f/", "/f/a.txt", "/g/", "/g/b.txt", "/h/", "/h/c.txt", }); IComponent component = (IComponent) pathToHandle.get(componentName); IChangeSetHandle cs = buildStream.createChangeSet(component, null); SCMUtil.addVersionables(buildStream, component, cs, pathToHandle, new String[] {"/h/new.loadRule"}, new String[] {getOldLoadRule(componentName, "f")}, "setupOldLoadRules"); // load rule to load f directory buildStream.closeChangeSets(Collections.singletonList(cs), null); IFileItemHandle loadRuleFile = (IFileItemHandle) pathToHandle.get("/h/new.loadRule"); Map<IComponentHandle, IFileItemHandle> loadRuleFiles = Collections.singletonMap((IComponentHandle) component, loadRuleFile); ComponentLoadRules loadRule = new ComponentLoadRules(loadRuleFiles); artifactIds.put("LoadRuleProperty", loadRule.getBuildPropertySetting()); IWorkspaceConnection buildWorkspace = SCMUtil.createBuildWorkspace(workspaceManager, buildStream, workspaceName); // cs1 adds h.txt & i.txt IChangeSetHandle cs1 = buildStream.createChangeSet(component, null); SCMUtil.addVersionables(buildStream, component, cs1, pathToHandle, new String[] { "/f/h.txt", "/g/i.txt" },"setupOldLoadRules"); buildStream.closeChangeSets(Collections.singletonList(cs1), null); // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID, buildStream.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component.getItemId().getUuidValue()); // create the build definition BuildUtil.createBuildDefinition(repo, componentName, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, loadRule.getBuildPropertySetting(), IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle>emptyList()).getBuildProperty() ); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // create the build result String buildResultItemId = connection.createBuildResult(componentName, null, "my buildLabel", listener, null, Locale.getDefault()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultItemId); if (failure[0] != null) { throw failure[0]; } return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public Map<String, String> setupBuildDefinition_loadRulesWithNoLoadPolicy(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean configureLoadRules, boolean setLoadPolicy) throws Exception { // create a build definition with new format load rules // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // do not set loadPolicy or set it to useComponentLoadConfig // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty()); if (configureLoadRules) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); } if (setLoadPolicy) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_loadRulesWithNoLoadPolicy(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean configureLoadRules, boolean setLoadPolicy) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); // when loadPolicy is set to useComponentLoadConfig loadRules are not set AssertUtil.assertEquals( configureLoadRules && !setLoadPolicy? 1 : 0, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue(" isLoadPolicySetToUseComponentLoadConfig is not as expected", setLoadPolicy ? buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()== true : buildConfiguration.isLoadPolicySet() == false); AssertUtil.assertTrue(" isLoadPolicySet is not as expected", setLoadPolicy ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents is not as expected", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_loadRulesWithLoadPolicySetToLoadRules(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean configureLoadRules) throws Exception { // create a build definition with new format load rules // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // set loadPolicy to useLoadRules // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_LOAD_RULES); if (configureLoadRules) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_loadRulesWithLoadPolicySetToLoadRules(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean configureLoadRules) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); @SuppressWarnings("rawtypes") Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", configureLoadRules ? loadRules.size() == 1 : loadRules.size() == 0); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySet should be true", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_toTestCreateFolderForComponents(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean shouldCreateFoldersForComponents, String loadPolicy, String componentLoadConfig) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set team.scm.loadPolicy and team.scm.componentLoadConfig properties // select create folders for components option depending on the value of setCreateFoldersForComponents // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, false); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, shouldCreateFoldersForComponents ? "true" : "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty()); if (loadPolicy != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, loadPolicy); } if (componentLoadConfig != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_COMPONENT_LOAD_CONFIG, componentLoadConfig); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_createFoldersForComponents(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean shouldCreateFoldersForComponents, String loadPolicy, String componentLoadConfig) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil .assertTrue( "Create folders for components is not as expected", shouldCreateFoldersForComponents && (loadPolicy == null || loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy)) ? buildConfiguration .createFoldersForComponents() == true : buildConfiguration.createFoldersForComponents() == false); AssertUtil.assertEquals( 0, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil .assertTrue( "isLoadPolicySetToUseLoadRules is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_LOAD_RULES.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseLoadRules() == true : buildConfiguration.isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertTrue( "isLoadPolicySetToUseComponentLoadConfig is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseComponentLoadConfig() == true : buildConfiguration.isLoadPolicySetToUseComponentLoadConfig() == false); AssertUtil.assertTrue("isLoadPolicySet is not as expected", loadPolicy != null ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil .assertTrue( "isComponentLoadConfigSetToExcludeSomeComponents is not as expected", componentLoadConfig != null && componentLoadConfig.equals(Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS) ? buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == true : buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == false); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_toTestCreateFoldersForComponents_usingLoadRules(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath) throws Exception { // create a build definition with new format load rules that creates root folders with the component name // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // set lodaPolicy to useLoadRules // create folders for components using load rules rather than the option in the Jazz SCM configuration // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, false, false, true, false, false, false); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_LOAD_RULES); BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_createFoldersForComponents_usingLoadRules(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Create folders for components should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals( 1, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules is not as expected ", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig is not as expected ", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isLoadPolicySet is not as expected", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents is not as expected", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_toTestComponentsToExclude(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean shouldExcludeComponents, String loadPolicy, String componentLoadConfig) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set team.scm.loadPolicy and team.scm.componentLoadConfig properties // exclude components depending on the value of shouldExcludeComponents // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, false); // create the build definition BuildUtil.createBuildDefinition( repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(shouldExcludeComponents ? Collections.singletonList((IComponentHandle)IComponent.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID)), null)) : Collections .<IComponentHandle> emptyList()).getBuildProperty()); if (loadPolicy != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, loadPolicy); } if (componentLoadConfig != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_COMPONENT_LOAD_CONFIG, componentLoadConfig); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_componentsToExclude(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean shouldExcludeComponents, String loadPolicy, String componentLoadConfig) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Create folders for components should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals( 0, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); Collection<IComponentHandle> componentsToExclude = buildConfiguration.getComponents(); AssertUtil .assertTrue( "List of components to exclude is not as expected", shouldExcludeComponents && (loadPolicy == null || (Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) && Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS .equals(componentLoadConfig))) ? componentsToExclude.size() == 1 : componentsToExclude.size() == 0); // only component 2 is excluded if (shouldExcludeComponents && (loadPolicy == null || Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) && Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS.equals(componentLoadConfig))) { AssertUtil.assertTrue( "components to exclude list is not a expected", UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID)).equals( componentsToExclude.iterator().next().getItemId())); } File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil .assertTrue( "isLoadPolicySetToUseLoadRules is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_LOAD_RULES.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseLoadRules() == true : buildConfiguration.isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertTrue( "isLoadPolicySetToUseComponentLoadConfig is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseComponentLoadConfig() == true : buildConfiguration.isLoadPolicySetToUseComponentLoadConfig() == false); AssertUtil.assertTrue("isLoadPolicySet is not as expected", loadPolicy != null ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil .assertTrue( "isComponentLoadConfigSetToExcludeSomeComponents is not as expected", componentLoadConfig != null && componentLoadConfig.equals(Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS) ? buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == true : buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == false); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_toTestIncludeComponents(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean addLoadComponents, String valueOfIncludeComponents, String loadPolicy, String componentLoadConfig) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set loadPolicy property // setup a list of components to include/exclude depending on the value of addLoadComponents // add and set include components property to valueOfIncludeComponents // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, false); // create the build definition BuildUtil.createBuildDefinition( repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(addLoadComponents ? Collections.singletonList((IComponentHandle)IComponent.ITEM_TYPE .createItemHandle(UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID)), null)) : Collections .<IComponentHandle> emptyList()).getBuildProperty()); if (loadPolicy != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, loadPolicy); } if (componentLoadConfig != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_COMPONENT_LOAD_CONFIG, componentLoadConfig); } BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, IJazzScmConfigurationElement.PROPERTY_INCLUDE_COMPONENTS, valueOfIncludeComponents); BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_includeComponents(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean addLoadComponents, String valueOfIncludeComponents, String loadPolicy, String componentLoadConfig) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertTrue( "includeComponents is not as expected", Boolean.valueOf(valueOfIncludeComponents) && (loadPolicy == null || Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) && Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS.equals(componentLoadConfig)) ? buildConfiguration .includeComponents() == true : buildConfiguration.includeComponents() == false); AssertUtil.assertFalse("Create folders for components should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals( 0, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); Collection<IComponentHandle> loadComponents = buildConfiguration.getComponents(); AssertUtil.assertTrue("Load components list is not as expected", addLoadComponents && (loadPolicy == null || Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) && Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS.equals(componentLoadConfig)) ? loadComponents.size() == 1 : loadComponents.size() == 0); if (addLoadComponents && (loadPolicy == null || Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) && Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS.equals(componentLoadConfig))) { AssertUtil.assertTrue( "Load components list is not a expected", UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID)).equals( loadComponents.iterator().next().getItemId())); } File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil .assertTrue( "isLoadPolicySetToUseLoadRules is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_LOAD_RULES.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseLoadRules() == true : buildConfiguration.isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertTrue( "isLoadPolicySetToUseComponentLoadConfig is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseComponentLoadConfig() == true : buildConfiguration.isLoadPolicySetToUseComponentLoadConfig() == false); AssertUtil.assertTrue("isLoadPolicySet is not as expected", loadPolicy != null ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil .assertTrue( "isComponentLoadConfigSetToExcludeSomeComponents is not as expected", componentLoadConfig != null && componentLoadConfig.equals(Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS) ? buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == true : buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == false); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setupBuildDefinition_toTestMultipleLoadRuleFiles(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean setLoadPolicyToUseLoadRules) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set loadPolicy property // add multiple load rules files // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, true, false, false, false, false, false); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); if (setLoadPolicyToUseLoadRules) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_LOAD_RULES); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } @SuppressWarnings("rawtypes") public void testBuildDefinitionConfig_multipleLoadRuleFiles(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean setLoadPolicyToUseLoadRules) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Create folders for components should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertTrue( "isLoadPolicySetToUseLoadRules should be true", setLoadPolicyToUseLoadRules ? buildConfiguration.isLoadPolicySetToUseLoadRules() == true : buildConfiguration .isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isLoadPolicySet is not as expected", setLoadPolicyToUseLoadRules ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); try { Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, ps, null, Locale.getDefault()); if (setLoadPolicyToUseLoadRules) { AssertUtil.fail("Exception expected"); } else { AssertUtil.assertTrue("There should be 2 load rule files.", loadRules.size() == 2); AssertUtil.assertEquals(Messages.get(Locale.getDefault()).BuildConfiguration_multiple_load_rule_files_deprecated(), baos.toString() .trim()); } } catch (RTCConfigurationException e) { if (setLoadPolicyToUseLoadRules) { AssertUtil .assertEquals(Messages.get(Locale.getDefault()).BuildConfiguration_multiple_load_rule_files_not_supported(), e.getMessage()); } else { AssertUtil.fail("Exception not expected: " + e.getMessage()); } } finally { try { ps.close(); } catch (Exception e) { // ignore } } } public Map<String, String> setupBuildDefinition_toTestOldLoadRulesFormat(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean setLoadPolicyToUseLoadRules) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set loadPolicy property // add load rules in old format // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, false, true, false, false, false, false); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); if (setLoadPolicyToUseLoadRules) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_LOAD_RULES); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } @SuppressWarnings("rawtypes") public void testBuildDefinitionConfig_oldLoadRulesFormat(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean setLoadPolicyToUseLoadRules) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Create folders for components should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertTrue( "isLoadPolicySetToUseLoadRules should be true", setLoadPolicyToUseLoadRules ? buildConfiguration.isLoadPolicySetToUseLoadRules() == true : buildConfiguration .isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isLoadPolicySet should be true", setLoadPolicyToUseLoadRules ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); try { Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, ps, null, Locale.getDefault()); if (setLoadPolicyToUseLoadRules) { AssertUtil.fail("Exception expected"); } else { AssertUtil.assertTrue("There should be 1 load rule file.", loadRules.size() == 1); AssertUtil.assertEquals(Messages.get(Locale.getDefault()).NonValidatingLoadRuleFactory_old_load_rules_format_deprecated(), baos .toString().trim()); } } catch (RTCConfigurationException e) { if (setLoadPolicyToUseLoadRules) { AssertUtil .assertEquals(Messages.get(Locale.getDefault()).NonValidatingLoadRuleFactory_load_rules_not_in_XML_format(), e.getMessage()); } else { AssertUtil.fail("Exception not expected: " + e.getMessage()); } } finally { try { ps.close(); } catch (Exception e) { // ignore } } baos = new ByteArrayOutputStream(); ps = new PrintStream(baos); try { IWorkspaceConnection buildWorkspace = SCMPlatform.getWorkspaceManager(repo).getWorkspaceConnection( (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)), null), null); NonValidatingLoadRuleFactory.checkForObsoleteLoadRuleFormat( buildWorkspace, (IComponentHandle)IComponent.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID)), null), (IFileItemHandle)IFileItem.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_ITEM_ID)), null), setLoadPolicyToUseLoadRules, ps, null, Locale.getDefault()); if (setLoadPolicyToUseLoadRules) { AssertUtil.fail("Exception expected"); } else { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).NonValidatingLoadRuleFactory_old_load_rules_format_deprecated(), baos .toString().trim()); } } catch (RTCConfigurationException e) { if (setLoadPolicyToUseLoadRules) { AssertUtil .assertEquals(Messages.get(Locale.getDefault()).NonValidatingLoadRuleFactory_load_rules_not_in_XML_format(), e.getMessage()); } else { AssertUtil.fail("Exception not expected: " + e.getMessage()); } } finally { try { ps.close(); } catch (Exception e) { // ignore } } } private IWorkspaceConnection setupWorkspace_toTestLoadPolicy(String workspaceName, String componentName, ITeamRepository repo, Map<String, String> artifactIds, boolean configureLoadRules) throws Exception { return setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules, false, false, false, false, false, false); } private IWorkspaceConnection setupWorkspace_toTestLoadPolicy(String workspaceName, String componentName, ITeamRepository repo, Map<String, String> artifactIds, boolean configureLoadRules, boolean addDuplicateComponents) throws Exception { return setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules, false, false, false, addDuplicateComponents, false, false); } private IWorkspaceConnection setupWorkspace_toTestLoadPolicy(String workspaceName, String componentName, ITeamRepository repo, Map<String, String> artifactIds, boolean configureLoadRules, boolean addDuplicateComponents, boolean createStream) throws Exception { return setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules, false, false, false, addDuplicateComponents, createStream, false); } private IWorkspaceConnection setupWorkspace_toTestLoadPolicy(String workspaceName, String componentName, ITeamRepository repo, Map<String, String> artifactIds, boolean configureLoadRules, boolean addDuplicateComponents, boolean createStream, boolean createSnapshot) throws Exception { return setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules, false, false, false, addDuplicateComponents, createStream, createSnapshot); } @SuppressWarnings("unchecked") private IWorkspaceConnection setupWorkspace_toTestLoadPolicy(String workspaceName, String componentName, ITeamRepository repo, Map<String, String> artifactIds, boolean configureLoadRules, boolean configureMultipleLoadRuleFiles, boolean configureOldRules, boolean createFoldersForComponents, boolean addDuplicateComponents, boolean createStream, boolean createSnapshot) throws Exception { IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); try { IWorkspaceConnection buildStream = SCMUtil.createWorkspace(workspaceManager, workspaceName + "_stream"); String component1_Name = componentName + 1; String component2_Name = componentName + 2; // add multiple components // comp1 Map<String, IItemHandle> pathToHandle1 = SCMUtil.addComponent(workspaceManager, buildStream, component1_Name, new String[] { "/", "/f-comp1/", "/f-comp1/a-comp1.txt", "/g-comp1/", "/g-comp1/b-comp1.txt", "/h-comp1/", "/h-comp1/c-comp1.txt", }); IComponent component1 = (IComponent)pathToHandle1.get(component1_Name); // comp2 Map<String, IItemHandle> pathToHandle2 = SCMUtil.addComponent(workspaceManager, buildStream, component2_Name, new String[] { "/", "/f-comp2/", "/f-comp2/a.txt", "/g-comp2/", "/g-comp2/b.txt", "/h-comp2/", "/h-comp2/c.txt", }); IComponent component2 = (IComponent)pathToHandle2.get(component2_Name); if (addDuplicateComponents) { String component3_Name = componentName + 3; IComponent duplicateComponent = workspaceManager.createComponent(component3_Name, workspaceManager.teamRepository() .loggedInContributor(), null); IComponentAdditionOp componentOp = buildStream.componentOpFactory().addComponent(duplicateComponent, false); buildStream.applyComponentOperations(Collections.singletonList(componentOp), null); duplicateComponent = workspaceManager.createComponent(component3_Name, workspaceManager.teamRepository() .loggedInContributor(), null); componentOp = buildStream.componentOpFactory().addComponent(duplicateComponent, false); buildStream.applyComponentOperations(Collections.singletonList(componentOp), null); } IChangeSetHandle cs = buildStream.createChangeSet(component1, null); // load rule to load f directory SCMUtil.addVersionables( buildStream, component1, cs, pathToHandle1, new String[] { "/h-comp1/new.loadRule" }, new String[] { configureOldRules ? getOldLoadRule(component1_Name, "f-comp1") : getNewLoadRule(component1_Name, "f-comp1", createFoldersForComponents) }, "setupWorkspace_toTestLoadPolicy"); buildStream.closeChangeSets(Collections.singletonList(cs), null); if (configureLoadRules) { IFileItemHandle loadRuleFile = (IFileItemHandle)pathToHandle1.get("/h-comp1/new.loadRule"); Map<IComponentHandle, IFileItemHandle> loadRuleFiles = new HashMap<IComponentHandle, IFileItemHandle>(); loadRuleFiles.put((IComponentHandle)component1, loadRuleFile); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_ITEM_ID, loadRuleFile.getItemId().getUuidValue()); if (configureMultipleLoadRuleFiles) { cs = buildStream.createChangeSet(component2, null); SCMUtil.addVersionables( buildStream, component2, cs, pathToHandle2, new String[] { "/h-comp2/new.loadRule" }, new String[] { configureOldRules ? getOldLoadRule(component2_Name, "f-comp2") : getNewLoadRule(component2_Name, "f-comp2", createFoldersForComponents) }, "setupWorkspace_toTestLoadPolicy"); buildStream.closeChangeSets(Collections.singletonList(cs), null); loadRuleFile = (IFileItemHandle)pathToHandle2.get("/h-comp2/new.loadRule"); loadRuleFiles.put((IComponentHandle)component2, loadRuleFile); } ComponentLoadRules loadRule = new ComponentLoadRules(loadRuleFiles); artifactIds.put("LoadRuleProperty", loadRule.getBuildPropertySetting()); } IWorkspaceConnection buildWorkspace = SCMUtil.createBuildWorkspace(workspaceManager, buildStream, workspaceName); // cs1 adds h-comp1.txt & i-comp1.txt IChangeSetHandle cs1 = buildStream.createChangeSet(component1, null); SCMUtil.addVersionables(buildStream, component1, cs1, pathToHandle1, new String[] { "/f-comp1/h-comp1.txt", "/g-comp1/i-comp1.txt" }, "setupWorkspace_toTestLoadPolicy"); buildStream.closeChangeSets(Collections.singletonList(cs1), null); if (createStream) { String streamName = workspaceName + "_lrStream"; RTCFacadeTests rtcFacadeTests = new RTCFacadeTests(connection); Map<String, String> paArtifactIds = rtcFacadeTests.setupTestProcessArea_basic(workspaceName + "_PA"); artifactIds.putAll(paArtifactIds); String projectAreaId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_PROJECT_AREA_ITEM_ID); IProcessAreaHandle projectAreaHandle = (IProcessAreaHandle)IProjectArea.ITEM_TYPE.createItemHandle(UUID.valueOf(projectAreaId), null); IWorkspaceConnection lrBuildStream = SCMUtil.createStream(workspaceManager, projectAreaHandle, streamName); List<IComponentHandle> components = buildWorkspace.getComponents(); List<IComponentAdditionOp> componentAddOps = new ArrayList<IComponentAdditionOp>(); for (IComponentHandle compHandle : components) { componentAddOps.add(lrBuildStream.componentOpFactory().addComponent(compHandle, buildWorkspace, false)); } lrBuildStream.applyComponentOperations(componentAddOps, null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_ITEM_ID, lrBuildStream.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_NAME, lrBuildStream.getName()); } if (createSnapshot) { // Create a baseline set for the workspace String snapshotName = workspaceName + "_lrSS"; IBaselineSetHandle baselineSet = buildWorkspace.createBaselineSet(null, snapshotName, null, BaselineSetFlags.DEFAULT, null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_SS_ITEM_ID, baselineSet.getItemId().getUuidValue()); } // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID, buildStream.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component1.getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID, component2.getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_TEST_FOLDER_ITEM_ID, pathToHandle1.get("/h-comp1/").getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_PATH, "/h-comp1/new.loadRule"); return buildWorkspace; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_ITEM_ID)); throw e; } } private String getOldLoadRule(String componentName, String folderName) { String loadRule = "# Two directives are supported: \n" + "# folderName=\n" + "# RootFolderName=\n" + "\n" + "RootFolderName=/" + folderName; return loadRule; } public void testOldLoadRules(String workspaceName, String testName, String hjPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertFalse("Should not be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(1, buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(testName + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertFalse("Deletion is not needed", buildConfiguration.isDeleteNeeded()); } public Map<String, String> setupOldLoadRules_setAllLoadOptions(String workspaceName, String componentName, String hjPath) throws Exception { // Create build definition with old style load rules // load directory missing // don't delete directory before loading (dir has other stuff that will(not) be deleted) // don't accept changes before loading // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, false, true, false, false, false, false); // create the build definition BuildUtil.createBuildDefinition( repo, componentName, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "true", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty"), IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.singletonList((IComponentHandle)IComponent.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID)), null))).getBuildProperty() ); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // create the build result String buildResultItemId = connection.createBuildResult(componentName, null, "my buildLabel", listener, null, Locale.getDefault()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultItemId); if (failure[0] != null) { throw failure[0]; } return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testOldLoadRules_setAllLoadOptions(String workspaceName, String testName, String hjPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should not be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertTrue("Should be creating a folder for the component", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals(1, buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(1, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(testName + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is needed", buildConfiguration.isDeleteNeeded()); AssertUtil.assertFalse("isLoadPolicySet should be false", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); } public Map<String, String> setupPersonalBuild(String workspaceName, String testName, String hjPath, String buildPath) throws Exception { // create a build definition // load directory ${propertyA}/here // build properties // myPropsFile = ${team.scm.fetchDestination}/com.ibm.team.build.releng/continuous-buildsystem.properties // propertyA = loadDir // propertyB = a place (${propertyA}) to load some stuff // propertyC = original // using a load rule // create a build engine // create a build request for this test with personal build specified // (build workspace overridden, build engine is a random one, override load rule, override a build property) // verify that the buildConfiguration returns the personal build workspace // as the workspace to be loaded // verify the load rule is changed // verify the build property is changed // verify property substitution done connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildStream = SCMUtil.createWorkspace(workspaceManager, workspaceName + "_stream"); Map<String, IItemHandle> pathToHandle = SCMUtil.addComponent(workspaceManager, buildStream, testName, new String[] { "/", "/f/", "/f/a.txt", "/g/", "/g/b.txt", "/h/", "/h/c.txt", }); IComponent component = (IComponent) pathToHandle.get(testName); IChangeSetHandle cs = buildStream.createChangeSet(component, null); SCMUtil.addVersionables(buildStream, component, cs, pathToHandle, new String[] {"/h/new.loadRule", "/h/old.loadRule"}, new String[] {getNewLoadRule(testName, "f"), getOldLoadRule(testName, "g")}, "setupPersonalBuild"); buildStream.closeChangeSets(Collections.singletonList(cs), null); IFileItemHandle loadRuleFile = (IFileItemHandle) pathToHandle.get("/h/new.loadRule"); IFileItemHandle oldLoadRuleFile = (IFileItemHandle) pathToHandle.get("/h/old.loadRule"); ComponentLoadRules loadRule = new ComponentLoadRules(Collections.singletonMap((IComponentHandle) component, loadRuleFile)); ComponentLoadRules oldLoadRule = new ComponentLoadRules(Collections.singletonMap((IComponentHandle) component, oldLoadRuleFile)); artifactIds.put("LoadRuleProperty", oldLoadRule.getBuildPropertySetting()); IWorkspaceConnection buildWorkspace = SCMUtil.createBuildWorkspace(workspaceManager, buildStream, workspaceName); // cs1 adds h.txt & i.txt IChangeSetHandle cs1 = buildWorkspace.createChangeSet(component, null); SCMUtil.addVersionables(buildWorkspace, component, cs1, pathToHandle, new String[] { "/f/h.txt", "/g/i.txt" },"setupPersonalBuild"); buildWorkspace.closeChangeSets(Collections.singletonList(cs1), null); // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID, buildStream.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component.getItemId().getUuidValue()); // create the build definition BuildUtil.createBuildDefinition(repo, testName, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, loadRule.getBuildPropertySetting(), IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle>emptyList()).getBuildProperty(), "myPropsFile", "${team.scm.fetchDestination}/com.ibm.team.build.releng/continuous-buildsystem.properties", "propertyA", "loadDir", "propertyB", "a place (${propertyA}) to load some stuff", "propertyC", "original"); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // create the build result for a personal build IBuildResultHandle buildResultHandle = createPersonalBuildResult(testName, buildStream.getResolvedWorkspace(), "my buildLabel", oldLoadRule.getBuildPropertySetting(), listener ); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultHandle.getItemId().getUuidValue()); if (failure[0] != null) { throw failure[0]; } return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)); SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } /** * Create a build result to report back the build progress in RTC * @param buildDefinitionId The id of the build definition. There must be a build definition and it * will need to have an active build engine associated with it. * @param personalBuildWorkspace Override the build workspace in the build definition with a personal workspace * @param buildLabel The label to assign to the build * @param listener A log to report progress and failures to. * @return The build result to update with progress of the Jenkins build. May be <code>null</code> * if there is no build engine associated with the build definition * @throws TeamRepositoryException Thrown if problems are encountered * @throws RTCConfigurationException Thrown if the build definition is not valid */ private IBuildResultHandle createPersonalBuildResult(String buildDefinitionId, IWorkspaceHandle personalBuildWorkspace, String buildLabel, String loadRuleProperty, IConsoleOutput listener) throws TeamRepositoryException, RTCConfigurationException { ITeamRepository repo = connection.getTeamRepository(); BuildConnection buildConnection = new BuildConnection(repo); IBuildDefinition buildDefinition = buildConnection.getBuildDefinition(buildDefinitionId, null); if (buildDefinition == null) { throw new RTCConfigurationException(Messages.getDefault().BuildConnection_build_definition_not_found(buildDefinitionId)); } List<IBuildProperty> modifiedProperties = new ArrayList<IBuildProperty>(); IBuildProperty originalProperty = buildDefinition.getProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID); if (originalProperty != null && !originalProperty.getValue().equals(personalBuildWorkspace.getItemId().getUuidValue())) { modifiedProperties.add(BuildItemFactory.createBuildProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, personalBuildWorkspace.getItemId().getUuidValue())); } else { AssertUtil.fail("Should of been able to override build workspace"); } originalProperty = buildDefinition.getProperty(IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES); if (originalProperty != null && !originalProperty.getValue().equals(loadRuleProperty)) { modifiedProperties.add(BuildItemFactory.createBuildProperty(IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, loadRuleProperty)); } else { AssertUtil.fail("Shoud of been able to override load rule"); } originalProperty = buildDefinition.getProperty(IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH); if (originalProperty != null && !originalProperty.getValue().equals("false")) { modifiedProperties.add(BuildItemFactory.createBuildProperty(IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false")); } else { AssertUtil.fail("Shoud of been able to override delete destination before fetch"); } originalProperty = buildDefinition.getProperty("propertyC"); if (originalProperty != null && !originalProperty.getValue().equals("overwritten")) { modifiedProperties.add(BuildItemFactory.createBuildProperty("propertyC", "overwritten")); } else { AssertUtil.fail("Shoud of been able to override propertyC"); } IBuildEngineHandle buildEngine = buildConnection.getBuildEngine(buildDefinition, null); if (buildEngine == null) { throw new RTCConfigurationException(Messages.getDefault().BuildConnection_no_build_engine_for_defn(buildDefinitionId)); } IBuildRequestParams params = BuildItemFactory.createBuildRequestParams(); params.setBuildDefinition(buildDefinition); params.getNewOrModifiedBuildProperties().addAll(modifiedProperties); params.setAllowDuplicateRequests(true); params.setPersonalBuild(true); params.getPotentialHandlers().add(buildEngine); params.setStartBuild(true); IBuildRequest buildRequest = ClientFactory.getTeamBuildRequestClient(repo).requestBuild(params, new NullProgressMonitor()); IBuildResultHandle buildResultHandle = buildRequest.getBuildResult(); if (buildLabel != null) { IBuildResult buildResult = (IBuildResult) repo.itemManager().fetchPartialItem( buildResultHandle, IItemManager.REFRESH, Arrays.asList(IBuildResult.PROPERTIES_VIEW_ITEM), new NullProgressMonitor()); buildResult = (IBuildResult) buildResult.getWorkingCopy(); buildResult.setLabel(buildLabel); ClientFactory.getTeamBuildClient(repo).save(buildResult, new NullProgressMonitor()); } return buildResultHandle; } public void testPersonalBuild(String workspaceName, String testName, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); final Exception[] failure = new Exception[] {null}; final boolean[] propertiesLogged = new boolean[] {false}; IConsoleOutput listener = new IConsoleOutput() { @Override public void log(String message, Exception e) { failure[0] = e; } @Override public void log(String message) { // ok, just logging property substitutions to the log propertiesLogged[0] = true; } }; // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } if (!propertiesLogged[0]) { AssertUtil.fail("Property substitutions not logged"); } AssertUtil.assertTrue("Should be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); AssertUtil.assertEquals( 1, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, "loadDir/here"); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(testName + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertFalse("Deletion is needed", buildConfiguration.isDeleteNeeded()); // myPropsFile = ${team.scm.fetchDestination}/com.ibm.team.build.releng/continuous-buildsystem.properties // propertyA = loadDir // propertyB = a place (${propertyA}) to load some stuff // propertyC = original Map<String, String> buildProperties = buildConfiguration.getBuildProperties(); AssertUtil.assertEquals("loadDir", buildProperties.get("propertyA")); AssertUtil.assertEquals(buildProperties.get("team.scm.fetchDestination") + "/com.ibm.team.build.releng/continuous-buildsystem.properties", buildProperties.get("myPropsFile")); AssertUtil.assertEquals("a place (loadDir) to load some stuff", buildProperties.get("propertyB")); AssertUtil.assertEquals("overwritten", buildProperties.get("propertyC")); } public Map<String, String> setupBadFetchLocation(String workspaceName, String testName, String hjPath, String buildPath) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = SCMUtil.createWorkspace(workspaceManager, workspaceName); Map<String, IItemHandle> pathToHandle = SCMUtil.addComponent(workspaceManager, buildWorkspace, testName, new String[] { "/", "/f/", "/f/a.txt", }); IComponentHandle component = (IComponentHandle) pathToHandle.get(testName); // capture interesting uuids to verify against artifactIds.put(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID, buildWorkspace.getContextHandle().getItemId().getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID, component.getItemId().getUuidValue()); // create the build definition BuildUtil.createBuildDefinition(repo, testName, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "true", IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, "", IJazzScmConfigurationElement.PROPERTY_INCLUDE_COMPONENTS, "true", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.singletonList(component)).getBuildProperty() ); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // create the build result String buildResultItemId = connection.createBuildResult(testName, null, "my buildLabel", listener, null, Locale.getDefault()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultItemId); if (failure[0] != null) { throw failure[0]; } return artifactIds; } catch (Exception e) { // cleanup artifacts created SCMUtil.deleteWorkspace(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)); BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testGoodFetchLocation(String workspaceName, String testName, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { AssertUtil.fail("The relative fetch location should have been good: " + buildPath); } } public void testBadFetchLocation(String workspaceName, String testName, String hjPath, String buildPath, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle) IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); try { buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.fail("The relative fetch location should have been bad: " + buildPath); } catch (RTCConfigurationException e) { // good, the fetch location was bad } } public void testLoadSnapshotConfiguration(String snapshotName, String workspacePrefix, String hjPath) throws Exception { connection.ensureLoggedIn(null); ConsoleOutputHelper listener = new ConsoleOutputHelper(); ITeamRepository repo = connection.getTeamRepository(); RepositoryManager manager = connection.getRepositoryManager(); IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); IBaselineSet bs = RTCSnapshotUtils.getSnapshot(repo, null, snapshotName, null, Locale.getDefault()); buildConfiguration.initialize(bs, repo.loggedInContributor(), workspacePrefix, null, null, null, false, null, null, listener, Locale.getDefault(), null); if (listener.hasFailure()) { throw listener.getFailure(); } // Things that have be right in BuildConfiguration AssertUtil.assertEquals(buildConfiguration.getBuildSnapshotDescriptor().getSnapshotUUID(), bs.getItemId().getUuidValue()); AssertUtil.assertTrue("WorkspaceDescriptor cannot be null for snapshot load", buildConfiguration.getBuildWorkspaceDescriptor() != null); AssertUtil.assertFalse("isPersonalBuild cannot be true for a snapshot load", buildConfiguration.isPersonalBuild()); AssertUtil.assertFalse("acceptBeforeFetch cannot be true for a snapshot load", buildConfiguration.acceptBeforeFetch()); IWorkspaceHandle workspaceHandle = buildConfiguration.getBuildWorkspaceDescriptor().getWorkspaceHandle(); String workspaceName = buildConfiguration.getBuildWorkspaceDescriptor().getConnection(manager, false, null).getName(); // verify the following AssertUtil.assertFalse("createFolders for components cannot be true for testLoadSnapshotConfiguration", buildConfiguration.createFoldersForComponents()); AssertUtil.assertFalse("includeComponents cannot be true for testLoadSnapshotConfiguration", buildConfiguration.includeComponents()); AssertUtil.assertFalse("isDeleteNeeded cannot be true for testLoadSnapshotConfiguration", buildConfiguration.isDeleteNeeded()); AssertUtil.assertEquals(buildConfiguration.getComponents(), Collections.emptyList()); AssertUtil.assertEquals(buildConfiguration.getFetchDestinationFile().getCanonicalPath(), hjPath); AssertUtil.assertEquals(buildConfiguration.getSnapshotName(), null); // There should not be any build properties (for now) AssertUtil.assertTrue("buildProperties has to be zero size", buildConfiguration.getBuildProperties().keySet().size() == 0); // Call tearDown and ensure that the workspace is deleted buildConfiguration.tearDown(manager, false, null, listener, Locale.getDefault()); try { workspaceManager.getWorkspaceConnection(workspaceHandle, null); AssertUtil.fail("tearDown failed to delete workspace " + workspaceName); } catch (ItemNotFoundException exp) { // this is what we want } } public Map<String, String> setupRepositoryWorkspaceConfig_toTestLoadPolicy(String workspaceName, String componentName) throws Exception{ // create a repository workspace connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, true); // create a component but don't add it to workspace IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); IComponent component = workspaceManager.createComponent(componentName, workspaceManager.teamRepository().loggedInContributor(), null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID, component.getItemId().getUuidValue()); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testRepositoryWorkspaceConfig_toTestLoadPolicy(String workspaceName, String componentName, String hjPath, String buildPath, String pathToLoadRuleFile, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); String componentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID); String loadRuleItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_ITEM_ID); String addedComponentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID); Exception[] failure = new Exception[] {null}; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); IWorkspaceHandle workspaceHandle = RTCWorkspaceUtils.getInstance().getWorkspace(workspaceName, repo, new NullProgressMonitor(), Locale.getDefault()); // Validate load rules // valid pathToLoadRuleFile buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, pathToLoadRuleFile, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); @SuppressWarnings("rawtypes") Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySet should be true", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); // validate RTCWorkspaceUtils.getComponentLoadRuleString() indirectly through buildConfiguration.initialize buildConfiguration = new BuildConfiguration(repo, hjPath); // #1 - no load rules buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 0); buildConfiguration = new BuildConfiguration(repo, hjPath); // #2 - missing separator try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_invalid_format("testLoadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #3 - missing componentName try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "/testLoadRule/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_component_name("/testLoadRule/ws.loadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #4 - missing file path try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule/", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_file_path("testLoadRule/"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #5 - duplicateComponentName try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "3/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_multiple_components_with_name_in_ws(componentName + 3, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #6 - non-existent component in the repository try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "12/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found(componentName + "12"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #7 - non-existent component in the workspace try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found_ws(componentName, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #8 - non-existent file try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_not_found_ws("ws.loadRule", componentName + 1, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #9 - folder try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/h-comp1", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_not_a_file_ws("h-comp1", componentName + 1, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #10 - valid ids buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); buildConfiguration = new BuildConfiguration(repo, hjPath); // #11 - non-existent-componentId in repo String tempComponentId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, tempComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found(tempComponentId), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #12 - non-existent-componentId in ws try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, addedComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found_ws(addedComponentId, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #13 - non-existent-fileId in repo String tempFileId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + tempFileId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_with_id_not_found_ws(tempFileId, componentName + 1, workspaceName), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #14 - folder id String folderItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_TEST_FOLDER_ITEM_ID); try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + folderItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_with_id_not_a_file_ws(folderItemId, componentName + 1, workspaceName), e.getMessage()); } // validate that isLoadPolicySet, isLoadPolicySetToUseLoadRules, isComponentLoadConfigSetToExcludeComponents, // createFoldersForComponents, components, and componentLoadRules are set to appropriate values depending on the // value of loadPolicy and componentLoadConfig // #15 set createFoldersForComponents to false, do not set componentsToExclude and componentLoadRules, do not // set loadPolicy and componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, null, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #16 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #17 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #18 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #19 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #20 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #21 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #22 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #23 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #24 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #25 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #26 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // do not set loadPolicy and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, null, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #27 set createFoldersForComponents to false, set componentsToExclude to multiple component names and set // componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); // add same component name, should not be added twice buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, componentName + "1, " + componentName + "1", componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #28 set createFoldersForComponents to false, set componentsToExclude to multiple component ids and set // componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID) + "," + artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 2); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #29 set createFoldersForComponents to false, set componentsToExclude to multiple component ids and set // componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); // add same component id twice, should be added only once buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID) + "," + artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #30 add duplicate component name, which will fail buildConfiguration = new BuildConfiguration(repo, hjPath); try { buildConfiguration.initialize(workspaceHandle, workspaceName, null, true, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, componentName + "1, " + componentName + "3", componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_multiple_components_with_name_in_ws(componentName + 3, workspaceName), e.getMessage()); } } public Map<String, String> setupStreamConfig_toTestLoadPolicy(String workspaceName, String componentName) throws Exception { // create a repository workspace connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, true, true); // Create a component but don't add it to workspace IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); IComponent component = workspaceManager.createComponent(componentName, workspaceManager.teamRepository().loggedInContributor(), null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID, component.getItemId().getUuidValue()); IWorkspaceConnection streamConnection = workspaceManager.getWorkspaceConnection( (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_ITEM_ID)), null), null); // Create a workspace for the stream IWorkspaceConnection workspaceConnection = SCMUtil .createBuildWorkspace(workspaceManager, streamConnection, workspaceName + "_lrStreamWS"); // Create a baseline set for the workspace String snapshotName = workspaceName + "_lrStreamSS"; IBaselineSetHandle baselineSet = workspaceConnection.createBaselineSet(null, snapshotName, null, BaselineSetFlags.DEFAULT, null); // Change the owner of the baselineset to the stream streamConnection.addBaselineSet(baselineSet, null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_WS_ITEM_ID, workspaceConnection.getContextHandle().getItemId() .getUuidValue()); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_SS_ITEM_ID, baselineSet.getItemId().getUuidValue()); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testStreamConfig_loadPolicy(String workspaceName, String componentName, String hjPath, String buildPath, String pathToLoadRuleFile, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); String componentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID); String loadRuleItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_ITEM_ID); String addedComponentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); IWorkspaceHandle streamHandle = (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_ITEM_ID)), null); IBaselineSet baselineSet = RTCSnapshotUtils.getSnapshotByUUID(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_SS_ITEM_ID), new NullProgressMonitor(), Locale.getDefault()); IWorkspace workspace = RTCWorkspaceUtils.getInstance().getWorkspace( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_WS_ITEM_ID)), repo, new NullProgressMonitor(), Locale.getDefault()); IContributor contributor = repo.loggedInContributor(); // valid pathToLoadRuleFile with null loadPolicy buildConfiguration .initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, pathToLoadRuleFile, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_WS_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertFalse("Should not be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); @SuppressWarnings("rawtypes") Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySet should be true", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); BuildStreamDescriptor buildStreamDescriptor = buildConfiguration.getBuildStreamDescriptor(); AssertUtil.assertEquals(workspaceName + "_lrStream", buildStreamDescriptor.getName()); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_STREAM_SS_ITEM_ID), buildStreamDescriptor.getSnapshotUUID()); // validate RTCWorkspaceUtils.getComponentLoadRuleString() indirectly through buildConfiguration.initialize buildConfiguration = new BuildConfiguration(repo, hjPath); // #1 - no load rules buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 0); buildConfiguration = new BuildConfiguration(repo, hjPath); // #2 - missing separator try { buildConfiguration .initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_invalid_format("testLoadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #3 - missing componentName try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "/testLoadRule/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_component_name("/testLoadRule/ws.loadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #4 - missing file path try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule/", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_file_path("testLoadRule/"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #5 - duplicateComponentName try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "3/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_multiple_components_with_name_in_stream(componentName + 3, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #6 - non-existent component in the repository try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "12/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found(componentName + "12"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #7 - non-existent component in the workspace try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found_stream(componentName, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #8 - non-existent file try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_not_found_stream("ws.loadRule", componentName + 1, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #9 - folder try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/h-comp1", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_not_a_file_stream("h-comp1", componentName + 1, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #10 - valid ids buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); buildConfiguration = new BuildConfiguration(repo, hjPath); // #11 - non-existent-componentId in repo String tempComponentId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, tempComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found(tempComponentId), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #12 - non-existent-componentId in ws try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, addedComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found_stream(addedComponentId, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #13 - non-existent-fileId in repo String tempFileId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + tempFileId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_with_id_not_found_stream(tempFileId, componentName + 1, workspaceName + "_lrStream"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #14 - folder id String folderItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_TEST_FOLDER_ITEM_ID); try { buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + folderItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_with_id_not_a_file_stream(folderItemId, componentName + 1, workspaceName + "_lrStream"), e.getMessage()); } // validate that isLoadPolicySet, isLoadPolicySetToUseLoadRules, isComponentLoadConfigSetToExcludeComponents, // createFoldersForComponents, components, and componentLoadRules are set to appropriate values depending on the // value of loadPolicy and componentLoadConfig // #15 set createFoldersForComponents to false, do not set componentsToExclude and componentLoadRules, do not // set loadPolicy and componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, null, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #16 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #17 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #18 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #19 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #20 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #21 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #22 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #23 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #24 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #25 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #26 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // do not set loadPolicy and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, null, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #27 set createFoldersForComponents to false, set componentsToExclude to multiple component names and set // componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); // set non-existent component names to make sure that we ignore them buildConfiguration.initialize(streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, componentName + "1, " + componentName + "2," + componentName, componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 2); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); // #28 set createFoldersForComponents to false, set componentsToExclude to multiple component Ids and set // componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); // include non-existent component ids to make sure that we ignore them buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize( streamHandle, workspaceName + "_lrStream", workspace, baselineSet, true, contributor, Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID) + "," + artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID) + "," + UUID.generate().getUuidValue(), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 2); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertFalse("isSnapshotLoad should be false", buildConfiguration.isSnapshotLoad()); AssertUtil.assertTrue("isStreamLoad should be true", buildConfiguration.isStreamLoad()); } public Map<String, String> setupSnapshotConfig_toTestLoadPolicy(String workspaceName, String componentName) throws Exception { // create a repository workspace connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, true, true, true, true); // Create a component but don't add it to workspace IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repo); IComponent component = workspaceManager.createComponent(componentName, workspaceManager.teamRepository().loggedInContributor(), null); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID, component.getItemId().getUuidValue()); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testSnapshotConfig_loadPolicy(String workspaceName, String componentName, String hjPath, String buildPath, String pathToLoadRuleFile, Map<String, String> artifactIds) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); String componentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID); String loadRuleItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_FILE_ITEM_ID); String addedComponentId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT_ADDED_ITEM_ID); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); IBaselineSet baselineSet = RTCSnapshotUtils.getSnapshotByUUID(repo, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_SS_ITEM_ID), new NullProgressMonitor(), Locale.getDefault()); IContributor contributor = repo.loggedInContributor(); // valid pathToLoadRuleFile Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); buildConfiguration .initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, pathToLoadRuleFile, listener, Locale.getDefault(), new NullProgressMonitor()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_SS_WS_ITEM_ID, workspaceDescriptor.getWorkspace(connection.getRepositoryManager(), null).getItemId().getUuidValue()); AssertUtil.assertTrue("Not the expected workspace descriptor", workspaceDescriptor.getWorkspace(connection.getRepositoryManager(), null).getName().startsWith("HJP")); AssertUtil.assertFalse("Should not be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); @SuppressWarnings("rawtypes") Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isLoadPolicySet should be true", buildConfiguration.isLoadPolicySet()); BuildSnapshotDescriptor buildSnapshotDescriptor = buildConfiguration.getBuildSnapshotDescriptor(); AssertUtil.assertEquals(workspaceName + "_lrSS", buildSnapshotDescriptor.getSnapshotName()); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_LOAD_RULE_SS_ITEM_ID), buildSnapshotDescriptor.getSnapshotUUID()); // validate RTCWorkspaceUtils.getComponentLoadRuleString() indirectly through buildConfiguration.initialize buildConfiguration = new BuildConfiguration(repo, hjPath); // #1 - no load rules buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 0); buildConfiguration = new BuildConfiguration(repo, hjPath); // #2 - missing separator try { buildConfiguration .initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_invalid_format("testLoadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #3 - missing componentName try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "/testLoadRule/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_component_name("/testLoadRule/ws.loadRule"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #4 - missing file path try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, "testLoadRule/", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RTCWorkspaceUtils_path_to_load_rule_file_no_file_path("testLoadRule/"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #5 - duplicateComponentName try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "3/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_multiple_components_with_name_in_snapshot(componentName + 3, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #6 - non-existent component in the repository try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "12/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found(componentName + "12"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #7 - non-existent component in the workspace try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_name_not_found_snapshot(componentName, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #8 - non-existent file try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/ws.loadRule", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_not_found_snapshot("ws.loadRule", componentName + 1, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #9 - folder try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentName + "1/h-comp1", listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_not_a_file_snapshot("h-comp1", componentName + 1, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #10 - valid ids buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); loadRules = buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", loadRules.size() == 1); buildConfiguration = new BuildConfiguration(repo, hjPath); // #11 - non-existent-componentId in repo String tempComponentId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, tempComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals(Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found(tempComponentId), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #12 - non-existent-componentId in ws try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, addedComponentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_component_with_id_not_found_snapshot(addedComponentId, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #13 - non-existent-fileId in repo String tempFileId = UUID.generate().getUuidValue(); try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + tempFileId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_file_with_id_not_found_snapshot(tempFileId, componentName + 1, workspaceName + "_lrSS"), e.getMessage()); } buildConfiguration = new BuildConfiguration(repo, hjPath); // #14 - folder id String folderItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_TEST_FOLDER_ITEM_ID); try { buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, null, componentId + "/" + folderItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.fail("Exception expected"); } catch (RTCConfigurationException e) { AssertUtil.assertEquals( Messages.get(Locale.getDefault()).RepositoryConnection_load_rule_with_id_not_a_file_snapshot(folderItemId, componentName + 1, workspaceName + "_lrSS"), e.getMessage()); } // validate that isLoadPolicySet, isLoadPolicySetToUseLoadRules, isComponentLoadConfigSetToExcludeComponents, // createFoldersForComponents, components, and componentLoadRules are set to appropriate values depending on the // value of loadPolicy and componentLoadConfig // #15 set createFoldersForComponents to false, do not set componentsToExclude and componentLoadRules, do not // set loadPolicy and componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", null, null, false, null, null, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #16 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #17 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #18 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #19 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to loadAllComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_LOAD_ALL_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be false", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #20 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertTrue("createFoldersForComponents should be true", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #21 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #22 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #23 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and do not set componentLoadConfig buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, null, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #24 set createFoldersForComponents to true, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, true, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #25 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // set loadPolicy to useLoadRules and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should be empty", buildConfiguration.getComponents().size() == 0); AssertUtil.assertTrue( "loadRules should not be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 1); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #26 set createFoldersForComponents to false, set componentsToExclude and componentLoadRules, // do not set loadPolicy and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", null, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 1); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #27 set createFoldersForComponents to false, set multiple component names for componentsToExclude and // set componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); // add a space before the componentName to make sure that we trim the value buildConfiguration.initialize(baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, componentName + "1, " + componentName + "2", componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 2); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); // #28 set createFoldersForComponents to false, set multiple component ids for componentsToExclude and // set componentLoadRules, // set loadPolicy to useComponentLoadConfig and set componentLoadConfig to excludeSomeComponents buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration = new BuildConfiguration(repo, hjPath); // add a space before the componentName to make sure that we trim the value buildConfiguration.initialize( baselineSet, contributor, "HJP", "Test load rules for snapshot configuration", Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG, Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS, false, artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT1_ITEM_ID) + "," + artifactIds.get(TestSetupTearDownUtil.ARTIFACT_COMPONENT2_ITEM_ID), componentId + "/" + loadRuleItemId, listener, Locale.getDefault(), new NullProgressMonitor()); AssertUtil.assertFalse("createFoldersForComponents should be fale", buildConfiguration.createFoldersForComponents()); AssertUtil.assertTrue("componentsToExclude should not be empty", buildConfiguration.getComponents().size() == 2); AssertUtil.assertTrue( "loadRules should be empty", buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size() == 0); AssertUtil.assertTrue("for non-buildDefinition configuration isLoadPolicySet should be always be true irrespective of whether loadPolicy is specified", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseLoadRules should be false", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySetToUseComponentLoadConfig should be true", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertTrue("isComponentLoadConfigSetToExcludeSomeComponents should be true", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertFalse("isBuildDefinitionConfiguration should be false", buildConfiguration.isBuildDefinitionConfiguration()); AssertUtil.assertTrue("isSnapshotLoad should be true", buildConfiguration.isSnapshotLoad()); AssertUtil.assertFalse("isStreamLoad should be false", buildConfiguration.isStreamLoad()); } public Map<String, String> setupBuildDefinition_toTestIncrementalUpdate(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean shouldCreateFoldersForComponents, String loadPolicy, String componentLoadConfig, boolean isPersonalBuild, String loadMethod) throws Exception { // create a build definition // load directory "." // delete directory before loading (dir has other stuff that will be deleted) // accept changes before loading // add and set team.scm.loadPolicy and team.scm.componentLoadConfig properties // select create folders for components option depending on the value of shouldCreateFoldersForComponents // select doIncrementalUpdate option depending on the value of shouldDoIncrementalUpdate // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, false); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, shouldCreateFoldersForComponents ? "true" : "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), Constants.PROPERTY_LOAD_METHOD, loadMethod); if (loadPolicy != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_LOAD_POLICY, loadPolicy); } if (componentLoadConfig != null) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, Constants.PROPERTY_COMPONENT_LOAD_CONFIG, componentLoadConfig); } if (isPersonalBuild) { Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); IBuildResultHandle buildResultHandle = createPersonalBuildResult( buildDefinitionId, (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle( UUID.valueOf(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID)), null), "my buildLabel", listener); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultHandle.getItemId().getUuidValue()); if (failure[0] != null) { throw failure[0]; } } else { BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); } return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_doIncrementalUpdate(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean shouldCreateFoldersForComponents, String loadPolicy, String componentLoadConfig, boolean isPersonalBuild, String loadMethod) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertTrue("Personal build property is not as expected", buildConfiguration.isPersonalBuild() == isPersonalBuild); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals( (isPersonalBuild ? artifactIds.get(TestSetupTearDownUtil.ARTIFACT_STREAM_ITEM_ID) : artifactIds .get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID)), workspaceDescriptor.getWorkspaceHandle().getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil .assertTrue( "Create folders for components is not as expected", shouldCreateFoldersForComponents && (loadPolicy == null || loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy)) ? buildConfiguration .createFoldersForComponents() == true : buildConfiguration.createFoldersForComponents() == false); AssertUtil.assertEquals( 0, buildConfiguration.getComponentLoadRules(workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()).size()); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertFalse("Deletion is not needed", buildConfiguration.isDeleteNeeded()); AssertUtil .assertTrue( "isLoadPolicySetToUseLoadRules is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_LOAD_RULES.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseLoadRules() == true : buildConfiguration.isLoadPolicySetToUseLoadRules() == false); AssertUtil.assertTrue( "isLoadPolicySetToUseComponentLoadConfig is not as expected ", loadPolicy != null && Constants.LOAD_POLICY_USE_COMPONENT_LOAD_CONFIG.equals(loadPolicy) ? buildConfiguration .isLoadPolicySetToUseComponentLoadConfig() == true : buildConfiguration.isLoadPolicySetToUseComponentLoadConfig() == false); AssertUtil.assertTrue("isLoadPolicySet is not as expected", loadPolicy != null ? buildConfiguration.isLoadPolicySet() == true : buildConfiguration.isLoadPolicySet() == false); AssertUtil .assertTrue( "isComponentLoadConfigSetToExcludeSomeComponents is not as expected", componentLoadConfig != null && componentLoadConfig.equals(Constants.COMPONENT_LOAD_CONFIG_EXCLUDE_SOME_COMPONENTS) ? buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == true : buildConfiguration .isComponentLoadConfigSetToExcludeSomeComponents() == false); AssertUtil.assertEquals(loadMethod, buildConfiguration.getLoadMethod()); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } public Map<String, String> setUpBuildDefinition_incrementalChanges(String buildDefinitionId, String workspaceItemId, String componentItemId, boolean isPersonalBuild, String folderName, String fileName, IProgressMonitor monitor) throws Exception { IWorkspaceHandle wsHandle = (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle(UUID.valueOf(workspaceItemId), null); IWorkspaceConnection wsConnection = SCMPlatform.getWorkspaceManager(connection.getTeamRepository()).getWorkspaceConnection(wsHandle, monitor); IComponentHandle compHandle = (IComponentHandle)IComponent.ITEM_TYPE.createItemHandle(UUID.valueOf(componentItemId), null); IChangeSetHandle cs = wsConnection.createChangeSet(compHandle, null); IComponent component = (IComponent)connection.getTeamRepository().itemManager().fetchCompleteItem(compHandle, IItemManager.DEFAULT, null); // add new files and folders, that are expected to be loaded by IncrementalUpdateOperation in subsequent builds. SCMUtil.addVersionables(wsConnection, component, cs, new HashMap<String, IItemHandle>(), new String[] { "/" + folderName + "/", "/" + folderName + "/" + fileName }, null, "setupWorkspace_toTestLoadPolicy"); Map<String, String> artifactIds = new HashMap<String, String>(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); if (isPersonalBuild) { IBuildResultHandle buildResultHandle = createPersonalBuildResult(buildDefinitionId, wsConnection.getResolvedWorkspace(), "my-personal-build-label-for-incremental-changes", listener); artifactIds.put(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID, buildResultHandle.getItemId().getUuidValue()); if (failure[0] != null) { throw failure[0]; } } else { BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel for incremental changes", artifactIds); } wsConnection.closeChangeSets(Collections.singletonList(cs), null); return artifactIds; } private IBuildResultHandle createPersonalBuildResult(String buildDefinitionId, IWorkspaceHandle personalBuildWorkspace, String buildLabel, IConsoleOutput listener) throws TeamRepositoryException, RTCConfigurationException { ITeamRepository repo = connection.getTeamRepository(); BuildConnection buildConnection = new BuildConnection(repo); IBuildDefinition buildDefinition = buildConnection.getBuildDefinition(buildDefinitionId, null); if (buildDefinition == null) { throw new RTCConfigurationException(Messages.getDefault().BuildConnection_build_definition_not_found(buildDefinitionId)); } List<IBuildProperty> modifiedProperties = new ArrayList<IBuildProperty>(); IBuildProperty originalProperty = buildDefinition.getProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID); if (originalProperty != null && !originalProperty.getValue().equals(personalBuildWorkspace.getItemId().getUuidValue())) { modifiedProperties.add(BuildItemFactory.createBuildProperty(IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, personalBuildWorkspace .getItemId().getUuidValue())); } else { AssertUtil.fail("Should override build workspace"); } IBuildEngineHandle buildEngine = buildConnection.getBuildEngine(buildDefinition, null); if (buildEngine == null) { throw new RTCConfigurationException(Messages.getDefault().BuildConnection_no_build_engine_for_defn(buildDefinitionId)); } IBuildRequestParams params = BuildItemFactory.createBuildRequestParams(); params.setBuildDefinition(buildDefinition); params.getNewOrModifiedBuildProperties().addAll(modifiedProperties); params.setAllowDuplicateRequests(true); params.setPersonalBuild(true); params.getPotentialHandlers().add(buildEngine); params.setStartBuild(true); IBuildRequest buildRequest = ClientFactory.getTeamBuildRequestClient(repo).requestBuild(params, new NullProgressMonitor()); IBuildResultHandle buildResultHandle = buildRequest.getBuildResult(); if (buildLabel != null) { IBuildResult buildResult = (IBuildResult)repo.itemManager().fetchPartialItem(buildResultHandle, IItemManager.REFRESH, Arrays.asList(IBuildResult.PROPERTIES_VIEW_ITEM), new NullProgressMonitor()); buildResult = (IBuildResult)buildResult.getWorkingCopy(); buildResult.setLabel(buildLabel); ClientFactory.getTeamBuildClient(repo).save(buildResult, new NullProgressMonitor()); } return buildResultHandle; } public Map<String, String> setupBuildDefinition_loadRulesWithLoadPolicySetToLoadRules_doOptimizedIncrementalLoad(String workspaceName, String componentName, String buildDefinitionId, String hjPath, String buildPath, boolean configureLoadRules) throws Exception { // create a build definition with new format load rules // load directory "." // accept changes before loading // set loadPolicy to useLoadRules // set loadMethod to optimized incremental load // create a build engine // create a build request // verify that the buildConfiguration returns the load rules // and other settings. connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Map<String, String> artifactIds = new HashMap<String, String>(); try { IWorkspaceConnection buildWorkspace = setupWorkspace_toTestLoadPolicy(workspaceName, componentName, repo, artifactIds, configureLoadRules); // create the build definition BuildUtil.createBuildDefinition(repo, buildDefinitionId, true, artifactIds, null, IJazzScmConfigurationElement.PROPERTY_WORKSPACE_UUID, buildWorkspace.getContextHandle().getItemId().getUuidValue(), IJazzScmConfigurationElement.PROPERTY_FETCH_DESTINATION, buildPath, IJazzScmConfigurationElement.PROPERTY_ACCEPT_BEFORE_FETCH, "true", IJazzScmConfigurationElement.PROPERTY_DELETE_DESTINATION_BEFORE_FETCH, "false", IJazzScmConfigurationElement.PROPERTY_CREATE_FOLDERS_FOR_COMPONENTS, "false", IJazzScmConfigurationElement.PROPERTY_LOAD_COMPONENTS, new LoadComponents(Collections.<IComponentHandle> emptyList()).getBuildProperty(), Constants.PROPERTY_LOAD_POLICY, Constants.LOAD_POLICY_USE_LOAD_RULES, Constants.PROPERTY_LOAD_METHOD, Constants.LOAD_METHOD_OPTIMIZED_INCREMENTAL_LOAD); if (configureLoadRules) { BuildUtil.addPropertyToBuildDefiniion(repo, buildDefinitionId, IJazzScmConfigurationElement.PROPERTY_COMPONENT_LOAD_RULES, artifactIds.get("LoadRuleProperty")); } BuildUtil.createBuildResult(buildDefinitionId, connection, "my buildLabel", artifactIds); return artifactIds; } catch (Exception e) { // cleanup artifacts created BuildUtil.deleteBuildArtifacts(repo, artifactIds); throw e; } } public void testBuildDefinitionConfig_loadRulesWithLoadPolicySetToLoadRules_doOptimizedIncrementalLoad(String workspaceName, String buildDefinitionId, String hjPath, String buildPath, Map<String, String> artifactIds, boolean configureLoadRules) throws Exception { connection.ensureLoggedIn(null); ITeamRepository repo = connection.getTeamRepository(); Exception[] failure = new Exception[] { null }; IConsoleOutput listener = TestSetupTearDownUtil.getListener(failure); // get the build result String buildResultItemId = artifactIds.get(TestSetupTearDownUtil.ARTIFACT_BUILD_RESULT_ITEM_ID); IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(UUID.valueOf(buildResultItemId), null); BuildConfiguration buildConfiguration = new BuildConfiguration(repo, hjPath); buildConfiguration.initialize(buildResultHandle, false, "builddef_my buildLabel", false, listener, null, Locale.getDefault()); if (failure[0] != null) { throw failure[0]; } AssertUtil.assertFalse("Should NOT be a personal build", buildConfiguration.isPersonalBuild()); BuildWorkspaceDescriptor workspaceDescriptor = buildConfiguration.getBuildWorkspaceDescriptor(); AssertUtil.assertEquals(artifactIds.get(TestSetupTearDownUtil.ARTIFACT_WORKSPACE_ITEM_ID), workspaceDescriptor.getWorkspaceHandle() .getItemId().getUuidValue()); AssertUtil.assertEquals("my buildLabel", buildConfiguration.getBuildProperties().get("buildLabel")); AssertUtil.assertTrue("Should be accepting before fetching", buildConfiguration.acceptBeforeFetch()); AssertUtil.assertFalse("Should be a list of components to exclude", buildConfiguration.includeComponents()); AssertUtil.assertFalse("Should not be creating a folder for the component", buildConfiguration.createFoldersForComponents()); @SuppressWarnings("rawtypes") Collection loadRules = buildConfiguration.getComponentLoadRules( workspaceDescriptor.getConnection(connection.getRepositoryManager(), false, null), null, System.out, null, Locale.getDefault()); AssertUtil.assertTrue("Load rules not as expected", configureLoadRules ? loadRules.size() == 1 : loadRules.size() == 0); AssertUtil.assertEquals(0, buildConfiguration.getComponents().size()); File expectedLoadDir = new File(hjPath); expectedLoadDir = new File(expectedLoadDir, buildPath); AssertUtil.assertEquals(expectedLoadDir.getCanonicalPath(), buildConfiguration.getFetchDestinationFile().getCanonicalPath()); AssertUtil.assertEquals(buildDefinitionId + "_builddef_my buildLabel", buildConfiguration.getSnapshotName()); AssertUtil.assertTrue("Deletion is not needed", !buildConfiguration.isDeleteNeeded()); AssertUtil.assertTrue("isLoadPolicySetToUseLoadRules should be true", buildConfiguration.isLoadPolicySetToUseLoadRules()); AssertUtil.assertTrue("isLoadPolicySet should be true", buildConfiguration.isLoadPolicySet()); AssertUtil.assertFalse("isLoadPolicySetToUseComponentLoadConfig should be false", buildConfiguration.isLoadPolicySetToUseComponentLoadConfig()); AssertUtil.assertFalse("isComponentLoadConfigSetToExcludeSomeComponents should be false", buildConfiguration.isComponentLoadConfigSetToExcludeSomeComponents()); AssertUtil.assertEquals(Constants.LOAD_METHOD_OPTIMIZED_INCREMENTAL_LOAD, buildConfiguration.getLoadMethod()); AssertUtil.assertTrue("isBuildDefinitionConfiguration should be true", buildConfiguration.isBuildDefinitionConfiguration()); } }
[ "vaikuntam.narasimhan@gmail.com" ]
vaikuntam.narasimhan@gmail.com
7bbfa2741a8097d73b9b56e1d6f08c918e9e3041
7acdd2f5c8757b9b937fbfbfcab03cdefb409bb2
/src/lesson6/echoServer/StartEchoServer.java
a42d032343d4c603dcf8d5499a0f73f9af7c735d
[]
no_license
DmitryPanteleev/level2GBJava
90eaff61aef3ebb218ac454d218f468e42d2bc27
d830ba58fc4262fe8836f51960e5172f66003532
refs/heads/master
2020-03-20T05:11:43.125417
2018-06-26T18:02:32
2018-06-26T18:02:32
137,206,593
0
0
null
null
null
null
UTF-8
Java
false
false
147
java
package lesson6.echoServer; public class StartEchoServer { public static void main(String[] args) { EchoServer.StartServer(); } }
[ "TheDimok@rambler.ru" ]
TheDimok@rambler.ru
be45a15d0fb7e3b2f1c24b015b713a74fd311a0e
0bf8a01ba1c90bd0783018232bd3a83c8fdedf4e
/gtk-project-bsp/src/main/java/com/gtk/bsp/config/OAuth2Token.java
80fc8f659dbecf7b6362c9bb7c0d2d13391b1462
[]
no_license
gaoqisen/gtk-devops-scd
738aa8891a44dbedfd0c5158653e59f48105e7e8
c4df46016402d99902c6a6f58dc958eb2fd963bb
refs/heads/master
2023-06-23T00:58:34.068071
2023-06-19T14:59:43
2023-06-19T14:59:43
238,143,223
0
1
null
2023-03-08T17:31:56
2020-02-04T06:57:36
Java
UTF-8
Java
false
false
458
java
package com.gtk.bsp.config; import org.apache.shiro.authc.AuthenticationToken; /** * token * * @author Mark sunlightcs@gmail.com */ public class OAuth2Token implements AuthenticationToken { private String token; public OAuth2Token(String token){ this.token = token; } @Override public String getPrincipal() { return token; } @Override public Object getCredentials() { return token; } }
[ "1073825890@qq.com" ]
1073825890@qq.com
353d849b3aff5413f9cb034698b340dfaa13d736
69e0b08e956011c264a7f039b9b8d74b0e984d0d
/src/main/java/com/example/schoolRest/SchoolRestApplication.java
c1d1f16cb2b8b94ac2c6996e3a46997f0c5edc43
[]
no_license
vihanga951016/SchoolAppBackEnd
b1f95d4699f4b38169d5ca86e26d7e2ae6ebde12
a5de6e6fbbfac022923d9f8869d674b365b007da
refs/heads/master
2023-07-03T23:37:52.715084
2021-08-15T13:00:06
2021-08-15T13:00:06
387,650,382
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.example.schoolRest; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class SchoolRestApplication { public static void main(String[] args) { SpringApplication.run(SchoolRestApplication.class, args); } }
[ "it17150576@my.sliit.lk" ]
it17150576@my.sliit.lk
7755fba5f36df40f687142585d9eb36d9aaa98c3
939723acd81ad9c2c5c58ab85e16f7fbf031ff58
/controlpanel/java/ControlPanelService/src/org/alljoyn/ioe/controlpanelservice/communication/interfaces/AlertDialog.java
52427a13c7f4aae6af110e2b3e96831054f9d5cc
[]
no_license
casper-kim/services-base
c13313178c020e84fa3509bd9be5b6d731c95056
fbb04373116d6d59e58081e9bbabe10eed07cc10
refs/heads/master
2020-03-21T04:39:35.707215
2018-04-09T17:55:44
2018-04-09T17:55:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,017
java
/****************************************************************************** * Copyright AllSeen Alliance. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************************/ package org.alljoyn.ioe.controlpanelservice.communication.interfaces; import java.util.Map; import org.alljoyn.bus.BusException; import org.alljoyn.bus.Variant; import org.alljoyn.bus.annotation.BusInterface; import org.alljoyn.bus.annotation.BusMethod; import org.alljoyn.bus.annotation.BusProperty; import org.alljoyn.bus.annotation.BusSignal; import org.alljoyn.ioe.controlpanelservice.ControlPanelService; /** * Dialog interface */ @BusInterface(name = AlertDialog.IFNAME) public interface AlertDialog extends AlertDialogSuper { public static final String IFNAME = ControlPanelService.INTERFACE_PREFIX + ".Dialog"; public static final short VERSION = 1; /** * @return Interface version */ @BusProperty(signature = "q") public short getVersion() throws BusException; /** * @return States bitmask * @throws BusException */ @BusProperty(signature = "u") public int getStates() throws BusException; /** * @return Optional parameters * @throws BusException */ @BusProperty(signature = "a{qv}") public Map<Short, Variant> getOptParams() throws BusException; /** * @return Returns the dialog message * @throws BusException */ @BusProperty(signature = "s") public String getMessage() throws BusException; /** * @return Returns the number of the dialog buttons * @throws BusException */ @BusProperty(signature = "q") public short getNumActions() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action1() throws BusException; ; /** * Call the method if is relevant */ @BusMethod public void Action2() throws BusException; /** * Call the method if is relevant */ @BusMethod public void Action3() throws BusException; /** * Signal is sent when the UI container metadata changed * @param metadata */ @BusSignal public void MetadataChanged() throws BusException; }
[ "brian@two-bulls.com" ]
brian@two-bulls.com
85fdc716271704e15942308ae893b7cc4cf9d6c8
f8456e8ce2c90a31760f264ac2d0c6bd1a5da72b
/src/ru/ex4/apibt/service/TrailingService.java
0f89e0529f91c5b402619655996091df31979fe4
[]
no_license
aotyurin/ex4_tb
ab3ab247eebcbd78e3e400434fda3f01429010c9
96f93114cb4343c45edc5020e548d9eea27dfb13
refs/heads/et-206
2021-08-24T10:03:02.442859
2017-12-09T05:04:00
2017-12-09T05:04:00
101,908,576
0
0
null
2017-10-13T20:00:35
2017-08-30T17:15:47
Java
UTF-8
Java
false
false
1,257
java
package ru.ex4.apibt.service; import ru.ex4.apibt.dao.TrailingDao; import ru.ex4.apibt.dto.TrailingDto; import ru.ex4.apibt.model.custom.Trailing; import java.util.ArrayList; import java.util.List; public class TrailingService { private TrailingDao trailingDao; public TrailingService() { this.trailingDao = new TrailingDao(); } public List<TrailingDto> getTrailingDtoList() { List<TrailingDto> trailingDtoList = new ArrayList<>(); List<Trailing> trailingList = trailingDao.getTrailingList(); trailingList.forEach(trailing -> trailingDtoList.add(new TrailingDto(trailing.getPair(), trailing.getTrendType(), trailing.getPrice(), trailing.getDateCreated(), trailing.getDateNotify()))); return trailingDtoList; } public void save(TrailingDto trailingDto) { trailingDao.save(new Trailing(trailingDto.getPair(), trailingDto.getTrendType(), trailingDto.getPrice(), trailingDto.getDateCreated(), trailingDto.getDateNotify())); } public void delete(TrailingDto trailingDto) { trailingDao.delete(new Trailing(trailingDto.getPair(), trailingDto.getTrendType(), trailingDto.getPrice(), trailingDto.getDateCreated(), trailingDto.getDateNotify())); } }
[ "std-t@bk.ru" ]
std-t@bk.ru
1003c4989a649b8df1452bd434bb5e2fb7fca2d6
f978df5d035c7e7c7cf0f5c82479fac5604012c6
/src/main/java/Draw.java
156ece1d0ceda2a634cb8614110d1dc204da0572
[]
no_license
k1631444/DrawSquare
9844885ded75d317ed7ed6f4d1805093d8f07dfc
23d22029dae3a1c18e6d4bc1055509a236e835a0
refs/heads/master
2020-04-14T13:50:51.758190
2019-01-03T16:07:32
2019-01-03T16:07:32
163,880,328
0
0
null
null
null
null
UTF-8
Java
false
false
1,868
java
package main; public class Draw { // UTF-8 codes for the symbols used private final char topLeftUnicode = 0x250F; private final char bottomLeftUnicode = 0x2517; private final char topRightUnicode = 0x2513; private final char bottomRightUnicode = 0x251B; private final char horizontalLineUnicode = 0x2501; private final char verticalLineUnicode = 0x2503; private final char whitespaceUnicode = 0x2000; /** * Prints out a X by Y square to the console, where X = width and Y = height. * * @param width of the square * @param height of the square * @return String representation of the square along with "\n" where the line breaks would be * @throws Exception */ public String drawSquare(int width, int height) throws Exception { // Can't draw squares smaller than 2x2 hence we throw an exception if(width < 2 || height < 2) { throw new Exception("Width or Height is less than 2"); } String square = ""; // Draw the top row of the square square += drawRowOfSquare(topLeftUnicode, horizontalLineUnicode, topRightUnicode, width); // Draw the centre row(s) of the square for(int i = 0; i < height - 2; i++) { square += drawRowOfSquare(verticalLineUnicode, whitespaceUnicode, verticalLineUnicode, width); } // Draw the bottom row of the square square += drawRowOfSquare(bottomLeftUnicode, horizontalLineUnicode, bottomRightUnicode, width); System.out.println(square); return square; } private String drawRowOfSquare(char first, char filler, char last, int width) { String row = first + ""; for(int i = 0; i < width - 2; i++) { row += " " + filler + " "; } row += last + "\n"; return row; } public static void main(String[] args) { Draw draw = new Draw(); try { draw.drawSquare(4, 4); draw.drawSquare(6, 6); } catch (Exception e) { e.printStackTrace(); } } }
[ "k1631444@kcl.ac.uk" ]
k1631444@kcl.ac.uk
7b5393cf880976c8b538980f0688da336a4e4dc9
42cad3769d64dd35e497daa71cbab19467728d0d
/src/com/archos/mediacenter/utils/imageview/LoadTaskItem.java
0455d8fe7dc51f7fa13e7a0b741fc175d4270647
[ "Apache-2.0" ]
permissive
nova-video-player/aos-MediaLib
aa351b661a807107fbb6dcce87a34c67f29d9d2f
e21045b8907c232e06da0de52003a9f7f03314c9
refs/heads/v6.1
2023-08-24T16:44:14.324771
2023-08-22T06:19:25
2023-08-22T06:19:25
133,509,757
8
23
Apache-2.0
2023-09-12T16:54:10
2018-05-15T11:59:24
Java
UTF-8
Java
false
false
5,720
java
// Copyright 2017 Archos SA // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.archos.mediacenter.utils.imageview; import android.os.Message; import android.util.Log; import android.widget.ImageView; import com.archos.mediascraper.MultiLock; import java.lang.ref.WeakReference; import java.util.Map; /** * Provides context for a task */ public class LoadTaskItem implements Cloneable { // internal stuff passed on but not intended to be used /** internal reference to the target imageview, to get use {@link #getViewIfValid()}, don't modify */ /* default */ WeakReference<ImageView> weakView; /** internal key identifying the image, don't modify */ /* default */ String key; /** internal global map from imageview to key, don't modify */ /* default */ Map<ImageView, String> viewKeyMap; /** internal map used for thread interruption, may be null, don't modify */ /* default */ Map<ImageView, Thread> viewThreadMap; /** internal lock used for thread interruption, may be null, don't modify */ /* default */ MultiLock<ImageView> threadLock; /** internal Message object that gets send back to UI thread handler */ /* default */ Message reply; /** internal cache for images by {@link key}, null if cache disabled */ /* default */ BitmapMemoryCache cache; /** internal, true if debug sleep is configured */ /* default */ boolean sleep; /** internal reference to the processor of the current task */ /* default */ ImageProcessor imageProcessor; // part that is intended to be used by implementations /** object to load, this is of interest for IImageProcessor implementations */ public Object loadObject; /** result of loading objects, set subitems of this in {@link ImageProcessor#loadBitmap(LoadTaskItem)} */ public final LoadResult result = new LoadResult(); /** * @return the ImageView if the task is still valid, null otherwise */ /* default */ ImageView getViewIfValid() { ImageView ret = null; if (weakView != null && key != null) { ImageView view = weakView.get(); if (view != null) { String currentKey = viewKeyMap.get(view); if (key.equals(currentKey)) { ret = view; } } } return ret; } /** * @return true if this task item still needs processing, does not check thread interrupt status */ public boolean taskStillValid() { return getViewIfValid() != null; } /** adds this thread to the thread map & interrupts old thread that was mapped */ /* default */ void putThreadMapping() { if (viewThreadMap != null && weakView != null && key != null) { ImageView view = weakView.get(); if (view != null) { threadLock.lock(view); // only this thread can change viewThreadMap for view now try { String currentKey = viewKeyMap.get(view); if (key.equals(currentKey)) { Thread me = Thread.currentThread(); Thread other = viewThreadMap.put(view, me); // interrupt other thread that was working on this view if (other != null && other != me) { if (ImageViewSetter.DBG) { Log.d(ImageViewSetter.TAG, "LoadTaskItem#putThreadMapping interrupting thread working on " + currentKey); } other.interrupt(); } } } finally { threadLock.unlock(view); } } } } /** removes this thread from thread map */ /* default */ void removeThreadMapping() { if (viewThreadMap != null && weakView != null && key != null) { ImageView view = weakView.get(); if (view != null) { threadLock.lock(view); // only this thread can change viewThreadMap for view now try { String currentKey = viewKeyMap.get(view); if (key.equals(currentKey)) { // this thread is still the correct thread to work on view Thread me = Thread.currentThread(); Thread other = viewThreadMap.remove(view); // me and other should be the same, if not code is broken somewhere if (me != other) { Log.e(ImageViewSetter.TAG, "LoadTaskItem#removeThread() failed!"); } } } finally { threadLock.unlock(view); } } } } /** * @return this.clone() */ /* default */ LoadTaskItem duplicate() { try { return (LoadTaskItem) clone(); } catch (CloneNotSupportedException e) { Log.e(ImageViewSetter.TAG, "LoadTaskItem duplicate()", e); return null; } } }
[ "noury@archos.com" ]
noury@archos.com
2c7569a492942d4ed7363fa9d989dd3f630cd00b
7741953c566e76811af79b4322cd88b71d2530ad
/src/com/baihui/difu/controller/Main.java
08766049b482b8ec7a8aa7011760df3aa9b59c89
[]
no_license
shangkun13/difu
02d6db90ff7cca4e655292ef9767be9f461e2b51
abe7768d6adf65207ba9adca7031b2c53d9067cc
refs/heads/master
2021-09-03T15:22:46.684098
2018-01-10T03:53:10
2018-01-10T03:53:10
116,905,422
0
0
null
null
null
null
UTF-8
Java
false
false
1,926
java
package com.baihui.difu.controller; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import javax.servlet.ServletContext; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.baihui.difu.util.Util; public class Main extends Thread { private String string=""; private HttpServletResponse response=null; private HttpServletRequest request=null; private ServletContext context=null; private HttpSession session=null; public Main(HttpServletResponse response, HttpServletRequest request) { this.response = response; this.request = request; this.context=request.getSession().getServletContext(); this.session=request.getSession(true); } public void run(){ string="文件上传成功!";setCookie(); string+="<br/>开始解析文件内容!";setCookie(); try { string+=Util.message_error;setCookie(); string+="<br/>所有数据导入完成!";setCookie(); } catch (Exception e) { // TODO Auto-generated catch block string+="<br/>数据导入出错,请重试!" +e.getMessage(); e.printStackTrace(); } } void setCookie() { try { session.setAttribute("uploadresult", URLEncoder.encode(string,"utf-8")); Cookie cookie=new Cookie("uploadresult", URLEncoder.encode(string,"utf-8")); cookie.setDomain("baihui.com"); cookie.setPath("/"); cookie.setMaxAge(1000*60*30); response.addCookie(cookie); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } public HttpServletRequest getRequest() { return request; } public void setRequest(HttpServletRequest request) { this.request = request; } public ServletContext getContext() { return context; } public void setContext(ServletContext context) { this.context = context; } }
[ "shangkun.wang@pcstars.com" ]
shangkun.wang@pcstars.com
752f528eb59538caf0ef261244b46c2921266e95
f5c990f1039dddd57f994f40ef2e81c26b741af4
/spring-boot-jwt/src/main/java/com/sezayir/config/JwtTokenUtil.java
72ce11ec424090a9e895b2747d4784dbf274f1a0
[]
no_license
sezayirdagtekin/spring
f39649e1ae2cc2b6fa28afd5da0484b380dadd33
f7d9536d81e6e6a051262d05f82f067bb942e3c3
refs/heads/master
2021-12-11T02:44:57.251451
2021-08-22T07:08:29
2021-08-22T07:08:29
243,274,491
0
0
null
2021-06-04T21:56:42
2020-02-26T13:53:01
Java
UTF-8
Java
false
false
2,443
java
package com.sezayir.config; import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.function.Function; import org.springframework.beans.factory.annotation.Value; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; @Component public class JwtTokenUtil implements Serializable { private static final long serialVersionUID = -2550185165626007488L; @Value("${jwt.expireMiliSeconds}") public long expireMiliSeconds; @Value("${jwt.secret}") private String secret; public String getUsernameFromToken(String token) { return getClaimFromToken(token, Claims::getSubject); } public Date getIssuedAtDateFromToken(String token) { return getClaimFromToken(token, Claims::getIssuedAt); } public Date getExpirationDateFromToken(String token) { return getClaimFromToken(token, Claims::getExpiration); } public <T> T getClaimFromToken(String token, Function<Claims, T> claimsResolver) { final Claims claims = getAllClaimsFromToken(token); return claimsResolver.apply(claims); } private Claims getAllClaimsFromToken(String token) { return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); } private Boolean isTokenExpired(String token) { final Date expiration = getExpirationDateFromToken(token); return expiration.before(new Date()); } private Boolean ignoreTokenExpiration(String token) { //Expiration is ignored return false; } public String generateToken(UserDetails userDetails) { Map<String, Object> claims = new HashMap<>(); return doGenerateToken(claims, userDetails.getUsername()); } private String doGenerateToken(Map<String, Object> claims, String subject) { return Jwts.builder().setClaims(claims).setSubject(subject).setIssuedAt(new Date(System.currentTimeMillis())) .setExpiration(new Date(System.currentTimeMillis() + expireMiliSeconds)).signWith(SignatureAlgorithm.HS512, secret).compact(); } public Boolean canTokenBeRefreshed(String token) { return (!isTokenExpired(token) || ignoreTokenExpiration(token)); } public Boolean validateToken(String token, UserDetails userDetails) { final String username = getUsernameFromToken(token); return (username.equals(userDetails.getUsername()) && !isTokenExpired(token)); } }
[ "sezayir@hotmail.com" ]
sezayir@hotmail.com
1a68b013f0df2d1a704f74f4560c1e54b38a4b39
94243e15cfe9cccdf3638d53527fa58327efac29
/habeascorpus_tokens/apache-maven-3.0.4/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivator.java
9752bc6983ad5e5231af3f1067a415effd3d4b30
[]
no_license
habeascorpus/habeascorpus-data-withComments
4e0193450273f2d46ea9ef497746aaf93b5fc491
3a516954b42b24c93a8d1e292ff0a0907bed97ad
refs/heads/master
2021-01-20T21:53:35.264690
2015-05-22T14:59:36
2015-05-22T14:59:36
18,139,450
3
1
null
2023-03-20T11:51:26
2014-03-26T13:45:05
Java
UTF-8
Java
false
false
24,820
java
package TokenNamepackage org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT profile TokenNameIdentifier profile . TokenNameDOT activation TokenNameIdentifier activation ; TokenNameSEMICOLON /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ TokenNameCOMMENT_BLOCK Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. import TokenNameimport java TokenNameIdentifier java . TokenNameDOT util TokenNameIdentifier util . TokenNameDOT ArrayList TokenNameIdentifier Array List ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier java . TokenNameDOT util TokenNameIdentifier util . TokenNameDOT Arrays TokenNameIdentifier Arrays ; TokenNameSEMICOLON import TokenNameimport java TokenNameIdentifier java . TokenNameDOT util TokenNameIdentifier util . TokenNameDOT List TokenNameIdentifier List ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT Activation TokenNameIdentifier Activation ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT Profile TokenNameIdentifier Profile ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT building TokenNameIdentifier building . TokenNameDOT ModelProblemCollector TokenNameIdentifier Model Problem Collector ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT building TokenNameIdentifier building . TokenNameDOT ModelProblem TokenNameIdentifier Model Problem . TokenNameDOT Severity TokenNameIdentifier Severity ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT apache TokenNameIdentifier apache . TokenNameDOT maven TokenNameIdentifier maven . TokenNameDOT model TokenNameIdentifier model . TokenNameDOT profile TokenNameIdentifier profile . TokenNameDOT ProfileActivationContext TokenNameIdentifier Profile Activation Context ; TokenNameSEMICOLON import TokenNameimport org TokenNameIdentifier org . TokenNameDOT codehaus TokenNameIdentifier codehaus . TokenNameDOT plexus TokenNameIdentifier plexus . TokenNameDOT component TokenNameIdentifier component . TokenNameDOT annotations TokenNameIdentifier annotations . TokenNameDOT Component TokenNameIdentifier Component ; TokenNameSEMICOLON /** * Determines profile activation based on the version of the current Java runtime. * * @author Benjamin Bentmann */ TokenNameCOMMENT_JAVADOC Determines profile activation based on the version of the current Java runtime. * @author Benjamin Bentmann @ TokenNameAT Component TokenNameIdentifier Component ( TokenNameLPAREN role TokenNameIdentifier role = TokenNameEQUAL ProfileActivator TokenNameIdentifier Profile Activator . TokenNameDOT class TokenNameclass , TokenNameCOMMA hint TokenNameIdentifier hint = TokenNameEQUAL "jdk-version" TokenNameStringLiteral jdk-version ) TokenNameRPAREN public TokenNamepublic class TokenNameclass JdkVersionProfileActivator TokenNameIdentifier Jdk Version Profile Activator implements TokenNameimplements ProfileActivator TokenNameIdentifier Profile Activator { TokenNameLBRACE public TokenNamepublic boolean TokenNameboolean isActive TokenNameIdentifier is Active ( TokenNameLPAREN Profile TokenNameIdentifier Profile profile TokenNameIdentifier profile , TokenNameCOMMA ProfileActivationContext TokenNameIdentifier Profile Activation Context context TokenNameIdentifier context , TokenNameCOMMA ModelProblemCollector TokenNameIdentifier Model Problem Collector problems TokenNameIdentifier problems ) TokenNameRPAREN { TokenNameLBRACE boolean TokenNameboolean active TokenNameIdentifier active = TokenNameEQUAL false TokenNamefalse ; TokenNameSEMICOLON Activation TokenNameIdentifier Activation activation TokenNameIdentifier activation = TokenNameEQUAL profile TokenNameIdentifier profile . TokenNameDOT getActivation TokenNameIdentifier get Activation ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN activation TokenNameIdentifier activation != TokenNameNOT_EQUAL null TokenNamenull ) TokenNameRPAREN { TokenNameLBRACE String TokenNameIdentifier String jdk TokenNameIdentifier jdk = TokenNameEQUAL activation TokenNameIdentifier activation . TokenNameDOT getJdk TokenNameIdentifier get Jdk ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN jdk TokenNameIdentifier jdk != TokenNameNOT_EQUAL null TokenNamenull ) TokenNameRPAREN { TokenNameLBRACE String TokenNameIdentifier String version TokenNameIdentifier version = TokenNameEQUAL context TokenNameIdentifier context . TokenNameDOT getSystemProperties TokenNameIdentifier get System Properties ( TokenNameLPAREN ) TokenNameRPAREN . TokenNameDOT get TokenNameIdentifier get ( TokenNameLPAREN "java.version" TokenNameStringLiteral java.version ) TokenNameRPAREN ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN version TokenNameIdentifier version == TokenNameEQUAL_EQUAL null TokenNamenull || TokenNameOR_OR version TokenNameIdentifier version . TokenNameDOT length TokenNameIdentifier length ( TokenNameLPAREN ) TokenNameRPAREN <= TokenNameLESS_EQUAL 0 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE problems TokenNameIdentifier problems . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN Severity TokenNameIdentifier Severity . TokenNameDOT ERROR TokenNameIdentifier ERROR , TokenNameCOMMA "Failed to determine Java version for profile " TokenNameStringLiteral Failed to determine Java version for profile + TokenNamePLUS profile TokenNameIdentifier profile . TokenNameDOT getId TokenNameIdentifier get Id ( TokenNameLPAREN ) TokenNameRPAREN , TokenNameCOMMA activation TokenNameIdentifier activation . TokenNameDOT getLocation TokenNameIdentifier get Location ( TokenNameLPAREN "jdk" TokenNameStringLiteral jdk ) TokenNameRPAREN , TokenNameCOMMA null TokenNamenull ) TokenNameRPAREN ; TokenNameSEMICOLON return TokenNamereturn false TokenNamefalse ; TokenNameSEMICOLON } TokenNameRBRACE if TokenNameif ( TokenNameLPAREN jdk TokenNameIdentifier jdk . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN "!" TokenNameStringLiteral ! ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE active TokenNameIdentifier active = TokenNameEQUAL ! TokenNameNOT version TokenNameIdentifier version . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN jdk TokenNameIdentifier jdk . TokenNameDOT substring TokenNameIdentifier substring ( TokenNameLPAREN 1 TokenNameIntegerLiteral ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN isRange TokenNameIdentifier is Range ( TokenNameLPAREN jdk TokenNameIdentifier jdk ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE active TokenNameIdentifier active = TokenNameEQUAL isInRange TokenNameIdentifier is In Range ( TokenNameLPAREN version TokenNameIdentifier version , TokenNameCOMMA getRange TokenNameIdentifier get Range ( TokenNameLPAREN jdk TokenNameIdentifier jdk ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse { TokenNameLBRACE active TokenNameIdentifier active = TokenNameEQUAL version TokenNameIdentifier version . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN jdk TokenNameIdentifier jdk ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE } TokenNameRBRACE return TokenNamereturn active TokenNameIdentifier active ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic boolean TokenNameboolean isInRange TokenNameIdentifier is In Range ( TokenNameLPAREN String TokenNameIdentifier String value TokenNameIdentifier value , TokenNameCOMMA List TokenNameIdentifier List < TokenNameLESS RangeValue TokenNameIdentifier Range Value > TokenNameGREATER range TokenNameIdentifier range ) TokenNameRPAREN { TokenNameLBRACE int TokenNameint leftRelation TokenNameIdentifier left Relation = TokenNameEQUAL getRelationOrder TokenNameIdentifier get Relation Order ( TokenNameLPAREN value TokenNameIdentifier value , TokenNameCOMMA range TokenNameIdentifier range . TokenNameDOT get TokenNameIdentifier get ( TokenNameLPAREN 0 TokenNameIntegerLiteral ) TokenNameRPAREN , TokenNameCOMMA true TokenNametrue ) TokenNameRPAREN ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN leftRelation TokenNameIdentifier left Relation == TokenNameEQUAL_EQUAL 0 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn true TokenNametrue ; TokenNameSEMICOLON } TokenNameRBRACE if TokenNameif ( TokenNameLPAREN leftRelation TokenNameIdentifier left Relation < TokenNameLESS 0 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn false TokenNamefalse ; TokenNameSEMICOLON } TokenNameRBRACE return TokenNamereturn getRelationOrder TokenNameIdentifier get Relation Order ( TokenNameLPAREN value TokenNameIdentifier value , TokenNameCOMMA range TokenNameIdentifier range . TokenNameDOT get TokenNameIdentifier get ( TokenNameLPAREN 1 TokenNameIntegerLiteral ) TokenNameRPAREN , TokenNameCOMMA false TokenNamefalse ) TokenNameRPAREN <= TokenNameLESS_EQUAL 0 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic int TokenNameint getRelationOrder TokenNameIdentifier get Relation Order ( TokenNameLPAREN String TokenNameIdentifier String value TokenNameIdentifier value , TokenNameCOMMA RangeValue TokenNameIdentifier Range Value rangeValue TokenNameIdentifier range Value , TokenNameCOMMA boolean TokenNameboolean isLeft TokenNameIdentifier is Left ) TokenNameRPAREN { TokenNameLBRACE if TokenNameif ( TokenNameLPAREN rangeValue TokenNameIdentifier range Value . TokenNameDOT value TokenNameIdentifier value . TokenNameDOT length TokenNameIdentifier length ( TokenNameLPAREN ) TokenNameRPAREN <= TokenNameLESS_EQUAL 0 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn isLeft TokenNameIdentifier is Left ? TokenNameQUESTION 1 TokenNameIntegerLiteral : TokenNameCOLON - TokenNameMINUS 1 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE value TokenNameIdentifier value = TokenNameEQUAL value TokenNameIdentifier value . TokenNameDOT replaceAll TokenNameIdentifier replace All ( TokenNameLPAREN "[^0-9\.\-\_]" TokenNameStringLiteral [^0-9\.\-\_] , TokenNameCOMMA "" TokenNameStringLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON List TokenNameIdentifier List < TokenNameLESS String TokenNameIdentifier String > TokenNameGREATER valueTokens TokenNameIdentifier value Tokens = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier Array List < TokenNameLESS String TokenNameIdentifier String > TokenNameGREATER ( TokenNameLPAREN Arrays TokenNameIdentifier Arrays . TokenNameDOT asList TokenNameIdentifier as List ( TokenNameLPAREN value TokenNameIdentifier value . TokenNameDOT split TokenNameIdentifier split ( TokenNameLPAREN "[\.\-\_]" TokenNameStringLiteral [\.\-\_] ) TokenNameRPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON List TokenNameIdentifier List < TokenNameLESS String TokenNameIdentifier String > TokenNameGREATER rangeValueTokens TokenNameIdentifier range Value Tokens = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier Array List < TokenNameLESS String TokenNameIdentifier String > TokenNameGREATER ( TokenNameLPAREN Arrays TokenNameIdentifier Arrays . TokenNameDOT asList TokenNameIdentifier as List ( TokenNameLPAREN rangeValue TokenNameIdentifier range Value . TokenNameDOT value TokenNameIdentifier value . TokenNameDOT split TokenNameIdentifier split ( TokenNameLPAREN "\." TokenNameStringLiteral \. ) TokenNameRPAREN ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON addZeroTokens TokenNameIdentifier add Zero Tokens ( TokenNameLPAREN valueTokens TokenNameIdentifier value Tokens , TokenNameCOMMA 3 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON addZeroTokens TokenNameIdentifier add Zero Tokens ( TokenNameLPAREN rangeValueTokens TokenNameIdentifier range Value Tokens , TokenNameCOMMA 3 TokenNameIntegerLiteral ) TokenNameRPAREN ; TokenNameSEMICOLON for TokenNamefor ( TokenNameLPAREN int TokenNameint i TokenNameIdentifier i = TokenNameEQUAL 0 TokenNameIntegerLiteral ; TokenNameSEMICOLON i TokenNameIdentifier i < TokenNameLESS 3 TokenNameIntegerLiteral ; TokenNameSEMICOLON i TokenNameIdentifier i ++ TokenNamePLUS_PLUS ) TokenNameRPAREN { TokenNameLBRACE int TokenNameint x TokenNameIdentifier x = TokenNameEQUAL Integer TokenNameIdentifier Integer . TokenNameDOT parseInt TokenNameIdentifier parse Int ( TokenNameLPAREN valueTokens TokenNameIdentifier value Tokens . TokenNameDOT get TokenNameIdentifier get ( TokenNameLPAREN i TokenNameIdentifier i ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON int TokenNameint y TokenNameIdentifier y = TokenNameEQUAL Integer TokenNameIdentifier Integer . TokenNameDOT parseInt TokenNameIdentifier parse Int ( TokenNameLPAREN rangeValueTokens TokenNameIdentifier range Value Tokens . TokenNameDOT get TokenNameIdentifier get ( TokenNameLPAREN i TokenNameIdentifier i ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON if TokenNameif ( TokenNameLPAREN x TokenNameIdentifier x < TokenNameLESS y TokenNameIdentifier y ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn - TokenNameMINUS 1 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN x TokenNameIdentifier x > TokenNameGREATER y TokenNameIdentifier y ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn 1 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE if TokenNameif ( TokenNameLPAREN ! TokenNameNOT rangeValue TokenNameIdentifier range Value . TokenNameDOT closed TokenNameIdentifier closed ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn isLeft TokenNameIdentifier is Left ? TokenNameQUESTION - TokenNameMINUS 1 TokenNameIntegerLiteral : TokenNameCOLON 1 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE return TokenNamereturn 0 TokenNameIntegerLiteral ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic void TokenNamevoid addZeroTokens TokenNameIdentifier add Zero Tokens ( TokenNameLPAREN List TokenNameIdentifier List < TokenNameLESS String TokenNameIdentifier String > TokenNameGREATER tokens TokenNameIdentifier tokens , TokenNameCOMMA int TokenNameint max TokenNameIdentifier max ) TokenNameRPAREN { TokenNameLBRACE while TokenNamewhile ( TokenNameLPAREN tokens TokenNameIdentifier tokens . TokenNameDOT size TokenNameIdentifier size ( TokenNameLPAREN ) TokenNameRPAREN < TokenNameLESS max TokenNameIdentifier max ) TokenNameRPAREN { TokenNameLBRACE tokens TokenNameIdentifier tokens . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN "0" TokenNameStringLiteral 0 ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE private TokenNameprivate static TokenNamestatic boolean TokenNameboolean isRange TokenNameIdentifier is Range ( TokenNameLPAREN String TokenNameIdentifier String value TokenNameIdentifier value ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn value TokenNameIdentifier value . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN "[" TokenNameStringLiteral [ ) TokenNameRPAREN || TokenNameOR_OR value TokenNameIdentifier value . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN "(" TokenNameStringLiteral ( ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic List TokenNameIdentifier List < TokenNameLESS RangeValue TokenNameIdentifier Range Value > TokenNameGREATER getRange TokenNameIdentifier get Range ( TokenNameLPAREN String TokenNameIdentifier String range TokenNameIdentifier range ) TokenNameRPAREN { TokenNameLBRACE List TokenNameIdentifier List < TokenNameLESS RangeValue TokenNameIdentifier Range Value > TokenNameGREATER ranges TokenNameIdentifier ranges = TokenNameEQUAL new TokenNamenew ArrayList TokenNameIdentifier Array List < TokenNameLESS RangeValue TokenNameIdentifier Range Value > TokenNameGREATER ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON for TokenNamefor ( TokenNameLPAREN String TokenNameIdentifier String token TokenNameIdentifier token : TokenNameCOLON range TokenNameIdentifier range . TokenNameDOT split TokenNameIdentifier split ( TokenNameLPAREN "," TokenNameStringLiteral , ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE if TokenNameif ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN "[" TokenNameStringLiteral [ ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT replace TokenNameIdentifier replace ( TokenNameLPAREN "[" TokenNameStringLiteral [ , TokenNameCOMMA "" TokenNameStringLiteral ) TokenNameRPAREN , TokenNameCOMMA true TokenNametrue ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT startsWith TokenNameIdentifier starts With ( TokenNameLPAREN "(" TokenNameStringLiteral ( ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT replace TokenNameIdentifier replace ( TokenNameLPAREN "(" TokenNameStringLiteral ( , TokenNameCOMMA "" TokenNameStringLiteral ) TokenNameRPAREN , TokenNameCOMMA false TokenNamefalse ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT endsWith TokenNameIdentifier ends With ( TokenNameLPAREN "]" TokenNameStringLiteral ] ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT replace TokenNameIdentifier replace ( TokenNameLPAREN "]" TokenNameStringLiteral ] , TokenNameCOMMA "" TokenNameStringLiteral ) TokenNameRPAREN , TokenNameCOMMA true TokenNametrue ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT endsWith TokenNameIdentifier ends With ( TokenNameLPAREN ")" TokenNameStringLiteral ) ) TokenNameRPAREN ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT replace TokenNameIdentifier replace ( TokenNameLPAREN ")" TokenNameStringLiteral ) , TokenNameCOMMA "" TokenNameStringLiteral ) TokenNameRPAREN , TokenNameCOMMA false TokenNamefalse ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE else TokenNameelse if TokenNameif ( TokenNameLPAREN token TokenNameIdentifier token . TokenNameDOT length TokenNameIdentifier length ( TokenNameLPAREN ) TokenNameRPAREN <= TokenNameLESS_EQUAL 0 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN "" TokenNameStringLiteral , TokenNameCOMMA false TokenNamefalse ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE if TokenNameif ( TokenNameLPAREN ranges TokenNameIdentifier ranges . TokenNameDOT size TokenNameIdentifier size ( TokenNameLPAREN ) TokenNameRPAREN < TokenNameLESS 2 TokenNameIntegerLiteral ) TokenNameRPAREN { TokenNameLBRACE ranges TokenNameIdentifier ranges . TokenNameDOT add TokenNameIdentifier add ( TokenNameLPAREN new TokenNamenew RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN "99999999" TokenNameStringLiteral 99999999 , TokenNameCOMMA false TokenNamefalse ) TokenNameRPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON } TokenNameRBRACE return TokenNamereturn ranges TokenNameIdentifier ranges ; TokenNameSEMICOLON } TokenNameRBRACE private TokenNameprivate static TokenNamestatic class TokenNameclass RangeValue TokenNameIdentifier Range Value { TokenNameLBRACE private TokenNameprivate String TokenNameIdentifier String value TokenNameIdentifier value ; TokenNameSEMICOLON private TokenNameprivate boolean TokenNameboolean closed TokenNameIdentifier closed ; TokenNameSEMICOLON RangeValue TokenNameIdentifier Range Value ( TokenNameLPAREN String TokenNameIdentifier String value TokenNameIdentifier value , TokenNameCOMMA boolean TokenNameboolean closed TokenNameIdentifier closed ) TokenNameRPAREN { TokenNameLBRACE this TokenNamethis . TokenNameDOT value TokenNameIdentifier value = TokenNameEQUAL value TokenNameIdentifier value . TokenNameDOT trim TokenNameIdentifier trim ( TokenNameLPAREN ) TokenNameRPAREN ; TokenNameSEMICOLON this TokenNamethis . TokenNameDOT closed TokenNameIdentifier closed = TokenNameEQUAL closed TokenNameIdentifier closed ; TokenNameSEMICOLON } TokenNameRBRACE public TokenNamepublic String TokenNameIdentifier String toString TokenNameIdentifier to String ( TokenNameLPAREN ) TokenNameRPAREN { TokenNameLBRACE return TokenNamereturn value TokenNameIdentifier value ; TokenNameSEMICOLON } TokenNameRBRACE } TokenNameRBRACE } TokenNameRBRACE
[ "dma@cs.cmu.edu" ]
dma@cs.cmu.edu
31f9a865805a525146facfb9542604b7b38dc643
6b3ae4d72addbe8c769616e2d38ecb68af571a4a
/src/main/java/com/logprov/sampleUDF/Drop.java
f092d91835c7cd21212281737ac85a597f62ef91
[]
no_license
TramsWang/LogProv
db522847f93b640cecfe55ca75fa14669cfd0a37
57bffc6b6a7fd8b0657cf6b0b582f14fc7ecd8b1
refs/heads/master
2021-01-13T09:28:21.966616
2017-05-01T01:29:00
2017-05-01T01:29:00
72,071,729
0
0
null
null
null
null
UTF-8
Java
false
false
669
java
package com.logprov.sampleUDF; import org.apache.pig.EvalFunc; import org.apache.pig.FilterFunc; import org.apache.pig.data.Tuple; import java.util.Random; /** * @author Ruoyu Wang * @version 1.0 * Date: 2017.05.01 * * This filtering function is used in illustration examples. It randomly drops records. */ public class Drop extends FilterFunc { private Random random; private double drop_rate; public Drop(String drop_rate) { random = new Random(); this.drop_rate = Double.valueOf(drop_rate); } public Boolean exec(Tuple t) { double d = random.nextDouble(); return (drop_rate > d); } }
[ "babyfish92@163.com" ]
babyfish92@163.com
0e91dfbdb6498967342697abdbb421c00dd5eca8
c70aa98276c29dc9d833f218cecbbf561c981887
/src/com/dhtmlx/connector/GridFactory.java
008cd3a1955cbe975b0905ddc1a7de05fa9ce498
[]
no_license
MrBingo2008/JYOA
3153fe6521cad0dc427b9d9ab6e440347d17df62
e3ae57774a7e85bcea244940e3f98f43ba1a617f
refs/heads/master
2020-04-08T22:32:32.962861
2018-12-02T15:43:47
2018-12-02T15:43:47
159,791,099
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
/* * Copyright (c) 2009 - DHTMLX, All rights reserved */ package com.dhtmlx.connector; import java.util.HashMap; /** * A factory for creating Grid related objects. */ public class GridFactory extends BaseFactory { /* (non-Javadoc) * @see com.dhtmlx.connector.BaseFactory#createDataItem(java.util.HashMap, com.dhtmlx.connector.DataConfig, int) */ public DataItem createDataItem(HashMap<String,String> data, DataConfig config, int index){ return new GridDataItem(data,config,index); } /* (non-Javadoc) * @see com.dhtmlx.connector.BaseFactory#createDataProcessor(com.dhtmlx.connector.BaseConnector, com.dhtmlx.connector.DataConfig, com.dhtmlx.connector.DataRequest, com.dhtmlx.connector.BaseFactory) */ public DataProcessor createDataProcessor(BaseConnector connector, DataConfig config, DataRequest request, BaseFactory cfactory) { // TODO Auto-generated method stub return new GridDataProcessor(connector, config, request, cfactory); } }
[ "267298093@qq.com" ]
267298093@qq.com
7f95ecb6c5db094331854df18ad73bd63354766f
2485ae61f7e2aa09cdb5a6e9b7da98e9db6cbbbd
/app/src/main/java/com/example/communicationportal/IEmailSearch.java
e61a1b720db0cd61235d4d8bf658a08506643d9f
[]
no_license
cvikram21/Communication_Portal
470bf3ef7aa93283acd751159eb71c7f6ff9aed4
070fe4f0743c268d8debd3f9cb3c009013f1cc6b
refs/heads/master
2021-01-12T11:53:40.387705
2016-11-30T04:47:01
2016-11-30T04:47:01
69,512,211
0
0
null
null
null
null
UTF-8
Java
false
false
205
java
package com.example.communicationportal; import javax.net.ssl.SSLHandshakeException; public interface IEmailSearch { void emails(int a) throws SSLHandshakeException; } //Interface created by ayesha
[ "chavavikrampvc@gmail.com" ]
chavavikrampvc@gmail.com
ab6f1da5658c941b861fa0473f8483ea8ad4d495
e82c6c3b7caae61a042fbc9c83aa5cb02ca143b0
/src/main/java/com/cinnober/ciguan/datasource/filter/RpcAttributeSortCriteria.java
8c02f6bc7d5cc8533f1e2b9a9522d7bef31d573e
[ "MIT" ]
permissive
cinnober/ciguan
41fb1f135007a729b19cf5758cea1c246129920d
0ed6f4b01addee42b2fb5444359834f8cf7a2506
refs/heads/develop
2021-09-26T10:36:08.474316
2018-10-29T13:17:49
2018-10-29T13:17:49
107,663,998
3
2
MIT
2018-10-29T13:17:50
2017-10-20T10:16:44
Java
UTF-8
Java
false
false
2,306
java
/* * The MIT License (MIT) * * Copyright (c) 2017 Cinnober Financial Technology AB (cinnober.com) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.cinnober.ciguan.datasource.filter; import com.cinnober.ciguan.datasource.RpcSortCriteriaIf; /** * Attribute version of a sort criteria passed from the client to the server */ @SuppressWarnings("serial") public class RpcAttributeSortCriteria implements RpcSortCriteriaIf { private final String mAttributeName; private final SortOrder mSortOrder; public RpcAttributeSortCriteria(String pAttributeName, SortOrder pSortOrder) { mAttributeName = pAttributeName; mSortOrder = pSortOrder; } @Override public String getAttributeName() { return mAttributeName; } @Override public SortOrder getSortOrder() { return mSortOrder; } public String toString() { return mAttributeName + "=" + mSortOrder.name(); } public static RpcSortCriteriaIf fromString(String pCriteria) { if (pCriteria == null || pCriteria.equals("null")) { return null; } String[] tParts = pCriteria.split("="); return new RpcAttributeSortCriteria(tParts[0], SortOrder.valueOf(tParts[1])); } }
[ "anders.thyberg@cinnober.com" ]
anders.thyberg@cinnober.com
23225109438ce8529c377fff1f2663ac9484d04a
1490298a95f3e43e5ac4aa0e4fa510e25bd30c85
/Courses/7140/Lectures/Implementation/Languages/Java8/src/FXbackgroundWorkerDemo.java
858a325072bf0832c91f9ef4e59151edf6208012
[]
no_license
pmateti/pmateti.github.io
5cfaa36ad55c37f3c13a4b94b423e953d4c05591
ab1791591f4e1e9795b0302d2cdba0d3d65971e7
refs/heads/master
2021-07-06T14:44:57.696513
2020-10-05T22:26:28
2020-10-05T22:26:28
192,220,054
0
0
null
2020-10-05T19:40:12
2019-06-16T17:45:51
HTML
UTF-8
Java
false
false
3,377
java
// package Demo; http://clarkonium.net/2015/06/tasks-and-ui-updates-in-javafx/ import javafx.application.Application; import javafx.concurrent.Task; import javafx.concurrent.WorkerStateEvent; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.stage.StageStyle; public class FXbackgroundWorkerDemo extends Application { private final static String CNTR_LBL_STR = "Counter: "; private int counter; Label counterLabel; Button counterButton; Button taskButton; @Override public void start(Stage primaryStage) { counter = 0; counterLabel = new Label(CNTR_LBL_STR + counter); counterButton = new Button("Increment Counter"); counterButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { counter++; counterLabel.setText(CNTR_LBL_STR + counter); } }); taskButton = new Button("Long Running Task"); taskButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { runTask(); } }); VBox mainPane = new VBox(); mainPane.setPadding(new Insets(10)); mainPane.setSpacing(5.0d); mainPane.getChildren().addAll(counterLabel, counterButton, taskButton); primaryStage.setScene(new Scene(mainPane)); primaryStage.show(); } private void runTask() { final double wndwWidth = 300.0d; Label updateLabel = new Label("Running tasks..."); updateLabel.setPrefWidth(wndwWidth); ProgressBar progress = new ProgressBar(); progress.setPrefWidth(wndwWidth); VBox updatePane = new VBox(); updatePane.setPadding(new Insets(10)); updatePane.setSpacing(5.0d); updatePane.getChildren().addAll(updateLabel, progress); Stage taskUpdateStage = new Stage(StageStyle.UTILITY); taskUpdateStage.setScene(new Scene(updatePane)); taskUpdateStage.show(); Task longTask = new Task<Void>() { @Override protected Void call() throws Exception { int max = 50; for (int i = 1; i <= max; i++) { if (isCancelled()) { break; } updateProgress(i, max); updateMessage("Task part " + String.valueOf(i) + " complete"); Thread.sleep(100); } return null; } }; longTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() { @Override public void handle(WorkerStateEvent t) { taskUpdateStage.hide(); } }); progress.progressProperty().bind(longTask.progressProperty()); updateLabel.textProperty().bind(longTask.messageProperty()); taskUpdateStage.show(); new Thread(longTask).start(); } public static void main(String[] args) { launch(args); } }
[ "pmateti@wright.edu" ]
pmateti@wright.edu
6db098544c844f1af82bf0bf9e1d3e5f1ba77fd6
38c5b9e4c27ce24c54899f6eccbd95d0aed63c8a
/EncapsulationChallenge/src/com/company/Printer.java
5760c8008f5a246794765541ae4339be6e8c9e3b
[]
no_license
Van-Hoang-Kha/Java
c0ff9f9b2f45dd5836b2f19b3c4945d933c21a1a
10f56693c5f9a70483f3ae9f4b85341626a01c30
refs/heads/master
2021-12-14T10:35:23.299956
2017-04-26T03:48:29
2017-04-26T03:48:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,113
java
package com.company; /** * Created by Asab on 4/16/2017. */ public class Printer { private int tonerLevel; private int pagesPrinted; private boolean duplex; public Printer(int tonerLevel, boolean duplex) { if(tonerLevel > -1 && tonerLevel <= 100){ this.tonerLevel = tonerLevel; }else { this.tonerLevel = -1; } this.duplex = duplex; this.pagesPrinted = 0; } public int addToner(int tonerAmount){ if(tonerLevel > 0 && tonerAmount <= 100){ if(this.tonerLevel + tonerAmount > 100){ return -1; } this.tonerLevel +=tonerAmount; return this.tonerLevel; }else{ return -1; } } public int printPages(int pages){ int pagesToPrint = pages; if(this.duplex){ pagesToPrint/=2; System.out.println("Printing in duplex mode"); } this.pagesPrinted +=pagesToPrint; return pagesToPrint; } public int getPagesPrinted(){ return pagesPrinted; } }
[ "asabeneh@gmail.com" ]
asabeneh@gmail.com
d2c151f3050762671af1079111db35a06e43cd42
a2966adad6c4816544ba0a15416d9b1263e8ad6a
/seahorse/internal/businessservices/ProfileService/src/seahorse/internal/business/profileservice/api/ProfileServiceApplication.java
616f0404126ae4577e029829fe19f0842b027f7d
[]
no_license
woodsongem/seahorse
38fb91053f83dc7f94005efd17318fb9f7e35c27
50e5d73b98a1c6bf221e9d6f33c8bef57156686b
refs/heads/master
2021-01-17T06:08:50.636318
2019-03-17T21:54:08
2019-03-17T21:54:08
93,977,770
0
0
null
null
null
null
UTF-8
Java
false
false
333
java
/** * */ package seahorse.internal.business.profileservice.api; import org.glassfish.jersey.server.ResourceConfig; /** * @author SMJE * */ public class ProfileServiceApplication extends ResourceConfig { public ProfileServiceApplication() { packages("seahorse.internal.business.profileservice.api.ProfileServiceApi"); } }
[ "SMJE@Sajans-MacBook-Pro.local" ]
SMJE@Sajans-MacBook-Pro.local
47301c18353ff72be4312abbc28586e16388b004
a6f61f3ac44226a740d1ffe419f11d5fa9cbb6db
/src/main/java/Main.java
8177f27023de4de9838c83a82c855e9f2e0ec385
[]
no_license
RGudovanyy/ip_validator
b0d958f5a3b254b490ac89995bac7e2219b3a066
2d864069beb783efcb5880f9bd1736e05dbd12e4
refs/heads/master
2021-01-20T19:56:45.740568
2016-08-04T16:08:48
2016-08-04T16:08:48
64,855,193
0
0
null
null
null
null
UTF-8
Java
false
false
7,486
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; public class Main { public static void main(String[] args){ List<String> resultList; String firstAddress = ""; String secondAddress = ""; // получаем от пользователя границы диапазона IP адресов try(BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))){ firstAddress = reader.readLine(); secondAddress = reader.readLine(); } catch (IOException e) { System.out.println("Произошла ошибка ввода/вывода " + e.getMessage()); } // преобразуем каждый адрес в массив int, где каждый элемент - октет адреса int [] address1 = parseAddress(firstAddress); int [] address2 = parseAddress(secondAddress); //Long t0 = System.currentTimeMillis(); //заполняем список адресов для заданного диапазона resultList = fillDiapasonArray(address1,address2); System.out.println(); for(String s : resultList) System.out.println(s); //Long t1 = System.currentTimeMillis(); //System.out.println("Time: " + (t1 - t0)/1000d + " sec."); } /** * Метод преобразует строку с ip адресом в массив int, где каждый элемент является октетом. * Если какой либо элемент превосходит максимально допустимый - 255, метод возвращает null вместо массива * @param address строка содержащая ip адрес * @return массив int, состоящий из октетов ip адреса * @throws NumberFormatException если введенный адрес содержит посторонние элементы */ public static int[] parseAddress(String address){ int [] addressArray = new int[4]; for(int index = 0; index < 4; index++){ int nextOctet = 0; try{ nextOctet = Integer.parseInt(address.split("\\.")[index]); }catch (NumberFormatException e){ System.out.println("Введен некорректный IP адрес. Адрес должен состоять только из цифр и разделяющих точек"); System.exit(1); } if(nextOctet > 255) { System.out.println("ip адрес "+ address +" неверен. Октет " + index + " должен быть меньше или равен 255"); return null; } addressArray[index] = nextOctet; } return addressArray; } /** * Служебный метод, который проверяет, что верхняя граница диапазона IP адресов меньше нижней * Если обнаружится, что верхняя граница больше нижней - метод вызовет System.exit(1) и напишет в консоль об ошибке * @param firstAddress верхняя граница диапазона адресов * @param secondAddress нижняя граница диапазона адресов */ private static void validateAdresses(int[] firstAddress, int[] secondAddress){ if(firstAddress[0] > secondAddress[0]) { System.out.println("Первый октет первого адреса больше первого октета второго адреса"); System.exit(1); } else { if(firstAddress[1] > secondAddress[1]) { System.out.println("Второй октет первого адреса больше второго октета второго адреса"); System.exit(1); } else { if(firstAddress[2] > secondAddress[2]) { System.out.println("Третий октет первого адреса больше третьего октета второго адреса"); System.exit(1); } else { if(firstAddress[3] > secondAddress[3]){ System.out.println("Четвертый октет первого адреса больше четвертого октета второго адреса"); System.exit(1); } } } } } /** * Метод проходит между верхней и нижней границей диапазона IP адресов, и каждый допустимый адрес добавляет * в список. * Расчет производится следующим образом: если младший октет в десятичном представлении принимает значение 255, то * старший октет увеличивается на 1 бит, младший приводится к 0. Значение первого октета не может принять значение * больше 255. * * @param firstAddress верхняя граница диапазона * @param secondAddress нижняя граница диапазона * @return список допустимых адресов * @throws NullPointerException в случае если какая-либо из границ равна null */ public static List<String> fillDiapasonArray(int[] firstAddress, int[] secondAddress){ List<String> diapason = new ArrayList<>(); // проверяем корректность границ диапазона - начальный адрес не должен быть больше конечного try{ validateAdresses(firstAddress,secondAddress); }catch (NullPointerException e){ return diapason; } int fourth = firstAddress[3]; int third = firstAddress[2]; int second = firstAddress[1]; int first = firstAddress[0]; while (true){ if(first == secondAddress[0] & second == secondAddress[1] & third == secondAddress[2] & fourth == secondAddress[3]) break; else { fourth++; if (fourth > 255) { fourth = 0; third += 1; if (third > 255) { third = 0; second += 1; if (second > 255) { second = 0; first += 1; if(first > 255){ break; } } } } diapason.add(first + "." + second + "." + third + "." + fourth); } } //последний адрес является границей диапазона diapason.remove(diapason.size()-1); return diapason; } }
[ "rgudovanyy@yandex.ru" ]
rgudovanyy@yandex.ru
a0dd1b3d2fa6c251d868a475a927e6597ba15e46
f67aed0d543e78cff9c3c7063819260fc2877896
/src/main/java/com/agoda/component/FTPFileDownloader.java
e15fb930ed73dfea7b862faec71df8725a2faf5a
[]
no_license
sgole1/FileDownloader
bf6320493b660e61bbc3dd38bda8fd54df6eafaf
82eff9ef6d2c285e5c216adfcff2b59204d54e55
refs/heads/master
2020-12-30T12:36:29.854246
2017-05-16T03:00:36
2017-05-16T03:00:36
91,402,399
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package com.agoda.component; import java.io.IOException; import java.io.InputStream; import java.net.URL; import java.net.URLConnection; import com.agoda.util.FileUtil; public class FTPFileDownloader implements FileDownloader { @Override public void downloadData(String path, String destination) throws IOException{ URL url = new URL (path); URLConnection urlc = url.openConnection(); InputStream is = urlc.getInputStream(); FileUtil.readFileChannel(is,destination); } }
[ "email_simi@yahoo.co.in" ]
email_simi@yahoo.co.in
7fc2825418a6eee8b9729b33765f2ba6a5f2900b
b8f1d85b5e94108ac0aed2b182e709bbdc72774f
/src/org/devpup/javatutorials/eclipse/ScannerDemo.java
20a4c60377e5474f9bd0985f2c8bb1856223d3ad
[]
no_license
devpup/javatutorials
310f6e46ad4086b68601d4e784659503ca055cae
733826a2ccefc2a82b2a705e2c904f6cb7da4e0f
refs/heads/master
2020-06-16T04:48:16.198233
2019-08-01T01:26:49
2019-08-01T01:26:49
195,483,660
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package org.devpup.javatutorials.eclipse; import java.util.Scanner; public class ScannerDemo { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc = new Scanner(System.in); int i = sc.nextInt(); System.out.println(i*1000); sc.close(); } }
[ "whdgh777@naver.com" ]
whdgh777@naver.com
bd8951e4489a2de9c3a83db31c9832e12c3eb0cd
163d67cf6262663cb13cf56ace060fb806fad71e
/EclipseWorkspace/MyTest/src/com/cn/changhong/PageBean.java
7332a8e2df2dafbb0a7e79ad3045ba9b1c326e78
[]
no_license
wl2015/backups
2de66dfc965be62772123ca328fb3ac3f0212cf4
b01cf1ef3b1a0d5d02927fa69385c7bcd8bcf179
refs/heads/master
2021-01-18T17:40:01.928581
2016-10-28T09:21:24
2016-10-28T09:21:24
71,968,705
0
0
null
null
null
null
UTF-8
Java
false
false
515
java
package com.cn.changhong; /** * Created by admin on 16-10-25. */ public class PageBean { String pageNum; String num; public String getPageNum() { return pageNum; } public void setPageNum(String pageNum) { this.pageNum = pageNum; } public String getNum() { return num; } public void setNum(String num) { this.num = num; } public void setPageBean(String pageNum, String num){ this.pageNum = pageNum; this.num = num; } }
[ "379858262@qq.com" ]
379858262@qq.com
dee73da90608f24d84a347f20b4003766ee98cea
f68012957a525271d820cdab67256cf460e31625
/com/drturner/leetcode/problem38/CountSay.java
390b497ec37b937b935d958242a1a833e4494845
[]
no_license
Turnarde/leetcode
d6091322d385dccdf4040a73ac7d8f9175129aa7
23ac7bd25aaf65faa460a66caf6fa2d83733fa0f
refs/heads/master
2021-05-18T07:08:08.484102
2020-07-18T01:24:38
2020-07-18T01:24:38
251,171,988
1
0
null
2020-07-18T01:24:39
2020-03-30T01:29:40
Java
UTF-8
Java
false
false
1,467
java
package com.drturner.leetcode.problem38; import java.util.HashMap; import java.util.LinkedList; import java.util.Queue; /** * ClassName: CountSay * Description: TO DO * Author: Drturner * Date: 2020/4/29 * Version: 1.0 */ public class CountSay { class Result{ private Character c; private Integer freq; public Result(Character c, Integer freq) { this.c = c; this.freq = freq; } } public String countAndSay(int n) { if (n==1) return "1"; String s=countAndSay(n-1); StringBuilder res=new StringBuilder(); Queue<Result> queue=new LinkedList<>(); int count=1; for (int i=0;i<s.length();i++){ if (i==s.length()-1){ Result map=new Result(s.charAt(i),count); queue.offer(map); break; } if (s.charAt(i)==s.charAt(i+1)){ count++; } else{ Result map=new Result(s.charAt(i),count); queue.offer(map); count=1; } } while (!queue.isEmpty()){ Result poll = queue.poll(); res.append(poll.freq).append(poll.c); } return res.toString(); } public static void main(String[] args) { CountSay countSay = new CountSay(); String s1 = countSay.countAndSay(5); System.out.println(s1); } }
[ "you@example.comliu" ]
you@example.comliu
ee89b36a120478b232909b7419937d90ecd78d58
83d56024094d15f64e07650dd2b606a38d7ec5f1
/Construccion/PROYECTO.SICC/MSG/ENTIDADES/src/es/indra/sicc/dtos/msg/DTODestinatarioMensaje.java
b185ac8207a84468a5a9057e452c1936c8592a6b
[]
no_license
cdiglesias/SICC
bdeba6af8f49e8d038ef30b61fcc6371c1083840
72fedb14a03cb4a77f62885bec3226dbbed6a5bb
refs/heads/master
2021-01-19T19:45:14.788800
2016-04-07T16:20:51
2016-04-07T16:20:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
648
java
package es.indra.sicc.dtos.msg; import es.indra.sicc.cmn.negocio.auditoria.DTOAuditableSICC; public class DTODestinatarioMensaje extends DTOAuditableSICC { private Long oidTipoDestinatario; private Long oidMensaje; public DTODestinatarioMensaje() { } public void setOidTipoDestinatario(Long newOidTipoDestinatario) { oidTipoDestinatario = newOidTipoDestinatario; } public Long getOidTipoDestinatario() { return oidTipoDestinatario; } public Long getOidMensaje() { return oidMensaje; } public void setOidMensaje(Long oidMensaje) { this.oidMensaje = oidMensaje; } }
[ "hp.vega@hotmail.com" ]
hp.vega@hotmail.com
3274619110d97312c8f9a0c885674d8a582df351
33323ca4c77bde40636a295d3544f1c3d324edcf
/android/app/src/main/java/com/mynubank/MainApplication.java
4cc3d99ee3ae954f994920ecbad9d00f6bfe6581
[ "MIT" ]
permissive
bbeltrame01/myNuBank
b4db81a4ab2747f579a18e622ed729c9a0d05d24
75fb45e99f384e3d663aa200d93a7906baff274f
refs/heads/master
2020-07-05T09:35:58.818092
2020-03-20T23:40:04
2020-03-20T23:40:04
202,610,862
0
0
MIT
2020-03-20T23:29:24
2019-08-15T21:00:37
JavaScript
UTF-8
Java
false
false
1,447
java
package com.mynubank; import android.app.Application; import android.util.Log; import com.facebook.react.PackageList; import com.facebook.hermes.reactexecutor.HermesExecutorFactory; import com.facebook.react.bridge.JavaScriptExecutorFactory; import com.facebook.react.ReactApplication; import com.horcrux.svg.SvgPackage; import com.oblador.vectoricons.VectorIconsPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.util.List; public class MainApplication extends Application implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected List<ReactPackage> getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List<ReactPackage> packages = new PackageList(this).getPackages(); // Packages that cannot be autolinked yet can be added manually here, for example: // packages.add(new MyReactNativePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); SoLoader.init(this, /* native exopackage */ false); } }
[ "bruno.beltrame@systempro.com.br" ]
bruno.beltrame@systempro.com.br